<s>[INST] How to prove that $B$ is diagonalizable We know that $A$ is $n\times n$ and has $n$ different eigenvalues. Also it is known that $AB = BA$. Prove that $B$ is diagonalizable.
 [/INST] A little different approach than the answers above - without explicit use of eigenvectors idea.
$A$ is diagonalizable what means $A$ can be written as $A=VDV^{-1}$ where $V$ is some invertible matrix.
We have
$AB=BA$    
$VDV^{-1}B=BVDV^{-1}$   
$V^{-1}(VDV^{-1}B)V=V^{-1}(BVDV^{-1})V$   
$ D(V^{-1}BV)=(V^{-1} BV)D $   
$ DC=CD $   where $C=V^{-1}BV$
If we denote $D=\begin{bmatrix} d_1 & 0 & \dots & 0 \\ 0 & d_2 &  \dots & 0 \\\dots  & \dots  &  \dots & \dots  \\ \\0 & 0 &  \dots &  d_n \end{bmatrix}$,  and  $C=\begin{bmatrix} 
c_{11}  & c_{12}  & \dots & c_{1n}  \\ c_{21}  & c_{22}  & \dots & c_{2n}   \\\dots  & \dots  &  \dots & \dots  \\  c_{n1}  & c_{n2}  & \dots & c_{nn}  \end{bmatrix}  $
on the level on entries equality $ DC=CD $ presents itself as
$ \begin{bmatrix} d_1 & 0 & \dots & 0 \\ 0 & d_2 &  \dots & 0 \\\dots  & \dots  &  \dots & \dots  \\ \\0 & 0 &  \dots &  d_n \end{bmatrix}\begin{bmatrix} c_{11}  & c_{12}  & \dots & c_{1n}  \\ c_{21}  & c_{22}  & \dots & c_{2n}   \\\dots  & \dots  &  \dots & \dots  \\  c_{n1}  & c_{n2}  & \dots & c_{nn}  \end{bmatrix} = \begin{bmatrix} c_{11}  & c_{12}  & \dots & c_{1n}  \\ c_{21}  & c_{22}  & \dots & c_{2n}   \\\dots  & \dots  &  \dots & \dots  \\  c_{n1}  & c_{n2}  & \dots & c_{nn}  \end{bmatrix}    \begin{bmatrix} d_1 & 0 & \dots & 0 \\ 0 & d_2 &  \dots & 0 \\\dots  & \dots  &  \dots & \dots  \\ \\0 & 0 &  \dots &  d_n \end{bmatrix}$ 
what gives
$\begin{bmatrix} d_1c_{11}  & d_1c_{12}  & \dots & d_1c_{1n}  \\ d_2c_{21}  & d_2c_{22}  & \dots & d_2c_{2n}   \\\dots  & \dots  &  \dots & \dots  \\  d_nc_{n1}  & d_nc_{n2}  & \dots & d_nc_{nn}  \end{bmatrix}  = \begin{bmatrix} d_1c_{11}  & d_2c_{12}  & \dots & d_nc_{1n}  \\ d_1c_{21}  & d_2c_{22}  & \dots & d_nc_{2n}   \\\dots  & \dots  &  \dots & \dots  \\  d_1c_{n1}  & d_2c_{n2}  & \dots & d_nc_{nn}  \end{bmatrix}$ 
Because all $d_i$ are distinct from the comparison of entries it is visible that the only non-zero values of $c_{ij} $ can be on the diagonal.  
Hence the $C=V^{-1}BV$ is diagonal and consequently $B$ is diagonalizable.
</s>