Rewriting vector as sum of components in the subspaces $V$ and $V^\perp$ I came across this problem: how can I write vector $u = (4,3,5)$ as $u=v+w$ where $v \in
V = \operatorname{span} \left \{  (1,1,0),(0,1,1)\right \} $  and $w \in V^\perp$.
Thanks for advice.
 A: Since $V$ is a two-dimensional subspace of $\mathbb{R}^3$ it's prudent to find a basis for $V^\perp$.  We can do this by letting $(x,y,z) \in V^\perp$.  We then find that 
$$
\langle (1,1,0), (x,y,z)\rangle \;\; =\;\; x+ y \;\; =\;\; 0
$$
hence $x = -y$.  A similar computation shows that $y = -z$.  This shows us that $(1,-1,1) \in V^\perp$.  We simply need to find coefficients $a,b,c$ that satisfy
$$
a\left [ \begin{array}{c}
1\\
1\\
0 \\
\end{array} \right ] + b \left[ \begin{array}{c}
0\\
1\\
1\\
\end{array} \right ] + c \left [ \begin{array}{c}
1 \\
-1\\
1\\
\end{array} \right ] \;\; =\;\; \left [ \begin{array}{c}
4\\
3\\
5\\
\end{array} \right ].
$$
A: First, prove that $V^\perp=\DeclareMathOperator{Span}{Span}\Span\{(1,-1,1)\}$. Then we wish to find scalars $\lambda_1$, $\lambda_2$, and $\lambda_3$ such that
$$
(4,3,5)=\lambda_1\cdot(1,1,0)+\lambda_2\cdot(0,1,1)+\lambda_3\cdot(1,-1,1)
$$
This is equivalent to solving $A\,\vec\lambda=\vec b$ where
\begin{align*}
A &=
\begin{bmatrix}
1 & 0 & 1 \\
1 & 1 & -1 \\
0 & 1 & 1
\end{bmatrix}
&
\vec\lambda &=
\begin{bmatrix}
\lambda_1\\ \lambda_2\\ \lambda_3
\end{bmatrix}
&
\vec b &=
\begin{bmatrix}
4\\3\\5
\end{bmatrix}
\end{align*}
Can you solve this system?
Once the system is solved, we have
\begin{align*}
v &= \lambda_1\cdot(1,1,0)+\lambda_2\cdot(0,1,1) & w&=\lambda_3\cdot(1,-1,1)
\end{align*}
A: Take $(1,1,0)$, $(0,1,1)$and a third vector, that together form a linearly independent set (for example $(0,0,1)$ would suffice), then use the Gram-Schmidt orthogonalization algorithm on them. The first two vectors that result from G-S will span the same subspace as your two vectors, the third will be a unit vector in $V^{\perp}$.
Now, project $u$ onto $V$ by the help of your orthonormal basis by $$ P_V(u)=\langle u,e_1\rangle e_1+\langle u,e_2\rangle e_2=v, $$ where $e_1$ and $e_2$ are the first two results of your G-S procedure.
Then project $u$ onto $V^{\perp}$ by $$ P_{V^{\perp}}(u)=\langle u,e_3\rangle e_3=w, $$ where $e_3$ is the third result of your G-S procedure.
