Two matrices \(A, B\) can be simultaneously diagonalized if there is an invertible matrix that diagonalizes both of them. In other words, if there is a (possibly complex) basis in which both matrices are diagonalized.
a) If \(A\) and \(B\) can be simultaneously diagonalized, show that \(A B=B A\).
b) Conversely, if \(A B=B A\), and if one of these matrices, say \(A\), has distinct eigenvalues (so the eigenspaces all have dimension one), show they can be simultaneously diagonalized.
SUGGESTION: Say \(\lambda\) is an eigenvalue of \(A\) and \(\vec{v}\) a corresponding eigenvector: \(A \vec{v}=\lambda \vec{v}\). Show that \(B \vec{v}\) satisfies \(A(B \vec{v})=\lambda B \vec{v}\) and deduce that \(B \vec{v}=c \vec{v}\) for some constant \(c\) (possibly zero). Thus, the eigenvectors of \(A\) are also eigenvectors of \(B\). Why does this imply that (in this case where \(A\) has distinct eigenvalues) in a basis where \(A\) is diagonal, so is \(B\) ?
REMARK: This result extends to any two commuting \(n \times n\) matrices \(A\) and \(B\), assuming that \(A\) and \(B\) can each be diagonalized.