To show that $C(A)$ is a subspace, we need to show it closed under both addition and scalar multiplication; so let
$B_1, B_2 \in C(A); \tag 1$
then
$B_1A = AB_1, \; B_2A = AB_2; \tag 2$
thus,
$(B_1 + B_2)A = B_1A + B_2A = AB_1 + AB_2 = A(B_1 + B_2), \tag 3$
which of course implies
$B_1 + B_2 \in C(A); \tag 4$
likewise if $\alpha$ is any scalar, we have
$(\alpha B)A = \alpha (BA) = \alpha (AB) = A(\alpha B); \tag 5$
thus
$\alpha B \in C(A) \tag 6$
as well. Also, it is pretty easy to see that (6) implies
$0 \in C(A), \tag 7$
and
$B \in C(A) \Longleftrightarrow -B \in C(A); \tag 8$
since the rest of the vector space axioms are inherited by $C(A)$ from $M_{2 \times 2}(\Bbb R)$, it follows that $C(A)$ is indeed a subspace.
So, what do the elements of $C(A)$ look like? If
$B = \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix}, \tag 9$
then the condition
$AB = BA \tag{10}$
reads, with
$A = \begin{bmatrix}1&0\\1&2\end{bmatrix}, \tag{10}$
$\begin{bmatrix}1&0\\1&2\end{bmatrix}\begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} = \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix}\begin{bmatrix}1&0\\1&2\end{bmatrix}; \tag{11}$
at this point, before proceeding further, we observe that the computations specified in (11) may be considerably simplified if we a priori write $A$ in the form
$A = \begin{bmatrix}1&0\\1&2\end{bmatrix} = I + \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix}, \tag{12}$
since
$IB = BI; \tag{13}$
we are left with finding those $B$ such that
$ \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} = \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix}\begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix}; \tag{14}$
that is,
$\begin{bmatrix} 0 & 0 \\ b_{11} + b_{21} & b_{12} + b_{22} \end{bmatrix} = \begin{bmatrix} b_{12} & b_{12} \\ b_{22} & b_{22} \end{bmatrix}, \tag{15}$
we thus find that
$b_{12} = 0, \; b_{11} + b_{21} = b_{22} = b_{12} + b_{22}; \tag{16}$
by virtue of these equations, we see we may write $B$ in the form
$B = \begin{bmatrix} b_{11} & 0 \\ b_{22} - b_{11} & b_{22} \end{bmatrix} = b_{11} \begin{bmatrix} 1 & 0 \\ -1 & 0 \end{bmatrix} + b_{22} \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix}; \tag{17}$
it is now clear that we may take $b_{11}$ and $b_{22}$ as free parameters, and that $C(A)$ is two dimensional, being spanned by matrices
$\begin{bmatrix} 1 & 0 \\ -1 & 0 \end{bmatrix}, \; \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix}, \tag{18}$
which form a basis for $C(A)$.
Best Answer
The first one is not a vector space as sum of two singular matrix may be nonsingular. For example $$\begin{pmatrix} 1 & 0 \\\ 0 & 0 \end{pmatrix} + \begin{pmatrix} 0 & 0 \\\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\\ 0 & 1 \end{pmatrix}$$ The second one is a vector space of dimension 2 as $xe^{-x}$ and $e^{-x}$ are linearly independent continuas functions. If $axe^{-x} + be^{-x} = 0$ for $a,b \in \mathbb{R}$, Then $ax +b = 0$ as a continuas function on $\mathbb{R}$. Putting $x = 0,1$ we have $b = 0$ and $a +b = 0$. Hence $a = b = 0$.