$y + z+ w = 0$ implies that $w = -y - z$. Therefore, vectors in $Y_1$ are of the form $$(x,y,z,-y-z)$$
for some $x,y,z \in \mathbb{R}$.
We have:
$$Y_1 \ni (x,y,z,-y-z) = x(1,0,0,0) + y(0,1,0,-1) + z(0,0,1,-1)$$
so the set $\{(1,0,0,0), (0,1,0,-1), (0,0,1,-1)\}$ spans $Y_1$. Furthermore, it is linearly independent, so it is a basis for $Y_1$.
Similarly, $x + y = 0$ implies $y = -x$ so vectors in $Y_2$ are of the form
$$(x,-x,2w,w)$$
for some $x,w \in \mathbb{R}$.
We have:
$$Y_2 \ni (x,-x,2w,w) = x(1,-1,0,0) + w(0,0,2,1)$$
so the set $\{(1,-1,0,0), (0,0,2,1)\}$ spans $Y_2$. Furthermore, it is linearly independent so it is a basis for $Y_2$.
So, the general method would be to use the conditions to establish how a vector in your subset look like. It will be of the form
$$(\alpha_1x + \beta_1y + \gamma_1z + \delta_1w, \alpha_2x + \beta_2y + \gamma_2z + \delta_2w, \alpha_3x + \beta_3y + \gamma_3z + \delta_3w, \alpha_4x + \beta_4y + \gamma_4z + \delta_4w)$$
and write it as a linear combination of some constant set of vectors. That set of vectors spans your subspace. Now reduce it to a linearly independent set. It will then be a basis.
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
Here's a basis:$$\left\{\begin{bmatrix}1&0\\0&-1\end{bmatrix},\begin{bmatrix}0&1\\0&-1\end{bmatrix},\begin{bmatrix}0&0\\1&-1\end{bmatrix}\right\}.\tag1$$It is clear thet each of these matrices belong to your space and that they span the whole space: if $a+b+c+d=0$, then $d=-a-b-c$, and therefore\begin{align}\begin{bmatrix}a&b\\c&d\end{bmatrix}&=\begin{bmatrix}a&b\\c&-a-b-c\end{bmatrix}\\&=a\begin{bmatrix}1&0\\0&-1\end{bmatrix}+b\begin{bmatrix}0&1\\0&-1\end{bmatrix}+c\begin{bmatrix}0&0\\1&-1\end{bmatrix}.\end{align}Finally, the set $(1)$ is linearly independent. So, it's a basis. Since it has $3$ elements, your space is $3$-dimensional.