# Let $D$ be an $n \times n$ diagonal matrix whose distinct diagonal entries are $d_1,\ldots, d_k$, and where $d_i$ occurs exactly $n_i$ times.

Let $$D$$ be an $$n \times n$$ diagonal matrix whose distinct diagonal entries are $$d_1,\ldots, d_k$$, and where $$d_i$$ occurs exactly $$n_i$$ times. For the subspace $$W$$ of $$M_{n \times n}(F)$$ defined by $$W=\{A : AD = DA\}$$ prove that $$\text{dim}(W) = n_1^2 + n_2^2 +\ldots+ n_k^2$$

I know that $$A \in W$$ must be symmetric, and I can see that if each $$d_k$$ is distinct and only occurs once, that $$W$$ has dimension $$n$$. I also realize that if $$D_{ii} = D_{jj}$$ then $$A_{ji}$$ can be anything and $$A_{ij}$$ can be anything. (that's terrible wording but this question has me so lost), and if $$D_{ii} \neq D_{jj}$$ then $$A_{ij} = 0$$ and $$A_{ji} = 0$$.

I'm not sure how to formalize any of my thoughts on this question at all. It is a homework question that I'd like to understand fully.

• some of your claims are wrong. Just do the quick exercise in my "answer." Write out both matrix products and compare. The cure for confusion is doing sample problems that have been set up for you to be both easy and illustrative. – Will Jagy Oct 26 '18 at 0:08
• I've been writing down cases, I'm just not sure how to pull it all together into a rigorous proof – Trigginometric Oct 26 '18 at 0:15

let $$D = \left( \begin{array}{cccc} 5&0&0&0 \\ 0&5&0&0 \\ 0&0&7&0 \\ 0&0&0&7 \end{array} \right)$$ and $$A = \left( \begin{array}{cccc} a&b&c&d \\ e&f&g&h \\ i&j&k&l \\ m&n&o&p \end{array} \right)$$ Write out $$AD$$ and $$DA$$ and say EXACTLY what matrices $$A$$ commute with $$D$$
• @Trigginometric what are the conditions on the entries of $A$ (the 16 letters) that make $AD=DA?$ What letters need to be zero, and what are the remaining letters that are allowed to be anything? What pattern do those make, the nonzero ones? – Will Jagy Oct 26 '18 at 0:33
• @Trigginometric good. Now draw a copy of $A$ with all those set to zero that need to be zero. There are block shapes – Will Jagy Oct 26 '18 at 0:36