Projection of a vector on a line
Definition
Consider the line in passing through and with direction :
The projection of a given point on the line is a vector located on the line, that is closest to (in Euclidean norm). This corresponds to a simple optimization problem:
(This particular problem is part of a general class of optimization problems known as least-squares.)
Closed-form expression
Assuming that is normalized, the optimal solution to the above problem is
and the expression for the projected vector is
In the case when is not normalized, the expression is
Proof: Let us first assume that is normalized. We express the square of the objective function as
where , . The minimum is clearly attained when the first term is zero, which yields
as claimed. 
|