Consider the vector space $\mathbb{R}^3$ and the subspace $$V=\{ (x,y,z) \in \mathbb{R}^3 | x=y=z \} $$ Find the projection $T$ onto $V$ along the subspace $U$ generated by the vectors $(1,2,1),(0,1,1)$.
It's easy to see that $V$ is generated by $(1,1,1)$
$T$ must send the basis vectors of $V$ to themselves and send the basis vectors of $U$ to the zero vector.
In other words $$T(1,1,1)=(1,1,1)$$ $$T(1,2,1)=(0,0,0)$$ $$T(0,1,1)=(0,0,0)$$
By considering a general linear map $$T(x,y,z)=(ax+by+cz,dx+ey+fz,gx+hy+iz)$$ And by using the above relations I can find $a,b,c,d,e,f,g,h,i$ by solving the system of six equations.
Is this correct?
Also for a general case in $\mathbb{R}^n$ where I want to find the projection $T$ onto the subspace $V$ generated by the vectors $v_1,...v_k$ along $U$ generated by the vectors $u_{k+1},...u_n$ the I want to find $T$ such that $$Tv_1=v_1$$ $$.......$$ $$Tv_k=v_k$$ and $$Tu_{k+1} =(0,0,0)$$ $$......$$ $$Tu_n =(0,0,0)$$
Is this correct?
Yes, that is correct. In order to find $T$ explicitly, note that:
Therefore,\begin{align}T(x,y,z)&=xT(1,0,0)+yT(0,1,0)+zT(0,0,1)\\&=(x-y+z,x-y+z,x-y+z).\end{align}