# What can commute with a diagonal matrix?

• weetabixharry
In summary, if B is symmetric then the two matrices commute, and if B is not symmetric then the two matrices only commute if diag\{\underline{\lambda}\}\textbf{B} is symmetric.f

#### weetabixharry

I have two matrices which commute, one of which is definitely diagonal:

$\textbf{B}diag\{\underline{\lambda}\} = diag\{\underline{\lambda}\}\textbf{B}$

and I want to know what I can say about $\textbf{B}$ and/or $\underline{\lambda}$. Specifically, I feel that either one or both of the following must be correct:

(1) $diag\{\underline{\lambda}\}$ is proportional to identity.
(2) $\textbf{B}$ is diagonal.
[ignoring the trivial cases where one or both matrices equal the zero matrix]

But are there other cases when these two matrices can commute? i.e. Is it possible for both $\textbf{B}$ to be non-diagonal and the elements of $\underline{\lambda}$ to not all be identical?

Hi weetabixharry!

What about if B is a symmetric matrix?
Or what if some of the lambda's are identical, forming a submatrix that is proportional to identity?
Or what if a lambda is zero?

Hi weetabixharry!

What about if B is a symmetric matrix?
Or what if some of the lambda's are identical, forming a submatrix that is proportional to identity?
Or what if a lambda is zero?

If $\textbf{B}$ is symmetric, then:

$\textbf{B}diag\{\underline{\lambda}\} = [diag\{\underline{\lambda}\}\textbf{B}]^T$

Therefore the two matrices only commute if $diag\{\underline{\lambda}\}\textbf{B}$ is symmetric. I feel like this can only happen in the 2 cases I stated above, because each element of $\underline{\lambda}$ multiplies across an entire row of $\textbf{B}$.

I'm not sure how to approach the other two cases you mentioned.

If $\textbf{B}$ is symmetric, then:

$\textbf{B}diag\{\underline{\lambda}\} = [diag\{\underline{\lambda}\}\textbf{B}]^T$

Therefore the two matrices only commute if $diag\{\underline{\lambda}\}\textbf{B}$ is symmetric. I feel like this can only happen in the 2 cases I stated above, because each element of $\underline{\lambda}$ multiplies across an entire row of $\textbf{B}$.

I'm not sure how to approach the other two cases you mentioned.

Yes, you are right.
B being symmetric doesn't help.

I just checked a 2x2 matrix with a zero on the diagonal.
Still yields that B must be diagonal, if all lambda's are different.

If we have a set of equal lambda's, we can split B into sub blocks matrices, and multiply the matrices as sub blocks.
A sub block of B on the diagonal that corresponds to a block with equal lambdas always commutes.
A sub block of B that is not on the diagonal has to be zero.

...
If we have a set of equal lambda's, we can split B into sub blocks matrices, and multiply the matrices as sub blocks.
A sub block of B on the diagonal that corresponds to a block with equal lambdas always commutes.
A sub block of B that is not on the diagonal has to be zero.

To prove this it is useful to write the commutator in components:
$\sum_j B_{ij}\lambda_j \delta_{jl}=\sum_j \lambda_i \delta_{ij}B_{jl}$
$B_{il}\lambda_l=\lambda_i B_{il}$
$B_{il}(\lambda_l-\lambda_i)=0$

To prove this it is useful to write the commutator in components:
$\sum_j B_{ij}\lambda_j \delta_{jl}=\sum_j \lambda_i \delta_{ij}B_{jl}$
$B_{il}\lambda_l=\lambda_i B_{il}$
$B_{il}(\lambda_l-\lambda_i)=0$

Ah yes, this is an excellent way of seeing it. Many thanks for that! (Though, I feel the RHS of the first line should have $\lambda_j$ instead of $\lambda_i$... even though the result will be the same).

Quick example of a non-diagonal matrix commuting with a non-proportional-to-identity diagonal matrix:

$\left[\begin{array}{lll} 7&2&0 \\ 0&1&0 \\ 0&0&4 \end{array}\right] \left[\begin{array}{lll} 3&0&0 \\ 0&3&0 \\ 0&0&2 \end{array}\right] = \left[\begin{array}{lll} 3&0&0 \\ 0&3&0 \\ 0&0&2 \end{array}\right] \left[\begin{array}{lll} 7&2&0 \\ 0&1&0 \\ 0&0&4 \end{array}\right] = \left[\begin{array}{lll} 21&6&0 \\ 0&3&0 \\ 0&0&8 \end{array}\right]$

Unfortunately, this ruins the proof I was writing... back to the drawing board I guess...