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.
 A: Suppose $\lambda$ is an eigenvalue for $A$, and $v$ an associated eigenvector. Then
$$A(Bv) = (AB)v = (BA)v = B(Av) = \lambda (Bv)$$
Since the eigenspace of $A$ associated with $v$ is one-dimensional, $Bv$ must be a scalar multiple of $v$, and so $Bv=\mu v$ for some $\mu\in\mathbb R$. In particular, $v$ is an eigenvector for $B$. 
Thus, since $A$ has $n$ linearly independent eigenvectors, so does $B$. Hence, $B$ is diagonalizable. 
A: Hint. If A is $n\times n$ and has $n$ different eigenvalues then $A$ is diagonalizable: $D=M^{-1}AM$ where the $i$-th columnn of $M$ is an eigenvector $v_i$ of $A$ with respect to eigenvalue $\lambda_i$. 
Now note that if $AB=BA$,   then 
$$A (B v_i) = (AB)v_i = (BA)v_i = B(Av_i) = B(\lambda_i v_i) = \lambda_i Bv_i.$$
Can you take it from here?
A: 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.
