If $A$ has $n$ distinct eigenvalues, then every matrix that commutes with $A$ commutes with each other. $A$ is a $n\times n$ matrix with entries from $\mathbb{R}$. If the characteristic polynomial for $A$ has $n$ distinct roots, then every $n\times n$ matrix (with real entries) that commutes with $A$ commutes with each other.
I know that $n$ distinct roots implies diagonalizable. But I am not sure where to go from there. I have played around with the identities $AB=BA, AC=CA, A=P^{-1}DP$ to try and get to $BC=CB$ but I am not seeing it. I would love any help. This is self study and not assigned.   
 A: Hint. Let $B=P^{-1}B_1P$. Then $AB=BA$ if and only if $DB_1=B_1D$. Using the fact that $D$ is a diagonal matrix with distinct diagonal entries, you may try to prove that $B_1$ is a diagonal matrix.
A: If $AB=BA$, then the eigenspaces of $A$ are stable under $B$. Indeed, if $x$ is such that $Ax=\lambda x$, then $A(Bx)=(AB)x=(BA)x=B(Ax)=\lambda(Bx)$.
$A$ is diagonalizable with $n$ distinct eigenvalues, hence each eigenspace has dimension $1$. Consider $\lambda$ an eigenvalue and $\mathbb Rv$ the associated eigenspace. $B$ stabilizes $\mathbb Rv$, hence $Bv=\alpha v$. Consider $(v_1,\ldots, v_n)$ a basis of eigenvectors of $A$. By the previous computation, $B$ is diagonal with respect to this basis: there is some $Q$ and diagonal matrix $D_B$ such that $B= Q^{-1}D_BQ$.
Consider another $C$ that commutes with $A$. By a similar argument, $C$ is diagonal with respect to the same basis $(v_1,\ldots, v_n)$. Therefore, there exists a diagonal $D_C$ such that $C= Q^{-1}D_CQ$.
Note that $BC=Q^{-1}D_BQQ^{-1}D_CQ=Q^{-1}D_BD_CQ=Q^{-1}D_CD_BQ=CB$.
A: I want to convert my comment into a detailed answer clarifying a few things.  Gabriel Romon has showed that $A(Bx)=\lambda(Bx)$.  This shows that $Bx$ is an eigenvector for $A$, if $Bx\neq 0$. Since the roots of the characteristic polynomial are distinct, the eigenspaces are one dimensional. So, $Bx=\alpha x$ for some $\alpha\in\mathbb{R}$. If $Bx=0$, $x$ is still an eigenvector for $B$ corresponding to the eigenvalue $0$. If $\mathcal{B}=\left\{v_1,v_2,\ldots,v_n\right\}$ is a basis of eigenvectors for $A$, it is also a basis of eigenvectors  of $B$. 
Suppose $B$ and $C$ commute with $A$.  Let $\alpha_1$, $\alpha_2$, $\ldots$, $\alpha_n$ be the (not necessarilty distinct) eigenvalues of $B$ with respect to $\mathcal{B}$ and $\beta_1$, $\beta_2$, $\ldots$, $\beta_n$ be the eigenvalues of $C$ with respect to $\mathcal{B}$. Then, $BCv_i=CBv_i=\alpha_i\beta_iv_i$, so $B$ and $C$ commute on the basis $\mathcal{B}$. Therefore $BC=CB$.
