# 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}$$

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}$
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