# Basis For Subspace Consisting of Matrices Commute With a Given Diagonal Matrix

## Problem 287

Let $V$ be the vector space of all $3\times 3$ real matrices.

Let $A$ be the matrix given below and we define

\[W=\{M\in V \mid AM=MA\}.\]
That is, $W$ consists of matrices that commute with $A$.

Then $W$ is a subspace of $V$.

Determine which matrices are in the subspace $W$ and find the dimension of $W$.

**(a)** \[A=\begin{bmatrix}

a & 0 & 0 \\

0 &b &0 \\

0 & 0 & c

\end{bmatrix},\]
where $a, b, c$ are distinct real numbers.

**(b)** \[A=\begin{bmatrix}

a & 0 & 0 \\

0 &a &0 \\

0 & 0 & b

\end{bmatrix},\]
where $a, b$ are distinct real numbers.

Contents

## Solution.

### (a) Diagonal matrix with distinct diagonal entries

Let us first determine when a matrix $M$ commutes with $A$.

Let

\[M=\begin{bmatrix}

a_{1 1} & a_{1 2} & a_{1 3} \\

a_{2 1} & a_{2 2} & a_{2 3} \\

a_{3 1} & a_{3 2} & a_{3 3}

\end{bmatrix}\]
and suppose that $AM=MA$:

\[\begin{bmatrix}

a & 0 & 0 \\

0 & b &0 \\

0 & 0 & c

\end{bmatrix}

\begin{bmatrix}

a_{1 1} & a_{1 2} & a_{1 3} \\

a_{2 1} & a_{2 2} & a_{2 3} \\

a_{3 1} & a_{3 2} & a_{3 3}

\end{bmatrix}

=

\begin{bmatrix}

a_{1 1} & a_{1 2} & a_{1 3} \\

a_{2 1} & a_{2 2} & a_{2 3} \\

a_{3 1} & a_{3 2} & a_{3 3}

\end{bmatrix}

\begin{bmatrix}

a & 0 & 0 \\

0 &b &0 \\

0 & 0 & c

\end{bmatrix}.\]
Computing matrix products, we obtain

\[\begin{bmatrix}

aa_{1 1} & aa_{1 2} & aa_{1 3} \\

ba_{2 1} & ba_{2 2} & ba_{2 3} \\

ca_{3 1} & ca_{3 2} &c a_{3 3}

\end{bmatrix}

=

\begin{bmatrix}

a_{1 1}a & a_{1 2}b & a_{1 3}c \\

a_{2 1}a & a_{2 2}b & a_{2 3}c\\

a_{3 1}a & a_{3 2}b & a_{3 3}c

\end{bmatrix}. \tag{*}\]
Compare the $(1,2)$ entries and we have $aa_{1 2}=ba_{1 2}$.

Since $a\neq b$, we must have $a_{1 2}=0$.

Similarly, comparing the off-diagonal entries and noting $a, b, c$ are distinct, we find that off diagonal entries $a_{i j} , i\neq j$ must be $0$.

Thus, $M$ commutes with $A$ if and only if

\[M=\begin{bmatrix}

a_{1 1} & 0 & 0 \\

0 & a_{2 2} & 0 \\

0 & 0 & a_{3 3}

\end{bmatrix}.\]

Therefore, the subspace $W$ consists of all $3\times 3$ diagonal matrices:

\[W=\{W\in V\mid W \text{ is diagonal}\}.\]
Then it is easy to see that the set $\{E_{1 1}, E_{2 2}, E_{3 3}\}$ is a basis for $W$, where $E_{i j}$ is the $3\times 3$ matrix whose $(i,j)$-entry is $1$ and the other entries are zero. Thus the dimension of $W$ is $3$.

### (b) Diagonal matrix two diagonal entries are the same

Now consider the case

\[A=\begin{bmatrix}

a & 0 & 0 \\

0 &a &0 \\

0 & 0 & b

\end{bmatrix}.\]
Let

\[M=\begin{bmatrix}

a_{1 1} & a_{1 2} & a_{1 3} \\

a_{2 1} & a_{2 2} & a_{2 3} \\

a_{3 1} & a_{3 2} & a_{3 3}

\end{bmatrix}\]
and compute $AM=MA$ as in part (a) (or you just need to replace $b, c$ in (*) by $a, b$, respectively) and obtain

\[\begin{bmatrix}

aa_{1 1} & aa_{1 2} & aa_{1 3} \\

aa_{2 1} & aa_{2 2} & aa_{2 3} \\

ba_{3 1} & ba_{3 2} & ba_{3 3}

\end{bmatrix}

=

\begin{bmatrix}

a_{1 1}a & a_{1 2}a & a_{1 3}b \\

a_{2 1}a & a_{2 2}a & a_{2 3}b\\

a_{3 1}a & a_{3 2}a & a_{3 3}b

\end{bmatrix}. \]
Comparing entries and noting $a\neq b$, we have

\[a_{1 3}=0, a_{2 3}=0, a_{3 1}=0, a_{3 2}=0.\]

Thus, $M$ commutes with $A$ is and only if

\[M=\begin{bmatrix}

a_{1 1} & a_{1 2} & 0 \\

a_{2 1} & a_{2 2} & 0 \\

0 & 0 & a_{3 3}

\end{bmatrix},\]
and hence the subspace $W$ consists of such matrices.

From this, we see that the set

\[\{E_{1 1}, E_{1 2}, E_{2 1}, E_{2 2}, E_{3 3}\}\]
is a basis for $W$, and we conclude that the dimension of $W$ is $5$.

Add to solve later