Ok... I can prove that if A has not defective then A and B commute iff they are simultaneously diagonalizable. Anyone know how to do it when both are defective?
Here's a sketch of what I have so far:
Assume A is not defective and finite dimensional. Then choose a basis that diagonalizes A.
The i,k-th entry in AB is A
iiB
ik
The i,k-th entry in BA is B
ikA
kk
So AB = BA iff, for all (i, k), B
ik = 0 or A
ii=A
kk.
If A
ii = A
jj, then A is the identity over the subspace spanned by the i-th and j-th basis vectors, so we can replace these two vectors with basis vectors that diagonalize B over that subspace.
By repeating this process, we can produce a basis that simultaneously diagonalizes both A and B.
I don't know what to do if A is defective or infinite dimensional. (though I admit not having taken a crack at modifying the above proof to use transfinite induction to tackle the infinite dimensional case)
