Suppose $A,B$ and $C$ are three matrices $n\times n$ matrices such that $A$ has $n$ distinct eigenvalues. Suppose $AB=BA$ and $AC=CA$ then prove that $BC=CB$..
Suppose $A$ has $n$ distinct eigenvalues. So, $A$ is diagonalizable.
Consider the special case when $A$ itself is diagonal.. As $A$ has $n$ distinct eigenvalues we assume no two diagonal elements of $A$ are same.
Suppose $B=(b_{ij})$ and $AB=BA$..
Let $AB=(c_{ij})$ with $c_{ij}=\sum a_{ik}b_{kj}=a_{ii}b_{ij}$
Let $BA=(d_{ij})$ with $d_{ij}=\sum b_{ik}a_{kj}=b_{ij}a_{jj}$
As $AB=BA$ we have $c_{ij}=d_{ij}$ for all $i,j$ i.e., $a_{ii}b_{ij}=b_{ij}a_{jj}$ for all $i,j$..
We then have $(a_{ii}-a_{jj})b_{ij}=0$. As no two diagonal elements in $A$ are equal we have $a_{ii}-a_{jj}\neq 0$ for $i\neq j$ so, $b_{ij}=0$ for $i\neq j$. Thus $B$ is a diagonal matrix.. Similarly, $C$ is also a diagonal matrix.
Clearly, any two diagonal matrices commute.. So, $BC=CB$..
Now, I do not know how to consider general case when $A$ is not a diagonal matrix but have $n$ distinct eigenvalues..
Please give only hints..
Diagonalizing $A$ means that we are choosing some nice basis on $\Bbb{R}^n$ with respect to which the matrix representation of $A$ is diagonal. Then your proof carries out and the conclusion follows.
In other words, choose $P$ such that $A = PDP^{-1}$ for some diagonal matrix $D$. (Of course, no two diagonal elements of $D$ are equal since they are eigenvalues of $A$.) Let $\tilde{B} = P^{-1}BP$ and $\tilde{C} = P^{-1}CP$ so that $\tilde{B}D = D\tilde{B}$ and $\tilde{C}D = D\tilde{C}$. Your computation shows that $\tilde{B}\tilde{C} = \tilde{C}\tilde{B}$. This implies $BC = CB$.