Trace of power of a square real matrix What property should a real square matrix $A$ have for the following to be true
$$
\text{tr}(A^{2}) = \text{tr}(AA^{T}),
$$
where $A = XY$ and $X,Y \in\mathbb{R}^{n \times n}$ both are symmetric positive semidefinite.
Can it be non-Hermitian? Because I've found there is no reason to claim $A$ is also Hermitian positive semidefinite.
 A: Denote the symmetric and skew-symmetric parts of $A$ by $H$ and $K$ respectively. Then
$$
\operatorname{tr}(A^2-AA^T)
=\operatorname{tr}(A(A-A^T))
=2\operatorname{tr}\left((H+K)K\right)
=2\operatorname{tr}(HK)+2\operatorname{tr}(K^2)
=2\operatorname{tr}(K^2).
$$
Therefore $\operatorname{tr}(A^2)=\operatorname{tr}(AA^T)$ if and only if $\operatorname{tr}(K^2)=0$. This result holds for any field of characteristic $\ne2$.
If $A$ is real, $\operatorname{tr}(K^2)=-\operatorname{tr}(K^TK)=-\|K\|_F^2$. So, in this case, $\operatorname{tr}(A^2)=\operatorname{tr}(AA^T)$ if and only if $K=0$, i.e. if and only if $A$ is real symmetric (hence Hermitian). In particular, if $A=XY$ for some positive semidefinite matrices $X$ and $Y$, then $\operatorname{tr}(A^2)=\operatorname{tr}(AA^T)$ if and only if $XY=YX$.
The case is different when the underlying field is complex. E.g.
$$
A=\pmatrix{0&\sqrt{1-i}&i&\sqrt{i}\\ -\sqrt{1-i}&0&\sqrt{i}&i\\ -i&-\sqrt{i}&0&\sqrt{1-i}\\ -\sqrt{i}&-i&-\sqrt{1-i}&0}
$$
is skew-symmetric and $A^2$ has a zero diagonal. It follows that $0=\operatorname{tr}(A^2)=-\operatorname{tr}(AA^T)$. But this $A$ clearly isn't Hermitian.
