<s>[INST] $\operatorname{spectrum}(AB) = \operatorname{spectrum}(BA)$? Suppose we have two $n \times n$ matrices $A, B$. It seems like $\delta(AB)=\delta(BA)$, but I can't generally poove it. 
If $\det(A) \neq 0$ then $\det(AB - \lambda I) = 0 \Leftrightarrow $ $ \det(AB - \lambda I) \cdot \det(A) = 0 \Leftrightarrow \det(ABA - \lambda A) = 0 \Leftrightarrow $ $ \det(A) \cdot \det(BA - \lambda I) = 0 \Leftrightarrow \det(BA - \lambda I) = 0$, so $$\delta(AB)=\delta(BA)$$
Same if $\det(B) \neq 0$.
But how to prove it for $\det(A) = \det(B) = 0$? Is it still true?
 [/INST] I've seen the following nice proof credited to Paul Halmos. Assume that $A$ is not invertible. By performing row and column operations on $A$ and encoding them with invertible matrices, we can write
$$ A = P \begin{pmatrix} I_{r \times r} & 0 \\ 0 & 0 \end{pmatrix} Q $$
where $P, Q$ are invertible and $r = \mathrm{rank}(A)$. Write also
$$ QBP = \begin{pmatrix} B_{11} & B_{12} \\ B_{21} & B_{22} \end{pmatrix} $$
where $B_{11} \in M_{r}(\mathbb{F}), B_{22} \in M_{(n-r)\times(n-r)}(\mathbb{F})$, etc.
Then we have
$$ AB = P \begin{pmatrix} I_{r \times r} & 0 \\ 0 & 0 \end{pmatrix} Q Q^{-1} \begin{pmatrix} B_{11} & B_{12} \\ B_{21} & B_{22} \end{pmatrix} P^{-1} = P \begin{pmatrix} I_{r \times r} & 0 \\ 0 & 0 \end{pmatrix}\begin{pmatrix} B_{11} & B_{12} \\ B_{21} & B_{22} \end{pmatrix}P^{-1} = P \begin{pmatrix} B_{11} & B_{12} \\ 0 & 0 \end{pmatrix} P^{-1}. $$
This shows that $AB$ is similar to a block upper triangular matrix and so $\chi_{AB}(\lambda) = \lambda^{n-r} \chi_{B_{11}}(\lambda)$ (where $\chi$ is the characteristic polynomial).
Similarly,
$$ BA = Q^{-1} \begin{pmatrix} B_{11} & B_{12} \\ B_{21} & B_{22} \end{pmatrix} P^{-1} P \begin{pmatrix} I_{r \times r} & 0 \\ 0 & 0 \end{pmatrix} Q = Q^{-1} \begin{pmatrix} B_{11} & B_{12} \\ B_{21} & B_{22} \end{pmatrix} \begin{pmatrix} I_{r \times r} & 0 \\ 0 & 0 \end{pmatrix} Q = Q^{-1} \begin{pmatrix} B_{11} & 0 \\ B_{21} & 0 \end{pmatrix} Q $$
which shows that $BA$ is similar to a block lower triangular matrix and so $\chi_{BA}(\lambda) = \lambda^{n-r} \chi_{B_{11}}(\lambda)$.
We have shown that $\chi_{AB}(\lambda) = \chi_{BA}(\lambda)$ which shows that the eigenvalues of $AB$ and $BA$ (and even their algebraic multiplicity) coincide.
</s>