# Projecting onto subspace

Question

Find the orthogonal projection of $$x = \begin{bmatrix}7 \\ 0 \\ -4 \\ -4 \end{bmatrix}$$ onto the subspace of $\mathbb R^4$ spanned by $$v_1 = \begin{bmatrix}-4 \\ 2 \\ 2 \\ -4 \end{bmatrix}, v_2 =\begin{bmatrix}2 \\ 2 \\ 2 \\ 0 \end{bmatrix}$$

Answer

So I projected $x$ onto $v_1$ and $v_2$ and got $x_{v1} = \begin{bmatrix}2 \\ -1 \\ -1 \\ 2 \end{bmatrix} and, x_{v2} = \begin{bmatrix}1 \\ 1 \\ 1 \\ 0 \end{bmatrix}$ respectively.

I then subtracted $x_{v1}$ and $x_{v2}$ from $x$ and got $\begin{bmatrix}4 \\ 0 \\ -4 \\ -6 \end{bmatrix}$

which is wrong, and the correct answer should be $\begin{bmatrix}3 \\ 0 \\ 0 \\ 2 \end{bmatrix}$

So what have I done wrong?

-
Are you sure that you want to subtract these two things from $x$? Note that $x_{v1} + x_{v_2}$ is the expected answer. You seem to be calculating the component of $v$ which is orthogonal to the subspace in question. – Dylan Moreland Apr 26 '12 at 0:35
Cheers mate, your right, i just got stuck in without properly reading the question. – Jim_CS Apr 26 '12 at 0:37
@DylanMoreland Please consider converting your comment into an answer, so that this question gets removed from the unanswered tab. If you do so, it is helpful to post it to this chat room to make people aware of it (and attract some upvotes). For further reading upon the issue of too many unanswered questions, see here, here or here. – Julian Kuelshammer May 5 '15 at 9:07