Projection and Components

Projection answers a simple question:

How much of one vector lies
along another direction?

If uu is a unit vector, the projection of aa onto uu is:

proju(a)=(au)u\operatorname{proj}_u(a) = (a \cdot u)u

The number aua \cdot u is the scalar component of aa along uu.

a = [3, 2]proj_b(a) = [3, 0]b direction
Projection keeps the component of one vector along another direction.

Scalar Component Versus Projected Vector

The scalar component is a number.

The projected vector is a vector.

For:

a = [4, 3]
u = [1, 0]

the scalar component is:

au=4a \cdot u = 4

and the projected vector is:

proju(a)=4[1,0]=[4,0]\operatorname{proj}_u(a) = 4[1,0] = [4,0]
MATH-C04-T05-001Exercise: Project onto an axis

Let a = [4, 3] and let u = [1, 0].

What is proj_u(a)?

Compute it first, then check your number.

HintHorizontal axis

u is already a unit vector along the horizontal axis.

SolutionHorizontal projection

The direction u = [1, 0] is already unit length. First measure the scalar component:

au=4a \cdot u = 4

Then multiply by the direction to get the projected vector:

proju(a)=4[1,0]=[4,0]\operatorname{proj}_u(a) = 4[1,0] = [4,0]
MATH-C04-T05-002Exercise: Component or vector

For a = [4, 3] and u = [1, 0], what is the scalar component aua\cdot u?

Compute it first, then check your number.

HintOne number

Compute the dot product aua\cdot u.

SolutionScalar component

The scalar component is the dot product with the unit direction:

[4,3][1,0]=4[4,3]\cdot[1,0] = 4

This answer is a number. The projected vector would be [4, 0].

Projection Onto a Non-Unit Vector

If the direction vector bb is not unit length, use:

projb(a)=abbbb\operatorname{proj}_b(a) = \frac{a \cdot b}{b \cdot b} b

The denominator corrects for the length of bb.

MATH-C04-T05-003Exercise: Use a non-unit direction

Let a = [6, 2] and b = [2, 0]. What is projb(a)\operatorname{proj}_b(a)?

Compute it first, then check your number.

HintUse the full formula

Compute aba\cdot b and bbb\cdot b, then multiply the ratio by bb.

SolutionProjection with non-unit b

Because b is not unit length, divide by b dot b:

ab=12,bb=4a\cdot b = 12,\qquad b\cdot b = 4

The scalar multiplier is 12 / 4 = 3, so:

projb(a)=124[2,0]=[6,0]\operatorname{proj}_b(a) = \frac{12}{4}[2,0] = [6,0]

Why Projection Matters

Projection appears whenever we keep one part of a signal and ignore another.

In ML, projections appear in:

  • linear layers
  • attention query, key, and value maps
  • dimensionality reduction
  • components of a vector along a direction

Projection is not just a picture. It is a way to extract a measurable part.

Projection also tells you what is left out. If you subtract the projected vector from the original vector, the remainder is the residual. For ordinary Euclidean projection, that residual is orthogonal to the direction you kept.

This matters because many ML operations keep a useful component and discard the rest. A good projection question is therefore two-sided:

What did we keep?
What did we remove?
MATH-C04-T05-004Exercise: Residual after projection

Let a = [4, 3] and let u = [1, 0]. The projection of a onto u is [4, 0].

What is the residual a - proj_u(a)?

Compute it first, then check your number.

HintOriginal minus kept part

Compute [4, 3] - [4, 0].

SolutionThe discarded component
[4,3][4,0]=[0,3][4,3] - [4,0] = [0,3]

The projection kept the horizontal component. The residual is the vertical component.

Before Moving On

Projection turns direction into measurement. It tells how much of a vector is visible from a chosen direction.