If $X$ and $W$ are real, square, symmetric, positive semidefinite matrices of the same dimension, does $XW + WX$ have to be positive semidefinite?
This is not homework.
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityTo answer the second part of your question, the matrix $XW+WX$ need not be positive semidefinite. Let $$X = \left(\begin{array}{rr} 4 & 2 \\ 2 & 1 \end{array} \right).$$ Let $$W = \left(\begin{array}{rr} 4 & -2 \\ -2 & 1 \end{array} \right).$$ Let $$v = \left(\begin{array}{r}0\\1\end{array}\right). $$
Then $$v^T XW v + v^T W X v = \big( \ 2 \ 1 \ \big) \left(\begin{array}{rc}-2 \\1\end{array}\right) + \big(\,-\!2 \ 1 \ \big) \left(\begin{array}{c} 2 \\1\end{array}\right) = -6 < 0. $$
If $A, B$ are real, pos, and symmetric, then $A=A^{1/2}A^{1/2}$ and the trace of $AB$ is the trace of $A^{1/2}A^{1/2}B$ which is the the trace of $A^{1/2}BA^{1/2}$ which is a positive semidefinite matrix. Thus trace of $AB$ is nonnegative.
$$XW \sim ZX\underbrace{Z^{-1}Z}_IWZ^{-1} = DZWZ^{-1}$$
Since $X$ is symmetric, square, and positive semi-definite, $D$ is diagonal for some $Z$ and has non-negative elements.
$ZWZ^{-1} \sim W$ has positive trace (trace is invariant to similarity and $W$ is positive square and semi-definite). There can be no negative values in the diagonal for $W$ and the following shows why.
Let $\mathbf{e}_i$ be the unit vector for the index $i$ that is the same index as the supposed negative diagonal value in $W$ (or any similarity to $W$). Then $\mathbf{e}_i^\top W \mathbf{e}_i = W_{ii} < 0$ which contradicts that $W$ is positive semidefinite.