\(\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}\)

# 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 Vectors and dot products.

## Start¶

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

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:

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 vector dot product of zero, so:

By distribution over addition of dot products:

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

So:

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

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