Projection on a line
- Definition
- Closed-form expression
- Interpreting the scalar product
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. It is also a special case of a Euclidean projection on a general set.
Closed-form expression
Assuming that is normalized, so that
, the objective function of the projection problem reads, after squaring:

Thus, the optimal solution to the projection problem is

and the expression for the projected vector is

The scalar product is the component of
along
.
In the case when is not normalized, the expression is obtained by replacing
with its scaled version
:

Interpreting the scalar product
We can now interpret the scalar product between two non-zero vectors , by applying the previous derivation to the projection of
on the line of direction
passing through the origin. If
is normalized (
), then the projection of
on
is
. Its length is
. (See above figure.)
In general, the scalar product is simply the component of
along the normalized direction
defined by
.