Orthogonal Projection of a Vector onto a Subspace
The orthogonal projection of a vector onto a subspace is the sum of the orthogonal projections of the vector v onto each vector w in the basis. This is only possible if the basis is orthogonal. $$ P_W(v) = P_{w1}(v)+...+P_{wn}(v) $$
Each orthogonal projection P of vector v onto vector w is determined by the Fourier coefficients:
$$ P_{w}(v) =\frac{<v,w>}{<w,w>} \cdot w $$
A Practical Example
Consider a subspace W in R3 within the field K=R.
The basis of the subspace is as follows:
$$ W = L_R \{ w_1, w_2 \} $$
where
$$ w_1 = (1,1,-2) \\ w_2 = (1,1,1) $$
This is an orthogonal basis because the dot product of its vectors equals zero.
$$ <w_1,w_2> = 0 $$
The vector v, whose orthogonal projection onto the subspace W we want to calculate, is as follows:
$$ v = (2,1,3) $$
The orthogonal projection of vector v onto subspace W is:
$$ P_W(v) = P_{w_1}(v) + P_{w_2}(v) $$
$$ P_W(v) = \frac{<v,w_1>}{<w_1,w_1>} \cdot w_1 + \frac{<v,w_2>}{<w_2,w_2>} \cdot w_2 $$
$$ P_W(v) = \frac{<(2,1,3),(1,1,-2)>}{<(1,1,-2),(1,1,-2)>} \cdot (1,1,-2) + \frac{<(2,1,3),(1,1,1)>}{<(1,1,1),(1,1,1)>} \cdot (1,1,1) $$
$$ P_W(v) = \frac{2 \cdot 1 + 1 \cdot 1 + 3 \cdot -2}{1 \cdot 1 + 1 \cdot 1 + (-2) \cdot (-2)} \cdot (1,1,-2) + \frac{2 \cdot 1 + 1 \cdot 1 + 3 \cdot 1}{1 \cdot 1 + 1 \cdot 1 + 1 \cdot 1} \cdot (1,1,1) $$
$$ P_W(v) = \frac{2 + 1 -6}{1 +1 + 4} \cdot (1,1,-2) + \frac{2+1+3}{1+1+1} \cdot (1,1,1) $$
$$ P_W(v) = \frac{-3}{6} \cdot (1,1,-2) + \frac{6}{3} \cdot (1,1,1) $$
$$ P_W(v) = \frac{-1}{2} \cdot (1,1,-2) + 2 \cdot (1,1,1) $$
$$ P_W(v) = (1 \cdot (- \frac{1}{2}),1 \cdot (- \frac{1}{2}),-2 \cdot (- \frac{1}{2})) + (1 \cdot 2 ,1 \cdot 2 ,1 \cdot 2 ) $$
$$ P_W(v) = (- \frac{1}{2}, - \frac{1}{2}, \frac{2}{2}) + (2 ,2 ,2 ) $$
$$ P_W(v) = (- \frac{1}{2}, - \frac{1}{2}, 1) + (2 ,2 ,2 ) $$
$$ P_W(v) = ( \frac{-1 + 2 \cdot 2}{2}, \frac{-1 + 2 \cdot 2}{2}, 1+2) $$
$$ P_W(v) = ( \frac{-1 + 4}{2}, \frac{-1 + 4}{2}, 3) $$
$$ P_W(v) = ( \frac{3}{2}, \frac{3}{2}, 3) $$
This results in the orthogonal projection of the vector onto subspace W.