# How to find orthogonal projection of vector on a subspace?

Well, I have this subspace: $V = \operatorname{span}\left\{ \begin{pmatrix}\frac{1}{3} \\\frac{2}{3} \\\frac{2}{3}\end{pmatrix},\begin{pmatrix}1 \\3 \\4\end{pmatrix}\right\}$ and the vector $v = \begin{pmatrix}9 \\0 \\0\end{pmatrix}$

How can I find the orthogonal projection of $v$ on $V$?
This is what I did so far:

\begin{align}&P_v(v)=\langle v,v_1\rangle v_1+\langle v,v_2\rangle v_2 =\\=& \left\langle\begin{pmatrix}9 \\0 \\0\end{pmatrix},\begin{pmatrix}\frac{1}{3} \\\frac{2}{3} \\\frac{2}{3}\end{pmatrix}\right\rangle\begin{pmatrix}\frac{1}{3} \\\frac{2}{3} \\\frac{2}{3}\end{pmatrix}+\left<\begin{pmatrix}9 \\0 \\0\end{pmatrix},\begin{pmatrix}1 \\3 \\4\end{pmatrix}\right>\begin{pmatrix}1 \\3 \\4\end{pmatrix} = \begin{pmatrix}10 \\29 \\38\end{pmatrix}\end{align}

Is this the right method to compute this?

That would be the correct method...if $v_1$ and $v_2$ were orthogonal and unit length. Unfortunately, they're not.

Three alternatives:

1. Compute $w = v_1 \times v_2$, and the projection of $v$ onto $w$ -- call it $q$. Then compute $v - q$, which will be the desired projection.

2. Orthgonalize $v_1$ and $v_2$ using the gram-schmidt process, and then apply your method.

3. Write $q = av_1 + bv_2$ as the proposed projection vector. You then want $v - q$ to the orthogonal to both $v_1$ and $v_2$. This gives you two equations in the unknowns $a$ adn $b$, which you can solve.

Hint

You have to construct by the Gram Schmidt procedure an orthonormal basis $(e_1,e_2)$ from the given basis of $V$ and then $$P_v(V)=\langle v,e_1\rangle e_1+\langle v,e_2\rangle e_2$$

Since codimension of $V$ is one, in this case it is probably easier to calculate projection onto $V^\bot$ first.

In this specific case you get $V^\bot = \operatorname{span}\{(2,-2,1)^T\}$. To calculate projection onto one-dimensional subspace space, you can simply take unit vector $u$ generating this subspace and then and calculate $\langle \vec v,\vec u \rangle \vec u$. In this case you get $\vec u = \frac13 (2,-2,1)^T$, $\langle \vec v,\vec u\rangle = 6$ and he projection onto $V^\bot$ is $$\vec q=\langle \vec v,\vec u \rangle \vec u = (4,-4,2)^T.$$

Projection onto $V$ is $$\vec p = \vec v - \vec q = (5,4,-2)^T.$$

In the above $(a,b,c)^T$ denotes transpose. (So that I can write vectors in a row. Based on the question it seems that you are using notation for vectors as columns.)

Hint:

1) Compute an orthonormal base $v_1,v_2$ of $V$ using Gram-Schmidt

2) Consider the projector $p_V(x) = \sum_{i=1}^2 \langle v_i,x\rangle v_i$

3) Compute $p_V(v)$

So what you did is wrong because $\begin{pmatrix}\frac{1}{3} \\\frac{2}{3} \\\frac{2}{3}\end{pmatrix}$,$\begin{pmatrix}1 \\3 \\4\end{pmatrix}$ are not orthonormal vectors.