Let
\[D=\begin{bmatrix}
d_1 & 0 & \dots & 0 \\
0 &d_2 & \dots & 0 \\
\vdots & & \ddots & \vdots \\
0 & 0 & \dots & d_n
\end{bmatrix}\]
be a diagonal matrix with distinct diagonal entries: $d_i\neq d_j$ if $i\neq j$.
Let $A=(a_{ij})$ be an $n\times n$ matrix such that $A$ commutes with $D$, that is,
\[AD=DA.\]
Then prove that $A$ is a diagonal matrix.

We prove that the $(i,j)$-entry of $A$ is $a_{ij}=0$ for $i\neq j$.

We compare the $(i,j)$-entries of both sides of $AD=DA$.
Let $D=(d_{ij})$. That is, $d_{ii}=d_i$ and $d_{ij}=0$ if $i\neq j$.
The $(i,j)$-entry of $AD$ is
\begin{align*}
(AD)_{ij}=\sum_{k=1}^n a_{ik}d_{kj}=a_{ij}d_j.
\end{align*}

The $(i,j)$-entry of $DA$ is
\[(DA)_{ij}=\sum_{k=1}^n d_{ik}a_{kj}=d_ia_{ij}.\]

Hence we have
\[a_{ij}d_j=a_{ij}d_i.\]
Or equivalently we have
\[a_{ij}(d_j-d_i)=0.\]

Since $d_i\neq d_j$, we have $d_j-d_i\neq 0$.
Thus, we must have $a_{ij}=0$ for $i\neq j$.

Basis For Subspace Consisting of Matrices Commute With a Given Diagonal Matrix
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$ […]

Symmetric Matrices and the Product of Two Matrices
Let $A$ and $B$ be $n \times n$ real symmetric matrices. Prove the followings.
(a) The product $AB$ is symmetric if and only if $AB=BA$.
(b) If the product $AB$ is a diagonal matrix, then $AB=BA$.
Hint.
A matrix $A$ is called symmetric if $A=A^{\trans}$.
In […]

If matrix product $AB$ is a square, then is $BA$ a square matrix?
Let $A$ and $B$ are matrices such that the matrix product $AB$ is defined and $AB$ is a square matrix.
Is it true that the matrix product $BA$ is also defined and $BA$ is a square matrix? If it is true, then prove it. If not, find a […]

If the Matrix Product $AB=0$, then is $BA=0$ as Well?
Let $A$ and $B$ be $n\times n$ matrices. Suppose that the matrix product $AB=O$, where $O$ is the $n\times n$ zero matrix.
Is it true that the matrix product with opposite order $BA$ is also the zero matrix?
If so, give a proof. If not, give a […]

Linear Properties of Matrix Multiplication and the Null Space of a Matrix
Let $A$ be an $m \times n$ matrix.
Let $\calN(A)$ be the null space of $A$. Suppose that $\mathbf{u} \in \calN(A)$ and $\mathbf{v} \in \calN(A)$.
Let $\mathbf{w}=3\mathbf{u}-5\mathbf{v}$.
Then find $A\mathbf{w}$.
Hint.
Recall that the null space of an […]

Simple Commutative Relation on Matrices
Let $A$ and $B$ are $n \times n$ matrices with real entries.
Assume that $A+B$ is invertible. Then show that
\[A(A+B)^{-1}B=B(A+B)^{-1}A.\]
(University of California, Berkeley qualifying exam)
Proof.
Let $P=A+B$. Then $B=P-A$.
Using these, we express the given […]

Solve a System by the Inverse Matrix and Compute $A^{2017}\mathbf{x}$
Let $A$ be the coefficient matrix of the system of linear equations
\begin{align*}
-x_1-2x_2&=1\\
2x_1+3x_2&=-1.
\end{align*}
(a) Solve the system by finding the inverse matrix $A^{-1}$.
(b) Let $\mathbf{x}=\begin{bmatrix}
x_1 \\
x_2
\end{bmatrix}$ be the solution […]