TITLE: An inequation about real pairwise commuting matrices
QUESTION [5 upvotes]: Let A and B be two real $n\times n$ matrices such that $AB=BA$. It’s known that $\det(A^2+B^2)\geq 0$.
I wonder if it’s true that:
For $k$ pairwise commuting real matrices $A_1,\cdots,A_k$,we have:
  $\det(\sum_{i=1}^{k}A_{i}^2)\geq0$.

REPLY [2 votes]: We can generalize the required result as follows
Let $(A_i)_{1≤i≤p}$ be $n$-by-$n$ real matrices that are simultaneously triangularizable over $\mathbb{C}$. Show that $\det(\sum_{i=1}^p {A_i}^2)≥0$.
I raised this problem on Image, the bulletin of the ILAS; cf. (statement and solution) p.37, pb. 56.2 in
https://www.ilasic.org/IMAGE/IMAGES/image58.pdf
A reader provided a solution (cf. the above reference) that uses the block decomposition proposed by user1551. I proposed another solution that I can detail if you are interested.