# $A \in M(n,\mathbb R)$ diagonal matrix with charac. polynomial $(x-a)^p(x-b)^q$ , what is the dimension of the space of matrices commuting with $A$? [closed]

Let $A$ be a $n \times n$ diagonal matrix with real entries with characteristic polynomial $(x-a)^p(x-b)^q$ , where $a,b$ are distinct real numbers ; let $V:=\{B \in M(n,\mathbb R):AB=BA\}$ then $V$ is a subspace of $M(n,\mathbb R)$ , what is the dimension of $V$ ?

## closed as off-topic by user26857, heropup, Shailesh, JonMark Perry, Parcly TaxelSep 3 '16 at 3:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – user26857, heropup, Shailesh, JonMark Perry, Parcly Taxel
If this question can be reworded to fit the rules in the help center, please edit the question.

• Perhaps include your work on the problem so far? – Travis Jan 22 '16 at 11:19
• Otherwise you might explain where the problem was found or what makes it interesting to you? – hardmath Jan 22 '16 at 12:24

The subspace you seek is the Lie algebra of the centralizer of your diagonal matrix in $GL(n)$, and has dimension $p^2 + q^2$.
Proof: Consider a matrix $B$ which commutes with diagonal matrix under consideration. Write $\mathbb R^n = V_a \oplus V_b$, where $V_a$ is the eigenspace for $a$ and $V_b$ likewise for $b$. Then for $v \in V_a$, we have $A(Bv) = B(Av) = a(Bv)$. Thus $B$ preserves the subspace $V_a$. The same argument shows it presrves $V_b$, too. Thus $B$ itself can be put in block form which consists of $p^2 + q^2$ entries.