# If A has complete distinct eigenvalues and A commutes with M and N, do M and N commute?

I've been thinking about the way that eigenvalues appear on the diagonal of a diagonalized matrix, and found a nice question on it in my textbook:

Prove that if a matrix $A \in C_n$ with $n$ distinct eigenvalues commutes with two matrices $M$ and $N$, then $M$ commutes with $N$.

I suspect the proof must be done using the fact that a matrix with $n$ distinct eigenvalues is diagonalizable, but I have always had issues when it comes to those sorts of algebra manipulations. Any ideas? I'm lost one any other approaches.

• because diagonal matrices commute – akech May 8 '16 at 3:16

Hint 1: If $A=PDP^{-1}$ and $A$ commutes with $M,N$ then $D$ commutes with $P^{-1}MP, P^{-1}NP$.
Hint 2: If $D$ is a diagonal matrix with distinct diagonal entries and $D$ commutes with $C$, show that $C$ is diagonal.
Hint: The hypothesis on $A$ implies $V = \mathbb{C}^{n} = \bigoplus_{\lambda \in \text{Spec } (A)}V_{\lambda}$, where each $V_{\lambda} = \{v \in V: Av = \lambda v\}$ is one dimensional by the distinctness of eigenvalues.
Now $V_{\lambda}$ is $M$-invariant and $N$-invariant. So that the restrictions of $M$ and $N$ to $V_{\lambda}$ are linear map. This means that $A, M, N$ have a common basis of eigenvectors with respect to which they are diagonal.
Alternatively, the hypothesis implies that $C_{A}(x) = m_{A}(x)$ so that $V = \mathbb{C}^{n}$ is $A$-cyclic. But then any matrix that commutes with $A$ is a polynomial in $A$. So $M$ and $N$ are polynomials in $A$ and it follows that they commute.