I have two orthonormal vectors and a fixed vector b. I need to show orthogonality of the "error vector" I have two orthonormal vectors $q_1$ and $q_2$ and a fixed vector b. The first part of the question was to find the optimal linear combination $\alpha$$q_1$+$\beta$$q_2$ that is closest to b in the 2-norm sense. I believe that $x=Q^T$$b$. For the second part of the question I have the "error vector" $r=b-\alpha$$q_1$$-\beta$$q_2$ and I have to show this is orthogonal to $q_1$ and $q_2$. Can I do this by showing that the projection of b into the range of Q is in the range of Q? Am I even on the right track? Thanks
 A: let the error vector $\epsilon$ be defined by $$b = (q_1^\top b) q_1 + (q_2^\top b) q_2 + \epsilon \tag1$$ $(1)$ implies that $\epsilon$ is orthogonal to $q_1, q_2$ and in fact is orthogonal to any linear combination of $q_1, q_2.$
we will use the phythagors theorem to show that $(q_1^\top b) q_1 + (q_2^\top b) q_2$ is the closest vector in the span of $\{q_1, q_2\}.$  consider $$b - \alpha q_1 -\alpha q_2 = (q_1^\top b - \alpha) q_1 + (q_2^\top b -\beta) q_2 + \epsilon \tag 2$$ since $(q_1^\top b - \alpha) q_1 + (q_2^\top b -\beta) q_2$ and $\epsilon$ are orthogonal, 
$$\begin{align}| b - \alpha q_1 -\alpha q_2|^2 &= |(q_1^\top b - \alpha) q_1 + (q_2^\top b -\beta) q_2|^2 +|\epsilon|^2\\
&\ge |\epsilon|^2 = |b -(q_1^\top b) q_1 + (q_2^\top b) q_2|^2\end{align}$$
A: Since $x=Q^{T}b=\left(q_1^{T}b\right)q_1+\left(q_2^{T}b\right)q_2$, 
$\;\;\;r=b-\left(q_1^{T}b\right)q_1-\left(q_2^{T}b\right)q_2$;
so you just need to show that $q_1^{T}r=0$ and $q_2^{T}r=0\;\;$  (using that $q_1$ and $q_2$ are orthonormal).
