# Diagonalizable Operators and characteristic polynomials

Let $A$ be an $n\times n$ diagonal matrix with characteristic polynomial $(x-c_1)^{d_1}\cdots(x-c_k)^{d_k}$, where $c_1,\ldots,c_k$ are distinct. Let $V$ be the space of $n\times n$ matrices $B$ such that $AB=BA$. Prove that the dimension of $V$ is $d_1^2+\cdots+d_k^2$.

-
Hint: start writing down an example of $A$, and then equations for $B$; once you've determined the dimension of the solution set, prove that it does not depend on the choice of $A$. – Marc van Leeuwen Apr 16 '12 at 7:48
we already know the matrix $A$; it is diagonal matrix in which $c_1$ appears $d_1$ times and so on.If $B$ is any diagonal matrix then it commutes with $A$ but what are other matrices which commute with $A$? – Wesley Stanley Apr 16 '12 at 11:43

Consider each $d_i\times d_i$ block separately. Clearly every $d_i\times d_i$ block commutes with the corresponding diagonal block of A, which is a multiple of the identity block, so that the dimension of V is at least $d_1^2+...+d_k^2$.
Since the action of any such B leaves the eigenspaces of A invariant, B is a block diagonal matrix of the same type as A (of course the blocks of B are not necessarily diagonal themselves), consequently the dimension of V is at most $d_1^2+...+d_k^2$.