# Showing that if $AB=BA$ then $A$ and $B$ are simultaneously diagonalizable [duplicate]

Suppose $$A \in M_n$$ has distinct eigenvalues $$a_1,\dots,a_n$$ and that $$A$$ commutes with a given matrix $$B \in M_n$$ so that $$AB=BA$$.

a. Prove A and B are simultaneously diagonalizable

I was able to show that $$B$$ is diagonalizable but I cannot figure out how to show that $$A$$ and $$B$$ are simultaneously diagonalizable.

• Hint: $\;D=P^{-1}ABP=P^{-1}APP^{-1}BP\;$ ...and now use $\;AB=BA\;$ Commented Sep 17, 2016 at 21:42
• I am not sure I get the hint I think I have to find non singular matrix that diagonalizes A and B but how how............... how Commented Sep 17, 2016 at 21:51
• But how do you know $D=P^-1 AB P$ Commented Sep 17, 2016 at 22:15

Having distinct eigenvalues means that for each eigenvalue $\lambda$, there is a one dimensional subspace $S(\lambda)$ spanned by the respective eigenvector $x$. In this case $Ax=\lambda x$, ans $A(Bx)=B(Ax)=\lambda (Bx)$ so $Bx\in S(\lambda)$ and hence $Bx=\beta x$ for some $\beta$. Therefore $x$ is also an eigenvector of $B$. So $A$ and $B$ have same eigenvectors and therefore can be simultaneously diagonalized.
• Yes in this case, try to change the basis of your space to $(x_1,\dots, x_n)$, eigenvectors of $A$ and $B$. $A$ and $B$ in the new basis become diagonal. Writing down the change-of-basis transformation give you the diagonalization. Commented Sep 17, 2016 at 22:27
Under these conditions, each eigenspace of $A$ is one-dimensional. Further, $B$ fixes each of these eigenspaces: namely, if $Ax=\lambda x$, then $$A(Bx)=BAx=B\lambda x=\lambda (Bx).$$ It follows that $B$ maps each eigenvector of $A$ to its multiple and hence $B$ is diagonal in a basis consisting of $A$-eigenvectors.