JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Projections: The Closest Point

A projection is the shadow a vector casts onto a line or plane — the closest point inside it. Learn to split any vector into an in-subspace part plus a perpendicular error, and the formula for projecting onto one direction.

The shadow picture

Shine a light straight down on a vector and watch where its shadow lands on the floor. That shadow is the projection of the vector onto the floor. Among every point on the floor, the shadow is the closest one to the tip of the vector — projection and 'nearest point' are two names for the same thing.

Split into 'inside' plus 'perpendicular error'

Every vector can be split, uniquely, into two pieces relative to a subspace (a line, a plane, and so on): the part that lives inside the subspace — that is the projection — plus a leftover that sticks out perpendicular to it. We call that leftover the error or residual, and its hallmark is that it is orthogonal to everything inside.

v  =  p   +   e
      |       |
  projection  error (perpendicular to the subspace)

p dot e = 0   <-- the two pieces are orthogonal
Every vector = its projection + a perpendicular error.

Projecting onto one direction

The simplest case projects v onto the line through a single vector a. The formula reads: scale a by the ratio (a dot v) / (a dot a). The numerator measures how much v aligns with a; the denominator is just a's length squared, undoing a's scale so the answer depends only on a's direction.

  1. Project v = (2,2) onto the x-axis direction a = (1,0).
  2. a dot v = 1*2 + 0*2 = 2; a dot a = 1*1 + 0*0 = 1.
  3. Projection p = (2/1)*(1,0) = (2,0); error e = v - p = (0,2), which is perpendicular to a.
proj_a(v) = ( (a dot v) / (a dot a) ) * a

v=(2,2), a=(1,0):  (2/1)*(1,0) = (2,0)
check: e = v - p = (0,2),  a dot e = 0
Projection onto a single direction, with the error left perpendicular.