# 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.

## 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$.

• Prove a Given Subset is a Subspace and Find a Basis and Dimension Let $A=\begin{bmatrix} 4 & 1\\ 3& 2 \end{bmatrix}$ and consider the following subset $V$ of the 2-dimensional vector space $\R^2$. $V=\{\mathbf{x}\in \R^2 \mid A\mathbf{x}=5\mathbf{x}\}.$ (a) Prove that the subset $V$ is a subspace of $\R^2$. (b) Find a basis for […]
• Basis and Dimension of the Subspace of All Polynomials of Degree 4 or Less Satisfying Some Conditions. Let $P_4$ be the vector space consisting of all polynomials of degree $4$ or less with real number coefficients. Let $W$ be the subspace of $P_2$ by $W=\{ p(x)\in P_4 \mid p(1)+p(-1)=0 \text{ and } p(2)+p(-2)=0 \}.$ Find a basis of the subspace $W$ and determine the dimension of […]