Sum of squared eigenvalues of $A$ equals $\operatorname{tr}(A^2)$? Is the following always true:
$$\sum_i \lambda_i^2 = \operatorname{tr}(A^2)$$
where $\lambda_i$ are the eigenvalues of $A$. If it's not true in general, then under what conditions is it true? Is it always true if $A$ is square and positive semidefinite?
Please provide a proof or reference. Thanks!

tr $A^2 $ = tr $AA$ = tr $UDU^{-1}UDU^{-1} $ = tr $UD^2 U^{-1}$ = tr $U^{-1}UD^2 =$ tr $ D^2$ = $\sum \lambda_i^2$
