Given $\displaystyle X=(4,8,4,-8)\in R^4$ and $\displaystyle S = span\{(1,2,1,0),(-1,1,-1,1), (1,0,1,2)\}$ is a subspace,
Find the orthogonal projections of $\displaystyle X$ onto both $\displaystyle S$ and $\displaystyle S^\perp$.

Now, I've already found $\displaystyle S^\perp = span\{(-6,-3,4,1)\}$ so I can decompose X into $\displaystyle Y\in S$ and $\displaystyle Z\in S^\perp$ s.t.
X = Y + Z.

Let Z = a(-6,-3,4,1), a in R.

So, $\displaystyle (4,8,4,-8)=Y+a(-6,-3,4,1)$

(I chose to use Z instead of Y since dim(Z)=1, but dim(Y)=3, so fewer inner-products.)

Dotting both sides with (-6,-3,4,1), we get:

$\displaystyle (4,8,4,-8)\cdot(-6,-3,4,1)=a\|(-6,-3,4,1)\|^2$ since $\displaystyle Y\cdot(-6,-3,4,1) = 0$.

So $\displaystyle a = \frac{-24}{31}$ and $\displaystyle Z = \frac{-24}{31}(-6,-3,4,1)$.

Y = X - Z so
$\displaystyle Y = (-14,-1,16,-5)$

Hope that's right!