Projection of a vector on a line
A line
The line in passing through and with direction , , is the set of vectors such that is parallel to :
We can always assume without loss of generality that the direction is normalized, that is .
Definition
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. 
|