# If matrices $A$ and $B$ commute, $A$ with distinct eigenvalues, then $B$ is a polynomial in $A$

If $A\in M_{n}$ has $n$ distinct eigenvalues and if $A$ commutes with a given matrix $B\in M_{n}$, how can I show that $B$ is a polynomial in $A$ of degree at most $n-1$? I think first I need to show that $A$ and $B$ are simultaneously diagonalizable, but I don't know how to begin. Any advice is much appreciated.

-
There have been several previous questions on showing that $A$ and $B$ commute if and only if they are simultaneously diagonalizable. See for example this and this. – Arturo Magidin Sep 16 '11 at 5:25
By the way: to prove that $A$ and $B$ are simultaneously diagonalizable, you will also need to prove that $B$ is diagonalizable; without the assumption that $A$ has $n$ distinct eigenvalues (I'm guessing you dropped the "$n$"), that would not necessarily be the case; e.g., take $A$ to be the identity.... – Arturo Magidin Sep 16 '11 at 5:44
@Arturo: In your first comment, you should say "diagonalizable A and B commute if and only if..." since commuting matrices in general need not be simultaneously diagaonalizable (try A and A^2 when A is not diagonalizable). – KCd Sep 17 '11 at 15:00
Arturo should have said (actually meant?) simultaneously triangular -izable - see this for a proof of that - i recommend the book "Linear Algebra" by Hoffman and Kunze but i think 'A,B commute B polynomial in A?' only appears as an example question – Peter Sheldrick Sep 17 '11 at 16:27
@KCd: Indeed; hence the addendum some half an hour later of the second comment; but thank you for making it explicit. – Arturo Magidin Sep 17 '11 at 19:23

At the question Why does a diagonalization of a matrix B with the basis of a commuting matrix A give a block diagonal matrix? you can see why a basis consisting of eigenvectors for $A$ will also diagonalize $B$.

Since all matrices that commute with $A$ are diagonalized by a basis of eigenvectors for $A$, and conversely, any matrix diagonalized by a basis of eigenvectors for $A$ commutes with $A$, the set of matrices commuting with $A$ forms a vector subspace of $M_n$ of dimension $n$. The matrices $I,A,A^2,\ldots,A^{n-1}$ lie in this subspace. You can show that these matrices are linearly independent using the facts that $A$ has $n$ distinct eigenvalues, and that a nonzero polynomial of degree at most $n-1$ over a field can have at most $n-1$ zeros. I hope that helps.

-
excellent argument – Manos Jun 20 '12 at 15:54

In the setting of the question, the polynomial $g\in K[X]$ of degree $< n$ such that $B=g(A)$ is given by Lagrange's Interpolation Formula. [Here $K$ is the ground field.] Indeed, letting $a_i$ and $b_i$ be the eigenvalues of $A$ and $B$ (numbered in a coherent way), we have $$g(X)=\sum_{i=1}^n\ b_i\ \prod_{j\not=i}\ \frac{X-a_j}{a_i-a_j}\quad.$$

More generally, let $A,B\in M_n(K)$ be two $n$ by $n$ matrices with coefficients in a field $K$, let $f\in K[X]$ be the minimal polynomial of $A$, and let $d$ be its degree. Clearly:

(1) If $B$ is a polynomial in $A$, then there is a unique polynomial $g\in K[X]$ of degree less that $d$ such that $B=g(A)$.

Let $e_1,\dots,e_r$ be the minimal idempotents of $K[A]\simeq K[X]/(f)$ [canonical isomorphism], and put $V_i:=e_iK^n$. Then $K^n$ is the direct sum of the $V_i$. Let $A_i$ be the restriction of $A$ to $V_i$. Then there are distinct monic irreducible polynomials $f_i$, and there are positive integers $m_i$, such that $K[A_i]\simeq K[X]/(f_i^{m_i})$ [canonical isomorphism], and $f$ is the product of the $f_i^{m_i}$.

Assume that $A$ and $B$ commute. Then $BV_i\subset V_i$ for all $i$. Let $B_i$ be the restriction of $B$ to $V_i$.

Then $B$ is a polynomial in $A$ if and only if each $B_i$ is a polynomial in $A_i$.

More precisely, if $B_i=g_i(A_i)$, the polynomial $g$ of (1) is the unique degree less than $d$ solution to the congruences $$g\equiv g_i\ \bmod\ f_i^{m_i}$$ (see the Chinese Remainder Theorem).

If the eigenvalues of $A$ are in $K$ (as can always be assumed), the $f_i$ have degree $1$, and the congruences can be solved by Taylor's Formula. More precisely, if $f_i=X-a_i$, then $$g(X)=\sum_{i=1}^r\ T_i\left(g(X)\frac{(X-a_i)^{m_i}}{f(X)}\right)\frac{f(X)}{(X-a_i)^{m_i}}\quad,$$ where $T_i(h(X))$ means "degree less than $m_i$ Taylor approximation of $h(X)$ at $X=a_i$". [Note that $V_i$ is the $a_i$-generalized eigenspace.]

-

First, if $B$ commutes with $A$, then every eigenspace for $A$ is $B$-stable (see here for a very simple proof), and since these eigenspaces are by assumption $1$-dimensional, they therefore are also eigenspaces for $B$. And since they span the whole space, $A$ and $B$ are simultaneously diagonalised on any basis of eigenvectors for$~A$.

Now on such a diagonalisation basis, a polynomial $P[A]$ is a diagonal matrix with each eigenvalue $\lambda$ of $A$ replaced by $P[\lambda]$; we must show to be able to simultaneously match in this way all diagonal entries of $B$ using a single polynomial$~P$ of degree less than $n$. You can do this explicitly by Lagrange interpolation as in the answer by Pierre-Yves Gaillard, but just showing it is possible is easy by linear algebra. The map from the $n$-dimensional vector space of such polynomials$~P$ to the $n$-tuple $(P[\lambda_1],\ldots,P[\lambda_n])$ of diagonal entries they produce is linear, and injective: any nonzero polynomial in the kernel would by construction have $n$ distinct roots, which is not possible given its degree. But then it is also surjective (by rank-nullity), so the diagonal entries of$~B$ are in the image.

-