# How can I find the projection of a vector onto a subspace?

Jun 20, 2018

See below

#### Explanation:

Let's say that our subspace $S \setminus \subset V$ admits ${u}_{1} , {u}_{2} , \ldots , {u}_{n}$ as an orthogonal basis. This means that every vector $u \setminus \in S$ can be written as a linear combination of the ${u}_{i}$ vectors:

$u = \setminus {\sum}_{i = 1}^{n} {a}_{i} {u}_{i}$

Now, assume that you want to project a certain vector $v \setminus \in V$ onto $S$. Of course, if in particular $v \setminus \in S$, then its projection is $v$ itself. Let's assume that $v \in V$ but $v \notin S$. Let's call $u$ the projection of $v$ onto $S$.

Following what we wrote before, we need to find the coefficients ${a}_{i}$ to express $u$ inside $S$. These coefficients are

${a}_{i} = \setminus \frac{\setminus \left\langle v , {u}_{i} \setminus\right\rangle}{\setminus \left\langle {u}_{i} , {u}_{i} \setminus\right\rangle}$

$u = \setminus {\sum}_{i = 1}^{n} \setminus \frac{\setminus \left\langle v , {u}_{i} \setminus\right\rangle}{\setminus \left\langle {u}_{i} , {u}_{i} \setminus\right\rangle} {u}_{i}$