If S,Z are positive semidefinite. We now know that $y^TSy=\sum_{i}\sum_{j}S_{ij}y_{i}y_{j}\geq 0 $, same goes for Z. We also know that we can write S as $S=\sum_{i}\lambda_{i}x_{i}x_{i}^{T}$, with $\lambda_{i}$ the eigenvalues and $x_{i}$ eigenvectors of the matrix S. In other words $S_{ij}=\sum_{k}\lambda_{k}x_{ik}x_{jk}$ by construction.
I want to show that $$\sum_{i}\sum_{j}S_{ij}Z_{ij}\geq0$$ Could anyone help me show this??
I would also like to know why the equality of this statement only holds if and only if $S \cdot Z=0$
Let $x_1, \dotsc, x_n$ be an orthonormal basis of eigenvectors for $Z$ with eigenvalues $\lambda_1, \dotsc, \lambda_n \geq 0$. Then
$$ \sum_{i, j}S_{ij}Z_{ij} = \operatorname{Trace}(SZ) = \sum_i\langle SZ x_i, x_i\rangle = \sum_i \lambda_i \langle Sx_i,x_i \rangle \geq 0. $$
In case of equality each term of the summand must be zero. So either $\lambda_i = 0$ and $Zx_i = 0$ or $\langle Sx_i, x_i \rangle = \langle S^{1/2}x_i, S^{1/2}x_i \rangle = 0$ and $Sx_i = 0$. This shows that $SZx_i = 0$ for all indices $i$ and so $SZ = 0$.