Vector projection#

This here page follows the discussion in this Khan academy video on projection. Please watch that video for a nice presentation of the mathematics on this page.

For the video and this page, you will need the definitions and mathematics from on vectors.

Start#

Consider two vectors \(\vec{w}\) and \(\vec{v}\).

vector projection

We can scale \(\vec{v}\) with a scalar \(c\). By choosing the correct \(c\) we can create any \vector on the infinite length dotted line in the diagram. \(c \vec{v}\) defines this infinite line.

We’re going to find the projection of \(\vec{w}\) onto \(\vec{v}\), written as:

\[ \mathrm{proj}_\vec{v}\vec{w} \]

The projection of \(\vec{w}\) onto \(\vec{v}\) is a vector on the line \(c \vec{v}\). Specifically it is \(c \vec{v}\) such that the line joining \(\vec{w}\) and \(c \vec{v}\) is perpendicular to \(\vec{v}\).

Why is it called projection?#

Imagine a light source, parallel to \(\vec{v}\), above \(\vec{w}\). The light would cast rays perpendicular to \(\vec{v}\).

\(\mathrm{proj}_\vec{v}\vec{w}\) is the shadow cast by \(\vec{w}\) on the line defined by \(\vec{v}\).

Calculating the projection#

The \vector connecting \(\vec{w}\) and \(c \vec{v}\) is \(\vec{w} - c \vec{v}\).

We want to find \(c\) such that \(\vec{w} - c \vec{v}\) is perpendicular to \(\vec{v}\).

Two perpendicular vectors have a vector dot product of zero (see on vectors), and so:

\[(\vec{w} - c \vec{v}) \cdot \vec{v} = 0\]

By distribution over addition of dot products:

\[\begin{split}\begin{aligned} (\vec{w} - c \vec{v}) \cdot \vec{v} = 0 \implies \\ \vec{w} \cdot \vec{v} - c \vec{v} \cdot \vec{v} = 0 \implies \\ \frac{\vec{w} \cdot \vec{v}}{\vec{v} \cdot \vec{v}} = c \end{aligned}\end{split}\]

Because \(\| \vec{v} \| = \sqrt(\vec{v} \cdot \vec{v})\):

\[\begin{split}c = \frac{\vec{w} \cdot \vec{v}}{\\| \vec{v} \|^2}\end{split}\]

So:

\[\begin{split}\mathrm{proj}_\vec{v}\vec{w} = \frac{\vec{w} \cdot \vec{v}}{\\| \vec{v} \|^2} \vec{v}\end{split}\]

We can also write the projection in terms of the unit \vector defined by \(\vec{v}\):

\[\begin{split}\begin{aligned} \hat{u} \triangleq \frac{\vec{v}}{\\| \vec{v} \|} \implies \\ \mathrm{proj}_\vec{v}\vec{w} = \frac{\vec{w} \cdot \vec{v}}{\\| \vec{v} \|} \vec{u} \end{aligned}\end{split}\]

\(\frac{\vec{w} \cdot \vec{v}}{\| \vec{v} \|}\) is called the scalar projection of \(\vec{w}\) onto \(\vec{v}\).

Also see#