Projecting One Vector onto Another

Shine a light straight down onto a line and a vector casts a shadow on it. That shadow is the projection of one vector onto another: the part of \vec{v} that lies along the direction of \vec{u}, with the perpendicular part thrown away.

The length of the shadow is \vec{v}\cdot\hat{u} (the dot product with the unit vector in \vec{u}'s direction). As a full vector, the projection is

\operatorname{proj}_{\vec{u}}\vec{v} = \frac{\vec{u}\cdot\vec{v}}{\vec{u}\cdot\vec{u}}\,\vec{u}.

Casting the shadow

Drag \vec{v}. The bold segment on the line through \vec{u} is the projection, and the dashed line dropping from \vec{v}'s tip meets that line at a right angle — projection always drops perpendicularly. When \vec{v} is itself perpendicular to \vec{u}, the shadow shrinks to nothing.

The workhorse of applied maths

Projection is how you find the "closest point" on a line or plane to a given target — which is exactly the question behind least-squares fitting, the engine of linear regression. It splits any vector into "the part along \vec{u}" plus "the leftover perpendicular part", and that split — signal plus residual — turns up everywhere from graphics to statistics. It closes out Stage A: with addition, scaling, length, the dot product and projection, you have the full vocabulary of vectors.