Basis for subspace S I would like some hints on how to do thees types of questions
a) Show that if $A$ is a fixed $n$ x $n$ matrix, then $S = \{B \in M_{n}(\mathbb{C}):AB=BA\}$ is a subspace.
I've done this part, just show that the zero $n$ x $n$ matrix is an element of $S$, by showing $A0 = 0A$ and therefore it is in the set. Then we let $C,D$ be some matrices in $S$ and $\alpha$ in our field and show that ($C+\alpha D) \in S$ by using properties of matrices upon multiplying by $A$
b) Find a basis for $S$ when $n = 3$ and $A = \begin{pmatrix}
1 &0  &0 \\ 
0 &-1 &0\\ 
0 &0  & i
\end{pmatrix}$
I understand the definition of a basis and how to check whether a set is a basis of some subspace, but I'm not sure how to find a basis for $S$, but I think we have to use $AB=BA$ somehow.
c) Find a $3$ x $3$ matrix A such that $S$ has dimension $5$.
No clue how to do this one either, but I'm assuming we use part b...
Any hints would be nice. Thank you.
 A: $(a)$ It seems that you succeed to do it, the basic idea is to use the definition of subspace and apply it directly.
$(b)$ You are looking for matrices which commute with $A$. You should use the fact that $A$ has three distinct eigenvalues, and observe that if $AB=BA$ and $v$ is a eigenvector of $A$ of eigenvalue $\lambda$, then $Bv$ is again an eingenvalue of $A$ with eigenvalue $\lambda$. This should help to describe $B$.
$(c)$ If $A$ is diagonal with three distinct eigenvalues, the dimension obtained for $S$ is three. Try with two distinct eigenvalues.
A: (b)We can write $B$ as $\left( {\begin{array}{*{20}{c}}
{{b_{11}}}&{{b_{12}}}&{{b_{13}}}\\
{{b_{21}}}&{{b_{22}}}&{{b_{23}}}\\
{{b_{31}}}&{{b_{32}}}&{{b_{33}}}
\end{array}} \right)$. By $AB=BA$, we have ${b_{ij}} = 0$ if $i \ne j$ (Check it!).
So $B$ is of the form $\left( {\begin{array}{*{20}{c}}
{{b_1}}&{}&{}\\
{}&{{b_2}}&{}\\
{}&{}&{{b_3}}
\end{array}} \right)$. Now we can easily find a basis of $S$.
(c)Obviously, this matrix A can be $\left( {\begin{array}{*{20}{c}}
1&0&0\\
0&0&0\\
0&0&0
\end{array}} \right)$. (Check it!)
