Help with understanding the proof for: $AB$ and $BA$ have the same characteristic polynomial (for square complex matrices)

Late remark. I think the cleanest solution is the following purely algebraic one, which some other people (like Bill Dubuque) have posted on this and other sites for quite a number of times (but I am unable to find a link).

The proof is really simple and it works for square matrices over any field. First, suppose $x$ and the entries of $A$ and $B$ are (independent) indeterminates. Then $$ \det(xI-AB)\det(A)=\det(xA-ABA)=\det(A)\det(xI-BA). $$ Cancel out $\det(A)$ (it's cancellable because it is a non-zero polynomial in the indeterminate entries of $A$) on both sides, we get $\det(xI-AB)=\det(xI-BA)$. Spealialise the entries of $A$ and $B$ to concrete values in the field of interest, we get the final result.

Proofs like this are usually not taught at universities, probably because students are taught basic linear algebra before they learn the formal definitions of "indeterminate" or "polynomial" in some abstract algebra courses.


My preferred proof is as follows: it suffices to note that for any $\lambda \neq 0$, we have by Sylvester's determinant identity that $$ \det(\lambda I - AB) = \lambda^n\det\left(I - \frac 1{\lambda}AB\right) = \lambda^n\det\left(I - \frac 1{\lambda}BA\right) = \det(\lambda I - BA) $$ Thus, the two polynomials on $\lambda$ are identical for all $\lambda \neq 0$. We may conclude that the polynomials are exactly the same.


Here's the gist of your proof: for any $A,B$, there are sequences $(A_n)_{n \in \Bbb N}, (B_n)_{n \in \Bbb N}$ of invertible matrices such that $A_n \to A$ and $B_n \to B$ (the existence of such sequences is equivalent to density). We note that by the continuity of the function that maps a matrix to its characteristic polynomial (and by the continuity of matrix multiplication), we have $$ \det(\lambda I - AB) = \lim_{n \to \infty} \det(\lambda I - A_nB_n)\\ \det(\lambda I - BA) = \lim_{n \to \infty} \det(\lambda I - B_nA_n) $$ However, because the statement holds for invertible matrices, these two sequences are exactly the same. So, they have the same limit. So, $\det(\lambda I - AB) = \det(\lambda I - BA)$, which is what we wanted.