Intuition What this page is for
The parent note gave you the two formulas. This page throws every kind of input at them — sharp angles, right angles, obtuse angles, zero vectors, a giant vector, a real-world ramp, and an exam twist — so you never meet a case you haven't already seen worked out.
Keep the two boxed tools beside you the whole time:
comp b a = ∣ b ∣ a ⋅ b proj b a = b ⋅ b a ⋅ b b
Both are built from the Dot product and a unit vector b ^ . Nothing else.
Definition Reading the two operator names out loud
comp b a — read "the component of a in the direction of b ." It is a plain number (a signed length): how far does a reach along b 's line? The subscript b says "measured along b "; the a says "of the vector a ." ("comp" = component.)
proj b a — read "the projection of a onto b ." It is a vector — that same signed length now given the direction of b , so it lives on b 's line as an actual arrow (the shadow itself).
Why two names? One answers how much (a number), the other answers which arrow (a vector). Same shadow, two descriptions. Whenever you see comp expect a number; whenever you see proj expect an arrow.
Every projection problem falls into exactly one of these cells. The last column names the example that covers it.
#
Case class
What is special
Sign of a ⋅ b
Covered by
C1
Acute angle (0 ∘ < θ < 9 0 ∘ )
shadow points along b
positive
Ex 1
C2
Right angle (θ = 9 0 ∘ )
shadow is zero
zero
Ex 2
C3
Obtuse angle (9 0 ∘ < θ < 18 0 ∘ )
shadow points backward
negative
Ex 3
C4
Non-unit / long b
must divide by b ⋅ b , not $
\vec b
$
C5
Degenerate: b = 0
division by zero — undefined
0/0
Ex 5
C5′
Degenerate: a = 0
nothing to project — result is 0
zero
Ex 5b
C6
Collinear (θ = 0 ∘ or 18 0 ∘ )
shadow = whole vector, ±
$\pm
\vec a
C7
3-D decomposition
split into parallel + perpendicular
any
Ex 7
C8
Real-world word problem (ramp / force)
attach units, meaning
positive
Ex 8
C9
Exam twist (unknown solved from a projection)
work backward
given
Ex 9
We now walk them all.
Definition The three quantities every step needs
a ⋅ b = dot product = multiply matching coordinates and add: for a = ( a 1 , a 2 ) , b = ( b 1 , b 2 ) it is a 1 b 1 + a 2 b 2 . It is a single number .
∣ b ∣ = length of b = b 1 2 + b 2 2 (Pythagoras on its components).
b ⋅ b = b 1 2 + b 2 2 = ∣ b ∣ 2 — the dot product of b with itself is its length squared .
θ is the angle between the two arrows when their tails are placed together. We almost never compute θ — the dot product hides it for us. Why prefer the dot product to measuring θ ? Because it needs only coordinates and arithmetic, no protractor.
Figure s01 below draws exactly this setup: the magenta arrow a , the violet arrow b , and the orange shadow dropped straight down onto b 's line. The dashed navy line is the perpendicular "sun ray" that defines where the shadow ends — keep it in mind, every example is a version of this one picture.
Worked example Sharp angle: shadow points forward
a = ( 4 , 3 ) , b = ( 2 , 0 ) . Find the scalar and vector projections of a onto b .
Forecast: b points along + x , and a leans up-and-right. Guess: the shadow is the x -part of a , so scalar = 4 and vector = ( 4 , 0 ) . Let's confirm. (This is precisely the geometry in figure s01 — the orange shadow along b .)
Step 1. a ⋅ b = 4 ( 2 ) + 3 ( 0 ) = 8 .
Why this step? The dot product is the numerator of both formulas; compute it first.
Step 2. b ⋅ b = 2 2 + 0 2 = 4 , so ∣ b ∣ = 4 = 2 .
Why this step? Scalar needs ∣ b ∣ ; vector needs b ⋅ b . Get both now.
Step 3. Scalar projection = 2 8 = 4 .
Why this step? Apply ∣ b ∣ a ⋅ b . Positive ⇒ shadow lies along b (acute angle, cell C1).
Step 4. Vector projection = 4 8 ( 2 , 0 ) = 2 ( 2 , 0 ) = ( 4 , 0 ) .
Why this step? Apply b ⋅ b a ⋅ b b . Direction is b 's, length is the shadow.
Verify: ( 4 , 0 ) lies on the x -axis (correct direction), and its length 4 equals the scalar projection. The y -part 3 vanished — exactly the shadow idea. ✓
Worked example Perpendicular: the shadow collapses
a = ( 0 , 5 ) , b = ( 3 , 0 ) . Project a onto b .
Forecast: a points straight up, b straight right — they are perpendicular. A vertical stick under a straight-down sun casts no horizontal shadow. Guess: everything is zero.
Step 1. a ⋅ b = 0 ( 3 ) + 5 ( 0 ) = 0 .
Why this step? A zero dot product is the definition of perpendicular (cos 9 0 ∘ = 0 ).
Step 2. b ⋅ b = 3 2 + 0 2 = 9 , so ∣ b ∣ = 9 = 3 .
Why this step? Even though we suspect a zero answer, write out the denominators explicitly so nothing is hidden: scalar will use ∣ b ∣ = 3 , vector will use b ⋅ b = 9 .
Step 3. Scalar projection = 3 0 = 0 .
Why this step? Length of shadow is genuinely zero.
Step 4. Vector projection = 9 0 ( 3 , 0 ) = ( 0 , 0 ) .
Why this step? Zero length × any direction = the zero vector.
Verify: The perpendicular part a ⊥ = a − 0 = ( 0 , 5 ) = a — i.e. all of a is perpendicular to b , which matches the picture. ✓
Worked example The shadow falls backward
a = ( − 3 , 1 ) , b = ( 4 , 0 ) . Project a onto b .
Forecast: a leans to the left , b points right — the angle between them is obtuse. Guess: a negative scalar, and a vector pointing left. Figure s02 shows this exact case — watch the orange shadow land behind the origin.
Step 1. a ⋅ b = ( − 3 ) ( 4 ) + 1 ( 0 ) = − 12 .
Why this step? A negative dot product means cos θ < 0 , i.e. θ > 9 0 ∘ (cell C3). The sign is already telling the story.
Step 2. b ⋅ b = 4 2 + 0 2 = 16 , so ∣ b ∣ = 16 = 4 .
Why this step? Scalar divides by ∣ b ∣ = 4 ; vector divides by b ⋅ b = 16 .
Step 3. Scalar projection = 4 − 12 = − 3 .
Why this step? The minus encodes "shadow on the back side"; do not drop it.
Step 4. Vector projection = 16 − 12 ( 4 , 0 ) = − 4 3 ( 4 , 0 ) = ( − 3 , 0 ) .
Why this step? Negative scalar × direction ( 4 , 0 ) flips it to point along − x , opposite b .
Verify: ( − 3 , 0 ) points against b and has length 3 = ∣ − 3 ∣ = magnitude of the scalar projection. Sign and picture agree. ✓
b longer must NOT change the answer
a = ( 2 , 3 ) , b = ( 0 , 10 ) . Project onto b , then re-do it with b ′ = ( 0 , 1 ) (same direction, shorter). Do the vector answers match?
Forecast: Both b vectors point straight up. The shadow of a on the vertical direction should be its y -part, ( 0 , 3 ) , regardless of how long we drew b . Guess: identical vector projections.
Step 1 (with b = ( 0 , 10 ) ). a ⋅ b = 2 ( 0 ) + 3 ( 10 ) = 30 , and b ⋅ b = 0 + 100 = 100 .
Why this step? Both grow with b 's length; watch how they cancel.
Step 2. Vector projection = 100 30 ( 0 , 10 ) = 0.3 ( 0 , 10 ) = ( 0 , 3 ) .
Why this step? The b ⋅ b in the denominator kills the extra length from b . This is exactly why we divide by b ⋅ b and not ∣ b ∣ for the vector form.
Step 3 (with b ′ = ( 0 , 1 ) ). a ⋅ b ′ = 3 , b ′ ⋅ b ′ = 1 , projection = 1 3 ( 0 , 1 ) = ( 0 , 3 ) .
Why this step? Confirms scale-independence.
Verify: Both vector projections are ( 0 , 3 ) — exactly the same , so making b ten times longer changed nothing. (The scalar projections also both work out to 3 here, since ∣ b ∣ = 10 with a ⋅ b = 30 gives 30/10 = 3 , and 3/1 = 3 ; both directions are the same, so their measured lengths agree too.) Length-invariance confirmed. ✓
Worked example When the formula breaks
a = ( 5 , 2 ) , b = ( 0 , 0 ) . Project a onto b .
Forecast: b has no length and no direction — there is no line to cast a shadow onto. Guess: undefined.
Step 1. a ⋅ b = 5 ( 0 ) + 2 ( 0 ) = 0 and b ⋅ b = 0 .
Why this step? Look at what the formula demands next.
Step 2. Scalar = ∣ b ∣ 0 = 0 0 and vector = 0 0 b .
Why this step? Division by zero — the expression is undefined , not zero.
Step 3 — the correct statement. The projection does not exist when b = 0 , because "the direction of b " is meaningless. Always demand b = 0 .
Why this step? A zero-length arrow has no unit vector b ^ , so no direction to project onto.
Verify: Try to build b ^ = b /∣ b ∣ = ( 0 , 0 ) /0 — impossible. The whole construction rests on b ^ existing. ✓ (Undefined confirmed.)
0/0 as 0
A right angle gives number / nonzero = 0 (a genuine zero shadow, Ex 2). A zero b gives 0/0 — no answer at all. These look similar but are worlds apart: one has a picture, the other has no line to draw the picture on.
Worked example The OTHER zero case
a = ( 0 , 0 ) , b = ( 3 , 4 ) . Project a onto b .
Forecast: This time b is a perfectly good direction, but a is nothing — a point at the origin. A zero-length stick casts a zero-length shadow. Guess: scalar 0 , vector 0 (and this time it really is defined).
Step 1. a ⋅ b = 0 ( 3 ) + 0 ( 4 ) = 0 .
Why this step? Any dot product with the zero vector is 0 .
Step 2. b ⋅ b = 3 2 + 4 2 = 25 , so ∣ b ∣ = 25 = 5 — a nonzero denominator.
Why this step? Because b = 0 , the division is legal (unlike Ex 5).
Step 3. Scalar = 5 0 = 0 ; vector = 25 0 ( 3 , 4 ) = ( 0 , 0 ) .
Why this step? 0/25 is a genuine zero, not 0/0 . The answer exists and equals the zero vector.
Verify: Contrast with Ex 5: here the denominators 5 and 25 are nonzero, so we divide legally and get a well-defined 0 . Zero input a → zero output; zero direction b → undefined. Two very different degenerate cases. ✓
Worked example Same line, both directions
(a) a = ( 6 , 0 ) , b = ( 2 , 0 ) (same direction, θ = 0 ∘ ).
(b) a = ( 6 , 0 ) , b = ( − 2 , 0 ) (opposite direction, θ = 18 0 ∘ ).
Forecast: a already lies on the line of b . Its shadow should be its whole self, ( 6 , 0 ) , in both cases — because the vector projection lands back on the a line either way. The scalar should flip sign in (b).
Step 1 (a). a ⋅ b = 12 , b ⋅ b = 4 so ∣ b ∣ = 2 . Vector = 4 12 ( 2 , 0 ) = ( 6 , 0 ) . Scalar = 2 12 = 6 .
Why this step? θ = 0 ∘ , cos 0 ∘ = 1 , so scalar = ∣ a ∣ = 6 : the shadow is the full length.
Step 2 (b). a ⋅ b = − 12 , b ⋅ b = 4 so ∣ b ∣ = 2 . Vector = 4 − 12 ( − 2 , 0 ) = ( 6 , 0 ) . Scalar = 2 − 12 = − 6 .
Why this step? θ = 18 0 ∘ , cos 18 0 ∘ = − 1 , so scalar = − ∣ a ∣ = − 6 ; but the negative scalar × negative direction ( − 2 , 0 ) swings the vector back to ( 6 , 0 ) .
Verify: In both cases the vector projection is ( 6 , 0 ) = a (fully recovered, as it must be for a collinear vector). Only the scalar carries the direction sign. ✓
Worked example Splitting a vector into "along" + "perpendicular"
a = ( 3 , 2 , 6 ) , b = ( 0 , 0 , 2 ) . Split a = proj b a + a ⊥ .
Forecast: b points along the z -axis. The parallel part should be a 's height ( 0 , 0 , 6 ) ; the leftover the ground part ( 3 , 2 , 0 ) .
Step 1. a ⋅ b = 3 ( 0 ) + 2 ( 0 ) + 6 ( 2 ) = 12 , b ⋅ b = 0 + 0 + 4 = 4 .
Why this step? Same machinery — dot products don't care about dimension.
Step 2. proj b a = 4 12 ( 0 , 0 , 2 ) = 3 ( 0 , 0 , 2 ) = ( 0 , 0 , 6 ) .
Why this step? The parallel piece — the "height" of a .
Step 3. a ⊥ = a − proj b a = ( 3 , 2 , 6 ) − ( 0 , 0 , 6 ) = ( 3 , 2 , 0 ) .
Why this step? Whatever is left must be perpendicular to b (this is Orthogonal decomposition ; repeated, it powers the Gram-Schmidt process ).
Verify: a ⊥ ⋅ b = 3 ( 0 ) + 2 ( 0 ) + 0 ( 2 ) = 0 ✓ (perpendicular). And ( 0 , 0 , 6 ) + ( 3 , 2 , 0 ) = ( 3 , 2 , 6 ) = a ✓ (pieces reassemble). ✓
Worked example How much force pushes along the slope?
A box on a ramp feels force F = ( 0 , − 10 ) N (gravity, pointing straight down). The ramp direction is b = ( 4 , 3 ) (rightward and up the incline). How much of the force acts along the ramp, and what is the vector along it?
Forecast: Gravity points down, the ramp goes up-right, so gravity's component along b opposes the up-ramp direction — expect a negative scalar (force pulls the box down the slope). Figure s03 draws the box, the down-pointing gravity, and its orange shadow sliding down the ramp. Links to Work done by a force , where W = F ⋅ d is exactly this projection idea.
Step 1. F ⋅ b = 0 ( 4 ) + ( − 10 ) ( 3 ) = − 30 .
Why this step? The dot product is the signed amount of force in b 's direction.
Step 2. b ⋅ b = 4 2 + 3 2 = 25 , so ∣ b ∣ = 25 = 5 .
Why this step? We need ∣ b ∣ for the scalar (in newtons) and b ⋅ b for the vector.
Step 3. Scalar projection = 5 − 30 = − 6 N.
Why this step? 6 N of gravity acts along the ramp line; the minus means it points down the slope, dragging the box down. Units: N (a force), correct.
Step 4. Vector projection = 25 − 30 ( 4 , 3 ) = − 1.2 ( 4 , 3 ) = ( − 4.8 , − 3.6 ) N.
Why this step? Direction points down-and-left along the ramp — the box slides down.
Verify: Magnitude of the vector = ( − 4.8 ) 2 + ( − 3.6 ) 2 = 23.04 + 12.96 = 36 = 6 N, matching the scalar magnitude. Direction ( − 4.8 , − 3.6 ) is − 1.2 × ( 4 , 3 ) : exactly opposite the up-ramp direction. Physically sensible. ✓
Worked example Work backward from a given projection
a = ( t , 4 ) with unknown t . It is given that the scalar projection of a onto b = ( 3 , 0 ) equals 5 . Find t . Then find the value of t that makes the projection zero .
Forecast: The scalar projection onto the x -axis is basically a 's x -part. If it must be 5 , guess t = 5 ; if zero, guess t = 0 .
Step 1. b ⋅ b = 3 2 + 0 2 = 9 , so ∣ b ∣ = 3 . Scalar projection = ∣ b ∣ a ⋅ b = 3 3 t + 0 = t .
Why this step? Express the given quantity in terms of the unknown before solving.
Step 2 (projection = 5 ). Set t = 5 .
Why this step? The equation collapsed to t = 5 directly. Clean.
Step 3 (projection = 0 ). Set t = 0 .
Why this step? A zero projection means a is perpendicular to b ; with b along x , that forces a 's x -part = 0 , i.e. t = 0 , giving a = ( 0 , 4 ) (straight up — perpendicular to the x -axis ✓).
Verify: For t = 5 : a ⋅ b = 3 ( 5 ) = 15 , scalar = 15/3 = 5 ✓. For t = 0 : a ⋅ b = 0 , scalar = 0 ✓, and ( 0 , 4 ) ⊥ ( 3 , 0 ) . ✓
Recall Which cell is which?
Obtuse angle gives what sign of scalar projection? ::: Negative — shadow falls backward.
Projecting onto b = 0 gives? ::: Undefined — no direction, 0/0 .
Projecting the zero vector a = 0 onto a nonzero b gives? ::: The zero vector ( 0 , 0 ) — well-defined, since the denominator b ⋅ b = 0 .
Right-angle projection value? ::: Exactly 0 (a genuine zero, not undefined).
Making b ten times longer changes the vector projection how? ::: Not at all — b ⋅ b cancels the extra length.
Collinear opposite vectors: scalar sign? ::: Negative (cos 18 0 ∘ = − 1 ), but the vector projection still lands on a 's line.
Force ( 0 , − 10 ) along ramp ( 4 , 3 ) : scalar projection? ::: − 6 N (down the slope).
What does comp b a mean in words? ::: The component of a along b — a signed number (length of the shadow).
Mnemonic The sign is a compass
Positive = forward, zero = right-angle, negative = backward, 0/0 = no ramp at all.
right angle C2 zero shadow
obtuse C3 backward shadow
split into parallel plus perp C7