Given the matrices $$A=\begin{pmatrix} 1 & 0 \\ -1 & -1\end{pmatrix}, \ B=\begin{pmatrix} 1 & 2 \\ 0 & -1\end{pmatrix}$$ and subspaces of $M_2$:
$$K=\{X\in M_2: tr(XA)=0\}, L=\{X\in M_2: tr(XB)=0\}$$
Find bases for $K$ and $L$ and determine one common direct complement for $K$ and $L$ in $M_n$.
My attempt:
$$X\in K\Leftrightarrow tr(XA)=0,\ X=\begin{pmatrix} x_1 & x_2 \\ x_3 & x_4\end{pmatrix}\Leftrightarrow \begin{pmatrix} x_1 & x_2 \\ x_3 & x_4\end{pmatrix}\cdot\begin{pmatrix} 1 & 0 \\ -1 & -1\end{pmatrix}=\begin{pmatrix} x_1-x_2 & -x_2\\ x_3-x_4 & -x_4\end{pmatrix} $$
$$ x_1-x_2-x_4=0\Rightarrow x_1=x_2+x_4\Rightarrow X=\begin{pmatrix} x_2+x_4 & x_2 \\x_3 & x_4\end{pmatrix}\Rightarrow \\ X=\begin{pmatrix}x_2+x_4 & x_2 \\ x_3 & x_4\end{pmatrix}=x_2\begin{pmatrix}1 & 1 \\ 0 & 0\end{pmatrix}+x_3\begin{pmatrix}0 & 0\\ 1 & 0\end{pmatrix}+x_4\begin{pmatrix}1 & 0 \\0 & 1\end{pmatrix}$$
So one basis for $K$ is $\{\begin{pmatrix}1 & 1 \\ 0 & 0\end{pmatrix},\begin{pmatrix}0 & 0\\ 1 & 0\end{pmatrix},\begin{pmatrix}1 & 0 \\0 & 1\end{pmatrix}\}$
Similarly I found one basis for $L: \{\begin{pmatrix}1 & 0\\ 0 & 1\end{pmatrix}, \begin{pmatrix} 0 & 1\\0 & 0\end{pmatrix}, \begin{pmatrix} 0 & 0\\1 & 2\end{pmatrix}\}$
How do I now find a common direct complement? In general, we get a direct complement as a span of those vectors that complement the base to the base of the whole vector space. So, would some direct complement of $K$ be $\{\begin{pmatrix}1 & 0\\ 0 & 0\end{pmatrix},\begin{pmatrix}0 & 1\\ 0 & 0\end{pmatrix},\begin{pmatrix}0 & 0\\0 & 1\end{pmatrix}$? And for $L$ $\{\begin{pmatrix} 1 & 0\\ 0 & 0\end{pmatrix},\begin{pmatrix} 0 & 0\\ 1 & 0\end{pmatrix},\begin{pmatrix} 0 & 0\\ 0 & 1\end{pmatrix}\}$? And then I intersect those two to find a common one?