# Why is the Orthogonal projection given in this form?

In an exercise stated as the following.

Consider the real inner product space $$\mathbb{R}^3$$ (using scalar-product as the inner product), and let $$W=\text{Span}(v_1,v_2)$$ where

$$v_1 = \begin{bmatrix}1\\2\\1\end{bmatrix}, v_2 = \begin{bmatrix}2\\1\\2\end{bmatrix}$$.

The orthogonal projection $$P_W : \mathbb{R}^3 \rightarrow W$$ is given by

$$P_W(\begin{bmatrix}a\\b\\c\end{bmatrix})=\begin{bmatrix}\alpha\\\beta\\\alpha\end{bmatrix}$$.

Find $$\alpha,\beta$$.

I was able to use the hints to determine that

$$\alpha=\frac{1}{2}(a+c),\quad \beta=b$$

but I don't understand why, and I don't know how to solve similar problems without the hints. Can anyone explain why $$\alpha, \beta$$ are given as they are.

I think one should be able to determine them from the orthogonal projection formula

Given a inner product space $$V$$ with $$W=\text{Span}(v_1,\dots, v_n)$$, then any vector $$v\in V$$ can be written as

$$v=p+h$$

where $$p\in W,h\in W^\perp$$ and where we can write $$p$$ as

$$p=\sum_{i=1}^n \frac{\langle v, v_i \rangle}{\langle v_i, v_i \rangle} v_i$$.

However, I'm unable to relate the two.

• That last formula is only valid when the $v_i$ are orthogonal. – amd Apr 15 '20 at 7:18
• Ah yes @amd. The exercise specifically states that $v_1,v_2$ are orthogonal. – lunalux Apr 15 '20 at 7:20
• However, $v_1$ and $v_2$ in the first part of your question are not. – amd Apr 15 '20 at 7:22
• You're right @amd. I'm just confused. – lunalux Apr 15 '20 at 8:03

The formula at the end of your question is only applicable when $$v_1$$ and $$v_2$$ are orthogonal, which they obviously aren’t. However, if the projection of an arbitrary vector is of the form $$[\alpha,\beta,\alpha]^T$$, this means that another basis for $$W$$ is $$w_1=[1,0,1]^T$$ and $$w_2=[0,1,0]^T$$. These vectors are orthogonal, so the formula can be used with them. We then have $$\alpha = {v\cdot w_1\over w_1\cdot w_1} = {a+c\over2} \\ \beta = {v\cdot w_2\over w_2\cdot w_2} = b.$$
These values can of course be derived without knowing the projection formula. If $$[\alpha,\beta,\alpha]^T$$ is the projection of $$[a,b,c]^T$$, then $$[a,b,c]^T-[\alpha,\beta,\alpha]^T$$ must be orthogonal to both $$v_1$$ and $$v_2$$. Setting the inner products equal to zero gives you a system of two linear equations that you can solve for $$\alpha$$ and $$\beta$$, giving the same result as above.
Later on you will learn how to compute the projection directly from $$v_1$$ and $$v_2$$, without first finding an orthogonal basis or solving a set of equations: setting $$A=[v_1\;v_2]$$, $$P_W(v)=A(A^TA)^{-1}A^Tv$$. This is basically a generalization of the projection formula near the end of your question to an arbitrary basis of $$W$$.
If you apply the Gram-Schmidt process to $$\{v_1,v_2\}$$, you will get $$\{e_1,e_2\}$$, with$$e_1=\frac1{\sqrt6}\begin{bmatrix}1\\2\\1\end{bmatrix}\text{ and }e_2=\frac1{\sqrt3}\begin{bmatrix}1\\-1\\1\end{bmatrix}.$$So,\begin{align}P_W\left(\begin{bmatrix}a\\b\\c\end{bmatrix}\right)&=\left(\begin{bmatrix}a\\b\\c\end{bmatrix}.e_1\right)e_1+\left(\begin{bmatrix}a\\b\\c\end{bmatrix}.e_2\right)e_2\\&=\begin{bmatrix}\frac{a+c}2\\b\\\frac{a+c}2\end{bmatrix}.\end{align}