[Math] Why the sum of eigenvalues of A+B and AB equals the sum of all the individual eigenvalues of A and B

linear algebra

I think it is an easy question but I can't see the obvious fact.
The question is as follows:

a) Construct 2 by 2 matrices such that the eigenvalues of $AB$ are not the products of the eigenvalues of $A$ and $B$, and the eigenvalues of $A+B$ are not the sums of the individual eigenvalues.

b) Verify, however, that the sum of the eigenvalues of $A+B$ equals the sum of all the individual eigenvalues of $A$ and $B$, and similarly for products. Why is this?

I have tried using two matrices. I used the following matrices (arbitrary):
$$A = \left( \begin{matrix} 3 & 0\\ 0 & 2\end{matrix}\right)$$
$$B = \left( \begin{matrix} 4 & -5\\ 2 & -3\end{matrix}\right)$$
It is true that the sum of the eigenvalues of $A+B$ equals the sum of all the individual eigenvalues of $A$ and $B$. For this, I perceived the sum of eigenvalues = the sum of the matrix trace. So, I guess question b holds because $ trace A + trace B = trace (A+B) $. However, my explanation fails when I check on $AB$, it is false because my trace actually becomes $(a_{11}*b_{11}+a_{12}*b_{21})+(a_{21}*b_{12}+a_{22}*b_{22})$. Thus, I would like to know the real reason why question (b) holds, especially for matrix $AB$.

Please advise.

Best Answer

This follows from knowing the trace of a matrix is the sum of the eigenvalues, and the determinant is the same for the product. Let $\lambda_i^+,\lambda_i,\alpha_i,\beta_i$ be the $i$th eigenvalue of $A+B$, $AB$, $A$, and $B$, respectively. Then: $$ \sum_i\lambda_i^+=\text{tr}(A+B)=\sum_jA_{jj}+B_{jj}=\text{tr}(A)+\text{tr}(B)=\sum_i\alpha_i+\sum_j\beta_j$$ $$ \prod_i\lambda_i=\det(AB)=\det(A)\det(B)= \left(\prod_i\alpha_i\right)\left(\prod_j\beta_j\right) $$