# project point onto line using formula containing inner and outer vector products

I would like to understand how to project a point onto a line.

The first method that comes to my mind would be to say that the line is defined by two points $$q_1, q_2$$. Point $$p$$ is projected onto that line by finding a point $$p'$$ on the line that is closest to $$p$$. the vector $$\vec{pp'}$$ is orthogonal to $$\vec{q_1q_2}$$. Using these facts there can be solved an equation system.

What I try to understand:

However in my lecture I have read this:

$$\frac{1}{||v||}v \left( \frac{1}{||v||}v^{T}p\right) = \frac{1}{||v||^2}(vv^{T})p=\frac{vv^{T}}{v^{T}v}p$$

Question: What do these inner and outer products mean thus I will be able to understand that equation?

Note: I have seen similiar posts on that topic like this one. Unfotunately I have not found the formula above in none of them.

I appreciate any help!

An inner product $$\langle v,w\rangle$$ can be define on $$\mathbb{R}^n$$ through vector multiplication: $$\langle v,w\rangle = w^{\perp} v$$. A general point on the line through two distinct points $$p_1,p_2$$ can be described by $$p(t)=p_1+t(p_2-p1)=(1-t)p_1+tp_2$$. If you want the orthogonal projection of $$q$$ onto such a line, then you search for the unique $$p(t)$$ such that $$(q-p(t))\perp (p_2-p_1)$$ because $$p_2-p_1$$ is the direction vector of the line. So, this amounts to finding $$t$$ such that
$$(q-p_1-t(p_2-p_1))\perp (p_2-p_1) \\ \langle q-p_1,p_2-p_1\rangle - t\langle p_2-p_1,p_2-p_1\rangle = 0 \\ t = \frac{\langle q-p_1,p_2-p_1\rangle}{\langle p_2-p_1,p_2-p_1\rangle}.$$ So the orthogonal projection of $$q$$ onto the line is $$p(t)$$ where $$t$$ is given above.