Find a common direct complement for $K$ and $L$ in $M_n$ 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?
 A: First, a general observation. Let $V$ be an $n$-dimensional vector space and let $\varphi \colon V \rightarrow \mathbb{F}$ be a non-zero linear functional. By the rank-nullity theorem, we know that $\dim \ker(\varphi) = n - 1$. Let us choose any vector $w \in V$ such that $\varphi(w) \neq 0$. Then
$$ V = \ker(\varphi) \oplus \operatorname{span} \{ w \}. $$
To see this is true, not that if $v \in \ker(\varphi) \cap  \operatorname{span} \{ w \}$ then $\varphi(v) = 0$ and $v = aw$ for some $a \in \mathbb{F}$. This implies that $\varphi(aw) = a\varphi(w) = 0$ but then $a = 0$ and $v = 0$. Since the dimensions add up, we have a direct sum decomposition.
Now if $\varphi_1, \varphi_2$ are two non-zero functionals and we want to find a direct sum complement for both $\ker(\varphi_1),\ker(\varphi_2)$, by the observation above we only need to choose $w \in V$ such that $\varphi_1(w) \neq 0$ and $\varphi_2(w) \neq 0$.

In your case, $V = M_2(\mathbb{F})$, $\varphi_1(X) = \operatorname{tr}(XA)$ and $\varphi_2(X) = \operatorname{tr}(XB)$. Hence, to find a direct sum complement for both $K = \ker(\varphi_1)$ and $L = \ker(\varphi_2)$, we need to find $X \in M_2(\mathbb{F})$ such that $\varphi_1(X) \neq 0$ and $\varphi_2(X) \neq 0$.
Let 
$$ X = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}. $$
Then for any $Y \in M_2(\mathbb{F})$, the matrix $XY$ will be a matrix whose first row is the first row of $Y$ and whose second row is zero. Hence,
$$ \operatorname{tr}(XA) = \operatorname{tr}(XB) = 1 $$
so $\operatorname{span}(X)$ complements both $K$ and $L$ to $M_2(\mathbb{F})$.
