<s>[INST] 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?
 [/INST] That would be the correct method...if $v_1$ and $v_2$ were orthogonal and unit length. Unfortunately, they're not. 
Three alternatives:


*

*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. 

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

*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. 
</s>