Do Diagonal Matrices Always Commute?

Let $A$ be an $n \times n$ matrix and let $\Lambda$ be an $n \times n$ diagonal matrix. Is it always the case that $A\Lambda = \Lambda A$? If not, when is it the case that $A \Lambda = \Lambda A$?

If we restrict the diagonal entries of $\Lambda$ to being the equal (i.e. $\Lambda = \text{drag}(a, a, \dots, a)$), then it is clear that $A\Lambda = AaI = aIA = \Lambda A$. However, I can't seem to come up with an argument for the general case.


It is possible that a diagonal matrix $\Lambda$ commutes with a matrix $A$ when $A$ is symmetric and $A \Lambda$ is also symmetric. We have

$$ \Lambda A = (A^{\top}\Lambda^\top)^{\top} = (A\Lambda)^\top = A\Lambda $$

The above trivially holds when $A$ and $\Lambda$ are both diagonal.


A diagonal matrix will not commute with every matrix.

$$ \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix}*\begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}=\begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}$$

But:

$$\begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} * \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix} = \begin{pmatrix} 0 & 2 \\ 0 & 0 \end{pmatrix}.$$


If all the diagonal entries of$\Lambda$ are distinct, it commutes only with diagonal matrices.

In contrast, for each $k$ consecutive equal diagonal entries in $\Lambda,$ we may allow $A$ to have anything at all in the corresponding $k$ by $k$ square block with both corners on the main diagonal.

This means that the set of matrices that commute with $\Lambda$ has a minimum dimension $n$ and a maximum dimension $n^2.$ Suppose we have $r$ different diagonal entries, and there are $k_i$ copies of diagonal entry $\lambda_i.$ Each $k_i \geq 1,$ and we have $$ k_1 + k_2 + \cdots + k_r = n. $$ Then by the block construction I mentioned above, the dimension of the space of matrices that commute with $\Lambda$ is $$ k_1^2 + k_2^2 + \cdots + k_r^2. $$ The minimum is when $r=n,$ so all $k_i = 1,$ and the dimension is $n$

The maximum is when $r=1,$ and $k_1=n,$ the matrix is a scalar multiple of the identity matrix, and the dimension is $n^2.$