An extension of an algebraic question from my test Let $A$ and $B$ be two real $n\times n$ matrices s.t. $AB=BA$. We now that $\det(A^2+B^2) \geq 0$. Is  the similar question true for $n$ matrices which commute with each other? If not, how do I generalize this question?
 A: The following results are in this paper: 
Let $S$ be any set of commuting matrices. Then there is a fixed nonsingular matrix $P$ such that $P^{-1}AP$ is upper triangular for each $A$ in $S$. 
Let $A_j$, $1\le j\le p$, be commuting $n\times n$ matrices, and let $f=f(x_1,\dots,x_p)$ be an arbitrary polynomial in $x_1,\dots,x_p$. Then there is a fixed ordering of the eigenvalues of $A_j$, say, $\lambda_j(1),\dots,\lambda_j(n)$, $1\le j\le p$ (which does not depend on $f$), such that the eigenvalues of $f(A_1,\dots,A_p)$ are precisely $f(\lambda_1(i),\dots,\lambda_p(i))$, $1\le i\le n$. 
I think it follows from these results that the eigenvalues of $A_1^2+\cdots+A_p^2$ are of two types: sums of squares of real eigenvalues of the $A_i$ (hence, nonnegative real numbers), together with eigenvalues that involve the nonreal eigenvalues of the $A_i$, and this second type comes in complex conjugate pairs (although I'm not seeing right away how to dot every i and cross every t). The determinant of the sum of squares is then a product of nonnegative reals and complex conjugate pairs of complex numbers, hence, nonnegative. 
