Consider the vector space $\Bbb R^4$ and the subspaces $$\Bbb S=\{\rm x\in\Bbb R^4:3x_1+x_2-x_3+4x_4=0\}$$ $$\Bbb T=\langle (1,1,0,-1);(-1,0,1,0)\rangle$$
Find a linear transformation $f$ such that $${\rm Im} (f)=\Bbb T$$ $${\rm Ker} (f)\subset \Bbb S$$
and with eigenvalues $3,-2,0$. Note: $\subset$ is strict inclusion.
Now, one can readily check that $$\Bbb S=\langle(0,1,1,0),(1,0,3,0),(0,4,0,-1)\rangle$$
and that the set is linearly independent so that $\dim \Bbb S=3$. By the dimension theorem, since $\dim \Bbb T=2$, we must have $\dim \;{\rm Ker} (f)=2$. We show $$\mathscr B=\{(0,1,1,0),(1,0,3,0),(1,1,0,-1),(-1,0,1,0)\}$$ is a basis for $\Bbb R^4$. By expanding throughout the last row $$\begin{vmatrix}0&1&1&-1\\1&0&1&0\\1&3&0&1\\0&0&-1&0\end{vmatrix}=(-1)\cdot(-1)^{3+4}\begin{vmatrix}0&1&-1\\1&0&0\\1&3&1\end{vmatrix}$$
$$=1\cdot(-1)^{2+1}\begin{vmatrix}1&-1\\3&1\end{vmatrix}=-4\neq0$$
Thus, $$\mathscr B=\{(0,1,1,0),(1,0,3,0),(1,1,0,-1),(-1,0,1,0)\}$$ is a basis.
It suffices to define $f$ for the basis vectors. Since ${\rm Ker} (f)\subset \Bbb S$ and $(0,1,1,0),(1,0,3,0)\in\Bbb S$, I set $$f(0,1,1,0)=\bar 0$$ $$f(1,0,3,0)=\bar 0$$
and I get the first eigenvalue, $0$. Now, I'm only missing $$f(1,1,0,-1)=\lambda (1,1,0,-1)$$ $$f(-1,0,1,0)=\mu (-1,0,1,0)$$
which will ensure the other two eigenvalues and ${\rm Im}(f)=\Bbb T$. How can I correctly choose wether $\mu=3$ and $\lambda =-2$ or $\lambda =3$, $\mu=-2$? I have to be careful, since I need $\dim{\rm Ker}(f)=2$.