# If $AB=BA$, show that $B$ is diagonalizable.

We were asked to prove the following:

Let $A$ be an $n \times n$ matrix with $n$ distinct real eigenvalues. If $AB=BA$, show that $B$ is diagonalizable.

It was suggested I show that an eigenvector of $A$ is also an eigenvector of $B$. I am both having trouble doing this and failing to see how I would complete the proof after. Any help would be appreciated.

Thanks

I still don't understand how it is that if $v$ is an eigenvector of $A$ corresponding to some eigenvalue $\lambda$, that $A(Bv)=\lambda Bv$ implies that $v$ is also an eigenvector of $B$.
If we see that this is true, then we will be able to conclude that $B$ is diagonalized by a basis of eigenvectors for $A$.
It is true because the eigenspace of $A$ for the eigenvalue $\lambda$, $\{x:Ax=\lambda x\}$, is one dimensional by the hypothesis that $A$ has $n$ distinct eigenvalues. The equation $A(Bv)=\lambda Bv$ says that $Bv$ is in this space, which is spanned by $v$. Therefore there exists a scalar $c$ such that $Bv=cv$.
So $A$ is diagonalizable with n distinct elements on its main diagonal, $A=diag$ $(a_1,..., a_n)$. Let $B=(b_{ij})$, do the multiplication for both sides of $AB=BA$ and use component-wise correspondence for matrix equality. Now you see the elements off the main diagonal of B must be zero