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.

Let
\[A=\begin{bmatrix}
1 & 1 & 1 \\
0 &0 &1 \\
0 & 0 & 1
\end{bmatrix}\]
be a $3\times 3$ matrix. Then find the formula for $A^n$ for any positive integer $n$.

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.

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

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