Linear Algebra/Orthogonal Projection Onto a Line
We first consider orthogonal projection onto a line. To orthogonally project a vector
onto a line
, darken a point on the line if someone on that line and looking straight up or down (from that person's point of view) sees
.
The picture shows someone who has walked out on the line until the tip of
is straight overhead. That is, where the line is described as the span of some nonzero vector
, the person has walked out to find the coefficient
with the property that
is orthogonal to
.
We can solve for this coefficient by noting that because
is orthogonal to a scalar multiple of
it must be orthogonal to
itself, and then the consequent fact that the dot product
is zero gives that
.
- Definition 1.1
The orthogonal projection of
onto the line spanned by a nonzero
is this vector.
Problem 13 checks that the outcome of the calculation depends only on the line and not on which vector
happens to be used to describe that line.
- Remark 1.2
The wording of that definition says "spanned by
" instead the more formal "the span of the set
". This casual first phrase is common.
- Example 1.4
In
, the orthogonal projection of a general vector
onto the
-axis is
which matches our intuitive expectation.
The picture above with the stick figure walking out on the line until
's tip is overhead is one way to think of the orthogonal projection of a vector onto a line. We finish this subsection with two other ways.
- Example 1.5
A railroad car left on an east-west track without its brake is pushed by a wind blowing toward the northeast at fifteen miles per hour; what speed will the car reach?
For the wind we use a vector of length
that points toward the northeast.
The car can only be affected by the part of the wind blowing in the east-west direction— the part of
in the direction of the
-axis is this (the picture has the same perspective as the railroad car picture above).
![]() |
So the car will reach a velocity of
miles per hour toward the east.
Thus, another way to think of the picture that precedes the definition is that it shows
as decomposed into two parts, the part with the line (here, the part with the tracks,
), and the part that is orthogonal to the line (shown here lying on the north-south axis). These two are "not interacting" or "independent", in the sense that the east-west car is not at all affected by the north-south part of the wind (see Problem 5). So the orthogonal projection of
onto the line spanned by
can be thought of as the part of
that lies in the direction of
.
Finally, another useful way to think of the orthogonal projection is to have the person stand not on the line, but on the vector that is to be projected to the line. This person has a rope over the line and pulls it tight, naturally making the rope orthogonal to the line.
That is, we can think of the projection
as being the vector in the line that is closest to
(see Problem 11).
- Example 1.6
A submarine is tracking a ship moving along the line
. Torpedo range is one-half mile. Can the sub stay where it is, at the origin on the chart below, or must it move to reach a place where the ship will pass within range?
The formula for projection onto a line does not immediately apply because the line doesn't pass through the origin, and so isn't the span of any
. To adjust for this, we start by shifting the entire map down two units. Now the line is
, which is a subspace, and we can project to get the point
of closest approach, the point on the line through the origin closest to
the sub's shifted position.
The distance between
and
is approximately
miles and so the sub must move to get in range.
This subsection has developed a natural projection map: orthogonal projection onto a line. As suggested by the examples, it is often called for in applications. The next subsection shows how the definition of orthogonal projection onto a line gives us a way to calculate especially convienent bases for vector spaces, again something that is common in applications. The final subsection completely generalizes projection, orthogonal or not, onto any subspace at all.
Exercises[edit]
- This exercise is recommended for all readers.
- Problem 1
Project the first vector orthogonally onto the line spanned by the second vector.
, 
, 
, 
, 
- This exercise is recommended for all readers.
- Problem 2
Project the vector orthogonally onto the line.

, the line 
- Problem 3
Although the development of Definition 1.1 is guided by the pictures, we are not restricted to spaces that we can draw. In
project this vector onto this line.
- This exercise is recommended for all readers.
- Problem 4
Definition 1.1 uses two vectors
and
. Consider the transformation of
resulting from fixing
and projecting
onto the line that is the span of
. Apply it to these vectors.
Show that in general the projection tranformation is this.
Express the action of this transformation with a matrix.
- Problem 5
Example 1.5 suggests that projection breaks
into two parts,
and
, that are "not interacting". Recall that the two are orthogonal. Show that any two nonzero orthogonal vectors make up a linearly independent set.
- Problem 6
- What is the orthogonal projection of
onto a line if
is a member of that line? - Show that if
is not a member of the line then the set
is linearly independent.
- Problem 7
Definition 1.1 requires that
be nonzero. Why? What is the right definition of the orthogonal projection of a vector onto the (degenerate) line spanned by the zero vector?
- Problem 8
Are all vectors the projection of some other vector onto some line?
- This exercise is recommended for all readers.
- Problem 9
Show that the projection of
onto the line spanned by
has length equal to the absolute value of the number
divided by the length of the vector
.
- Problem 10
Find the formula for the distance from a point to a line.
- Problem 11
Find the scalar
such that
is a minimum distance from the point
by using calculus (i.e., consider the distance function, set the first derivative equal to zero, and solve). Generalize to
.
- This exercise is recommended for all readers.
- Problem 12
Prove that the orthogonal projection of a vector onto a line is shorter than the vector.
- This exercise is recommended for all readers.
- Problem 13
Show that the definition of orthogonal projection onto a line does not depend on the spanning vector: if
is a nonzero multiple of
then
equals
.
- This exercise is recommended for all readers.
- Problem 14
Consider the function mapping to plane to itself that takes a vector to its projection onto the line
. These two each show that the map is linear, the first one in a way that is bound to the coordinates (that is, it fixes a basis and then computes) and the second in a way that is more conceptual.
- Produce a matrix that describes the function's action.
- Show also that this map can be obtained by first rotating everything in the plane
radians clockwise, then projecting onto the
-axis, and then rotating
radians counterclockwise.
- Problem 15
For
let
be the projection of
onto the line spanned by
, let
be the projection of
onto the line spanned by
, let
be the projection of
onto the line spanned by
, etc., back and forth between the spans of
and
. That is,
is the projection of
onto the span of
if
is even, and onto the span of
if
is odd. Must that sequence of vectors eventually settle down— must there be a sufficiently large
such that
equals
and
equals
? If so, what is the earliest such
?
![\mbox{proj}_{[\vec{s}\,]}({\vec{v}})=
\frac{ \vec{v}\cdot\vec{s} }{ \vec{s}\cdot\vec{s} }\vec{s}](http://upload.wikimedia.org/math/7/5/6/75660186b2acee46adb6b1a95a866381.png)
onto the line
, we first pick a direction vector for the line. For instance,








, 

, 


, the line 




is linearly independent.
radians clockwise, then projecting onto the