Find the orthogonal projector of a vector onto a subspace So I have this question here which asks me to find the orthogonal projection of $v=(1,2,3)$ onto the subspace $W$spanned by the vectors $u_1=(2,-2,1)$ and $u_2=(-1,1,4)$.
I notice that both $u_1$ and $u_2$ are orthogonal to each other so I am guessing that's some kind of clue.
Since I'm working in 3 dimensions, I'm guessing the cross product comes into play somehow but I am not sure. Can someone please suggest how I can approach this problem? Thanks!
 A: There's a quick formula that you can use. Some explanations to guide you to it. We're working on a finite-dimensional vector space. You know that $\mathbb{R}^3=W\oplus W^\perp$. Since $(u_1,u_2)$ is an orthogonal basis of $W$, if you take $u_3$ any nonzero element in $W^\perp$, then $(u_1,u_2,u_3)$ is an orthogonal basis of $\mathbb R^3$. So there are $\alpha_1,\alpha_2,\alpha_3\in\mathbb R$ such that $$v=\alpha_1u_1+\alpha_2u_2+\alpha_3u_3\tag{1}$$
What is the orthogonal projection of $v$ onto $W$? Well, $v$ can be uniquely written as $v=x+y$ where $x\in W$ and $y\in W^\perp$, right? The orthogonal projection of $v$ onto $W$ is simply $x$, which is the vector $\alpha_1u_1+\alpha_2u_2$ by $(1)$. Two things to motivate this: Firstly, as $v$ can be written in a unique manner as a sum of two orthogonal vectors, one of which is in $W$, it is natural to give this definition. Secondly, you can actually show that $x$ is the unique vector that satisfies $$\|v-x\|=\inf_{w\in W}\|v-w\|\tag{2}$$ so $(2)$ gets us back to the orthogonal projection we used in in high-school ;)
So, using $(1)$, the orthogonal projection of $v$ is $\alpha_1u_1+\alpha_2u_2$. Using inner products, can you find what are $\alpha_1$ and $\alpha_2$? Don't forget that $u_1,u_2$ and $u_3$ are orthogonal ;)
A: suppose $W$ is a subspace spanned by orthogonal vectors $\{v_1, v_2, ..., v_n\}$ and you want to find the projection of $u$ onto $W$. Because each $v_i$ is orthogonal, you can find the projection of $u$ onto each "line" determined by each vector, then add them. In other words, you need to work out "how much of $u$ is in the $v_1$ direction", "how much of $u$ is in the $v_2$ direction" and so on, then add them up. Mathematically the formula is:
\begin{align*}
\mathrm{proj}_W(u) = \frac{u\cdot v_1}{\Vert v_1 \Vert^2}v_1 + \frac{u\cdot v_2}{\Vert v_2 \Vert^2}v_2 + \cdot\cdot\cdot + \frac{u\cdot v_n}{\Vert v_n \Vert^2}v_n \end{align*}
I'll leave the specific case of your question to you :)
