Find the sum of squares of all eigenvalues of a matrix I found this question which asks to find the sum of squares of all eigenvalues (possibly complex, not necessarily distinct) of

(I used a picture because it was hard to write matrix down without making any mistakes)
Now, I used this to find the eigenvalues, and squared them manually to see that the answer is $38$. But, of course, that's not the way to solve it. There must be some patterns in this matrix that I am missing. All I can find is that this is a $14\times 14$ matrix, and there is an $11$-triangle of zeroes at the left bottom, and a $10$-triangle of zeroes at the right up. Also, most of the matrix is full of zeroes and almost all the entries are at the diagonal. But, these are not enough to solve the problem.
Also, is there any tricks in finding sum of squares (without finding the exact eigenvalues) that will reduce our effort?
As achille hui pointed out, sum of square of eigenvalues = trace of square of matrix. So, now I need to have ideas of squaring this matrix. It doesn't look simple enough to just multiply using traditional methods, there must be some tricks.
Thanks in advance
 A: Let $M$ be the $14 \times 14$ matrix at hand and $\lambda_1,\ldots,\lambda_{14}$ be its eigenvalues. The key is
$$\sum_{k=1}^{14} \lambda_k^2 = {\rm Tr}(M^2)$$
Notice $M$ is a block diagonal matrix, one can split it into four blocks:

*

*$A$ (row/column 1-4),

*$B$ (row/column 5-8),

*$C$ (row/column 9-11),

*$D$ (row/column 12-14).

We can split the 14 eigenvalues $\lambda_k$ into 4 groups, one group for each block.  WOLOG, we can assume $\lambda_1,\ldots,\lambda_4$ come from $A$, $\lambda_5,\ldots,\lambda_8$ come from $B$, $\lambda_9,\ldots,\lambda_{11}$ come from $C$ and $\lambda_{12},\ldots,\lambda_{14}$ come from $D$.
When one square $M$, one get another block diagonal matrix with 4 blocks: $A^2$, $B^2$, $C^2$ and $D^2$. As a consequence, we have
$${\rm Tr}(M^2) = {\rm Tr}(A^2) + {\rm Tr}(B^2) + {\rm Tr}(C^2) + {\rm Tr}(D^2)$$
Block $B$ are triangular. If you square $B$, you get another triangular matrix whose diagonal entries are square of diagonal entries of $B$. As a result,
$$\sum_{k=5}^8 \lambda_k^2 = {\rm Tr}(B^2) = 2^2+2^2+1^2+1^2 = 10$$
Similarly, $C$ are triangular, we have
$$\sum_{k=9}^{11} \lambda_k^2 = {\rm Tr}(C^2) = 1^2+1^2+5^2 = 27$$
Block $A$ and $D$ are small enough, you can directly compute their squares and obtain their traces. In fact, one don't even to compute their matrix square.
Block $A$ has the
form of a companion matrix, one can read off its characteristic polynomial as
$$\begin{align}\chi_A(\lambda) \stackrel{def}{=} & \det[\lambda I_4 - A] = \prod_{k=1}^4(\lambda - \lambda_k)\\
= & 1 + 0t + 1t^2 + 2t^3 + t^4\\
= & t^4 + 2t^3 + t^2 + 1\end{align}$$
Apply Vieta's formula, we have
$$\sum_{k=1}^4 \lambda_k = -2\quad\text{ and }\quad
\sum_{1 \le k < \ell \le 4} \lambda_k\lambda_\ell = 1$$
This leads to
$${\rm Tr}(A^2) = \sum_{k=1}^4 \lambda_k^2 = \left(\sum_{k=1}^4 \lambda_k\right)^2 - 2\left(\sum_{1 \le k < \ell \le 4}\lambda_k\lambda_\ell\right) = (-2)^2 - 2(1) = 2$$
Block $D$ has the form of transpose of a companion matrix, we can read off its characteristic polynomial as
$$\chi_D(\lambda) = -1 + 5t + 3t^2 + t^3$$
and hence
$${\rm Tr}(D^2) = \sum_{k=12}^{14} \lambda_k^2 = 3^2 - 2(5) = -1$$
Combine all these, one get
$${\rm Tr}(M^2) = 2 + 10 + 27 + (-1) = 38$$
A: The matrix is almost diagonal. Now, the sum of squares of the eigenvalues equals
$$\sum \lambda_i^2 = (\sum \lambda_i)^2 - 2 \sum_{i< j} \lambda_i \lambda_j$$
Now,
$\sum_{i< j} \lambda_i \lambda_j $
equals the sum of principal $2\times 2$ minors. Notice that every principal $2 \times 2$ minor equals the product of its diagonal elements, except the principal minors $(3,4)$ and $(13,14)$. The sum of the principal $2\times 2$ minors therefore equals
$$\sum_{i< j} d_i d_j + 6$$
where $d_i$ are the diagonal elements. Therefore we have
$$\sum \lambda_i^2 = (\sum \lambda_i)^2 - 2 \sum \lambda_i \lambda_j = (\sum d_i)^2 - 2 (\sum_{i< j} d_i d_j + 6 ) = \\= \sum d_i^2 - 12 $$
So the sum of the square of eigenvalues is "almost" the sum of squares of diagonal elements, because the matrix is almost diagonal. Now, $\sum d_i^2 = 3 \cdot 2^2 + 4 \cdot 1^2 + 5^2 + (-3)^2=50$, so $\sum \lambda_i^2 = 38$.
A: The given matrix is the "(diagonal) sum" of the following matrices:
$$
A=
\begin{bmatrix} 
&&&-1\\1&&&0\\&1&&-1\\&&1&-2
\end{bmatrix}\ ,\
[2]\ ,\ 
[2]\ ,\ 
\begin{bmatrix} 
1\\1&1
\end{bmatrix}\ ,\
\begin{bmatrix} 
1&1&6\\&1&2\\&&5
\end{bmatrix}\ ,\
B=
\begin{bmatrix} 
&1\\&&1\\1&-5&-3
\end{bmatrix}
\ .
$$
Except for the companion(-like) matrices $A,B$, all other are triangular, we can read off for them the eigenvalues on the diagonal, so their contribution to the final sum is:
$$
2^2+2^2+(1^2+1^2)+(1^2+1^2+5^2)=37\ .
$$
The contributions for the companion matrices $A,B$ (in classic or transposed form) still remain. Their characteristic polynomials are immediately extracted, they are
$$
\begin{aligned}
P_A(x) = 1 + x^2 + 2x^3+x^4\ ,\\
P_B(x) = -1 + 5x + 3x^2 + x^3\ ,
\end{aligned}
$$
so Vieta relation give the sum of the eigenvalues, $e_1=\sum \lambda_i$, the traces of $A,B$, which are $-2$ and $-3$, and the next symmetric polynomials in the eigenvalues, $e_2=\sum_{i<j}\lambda_i\lambda_j$, which are $1$ and $5$. So the corresponding sums of the squares of the eigenvalues, $\sum \lambda_i^2 = e_1^2-2e_2$ are $(-2)^2-2\cdot 1=2$ and $(-3)^2-2\cdot 5=-1$, so the final result is $37+2-1=38$.
