4.5.4Linear Algebra (Full)

Projection of vectors

1,533 words7 min readdifficulty · medium1 backlinks

WHAT we are computing

Figure — Projection of vectors

HOW to derive the formula (from scratch)

We want the number acosθ|\vec a|\cos\theta in terms of coordinates, with no protractor.

Step 1 — Start from the dot product definition. ab=abcosθ\vec a\cdot\vec b = |\vec a|\,|\vec b|\cos\theta Why this step? The dot product is the only tool that already secretly contains cosθ\cos\theta, so it lets us eliminate the angle.

Step 2 — Solve for the shadow length acosθ|\vec a|\cos\theta. Divide both sides by b|\vec b|: acosθ=abb|\vec a|\cos\theta = \frac{\vec a\cdot\vec b}{|\vec b|} Why this step? The left side is exactly the scalar projection. We isolated it.

Step 3 — Turn the length into a vector. Multiply the length by the unit direction b^=b/b\hat b=\vec b/|\vec b|: projba=(abb)bb=abb2b=abbbb\text{proj}_{\vec b}\,\vec a=\Big(\frac{\vec a\cdot\vec b}{|\vec b|}\Big)\frac{\vec b}{|\vec b|}=\frac{\vec a\cdot\vec b}{|\vec b|^2}\,\vec b=\frac{\vec a\cdot\vec b}{\vec b\cdot\vec b}\,\vec b Why this step? A vector = (length) × (direction). We attach the direction b^\hat b to the signed length.

Step 4 — The leftover (orthogonal) part. Whatever of a\vec a is not along b\vec b is perpendicular to it: a=aprojba\vec a_{\perp}=\vec a-\text{proj}_{\vec b}\,\vec a Check: ab=ababbb(bb)=0\vec a_\perp\cdot\vec b = \vec a\cdot\vec b - \frac{\vec a\cdot\vec b}{\vec b\cdot\vec b}(\vec b\cdot\vec b)=0. ✓ So a=projba+a\vec a=\text{proj}_{\vec b}\vec a+\vec a_\perp splits a\vec a into parallel + perpendicular pieces.


WHY the sign matters

cosθ\cos\theta is negative when θ>90\theta>90^\circ. Then the scalar projection is negative, and the vector projection points opposite to b\vec b. That is correct: the shadow falls on the "back" side.


Worked examples


Common mistakes


Recall Feynman: explain to a 12-year-old

Shine a torch straight down on a leaning stick. The flat shadow it makes on the floor tells you "how far the stick reaches in that floor-direction." That shadow's length is the projection. If the stick leans the other way, its shadow points backward — that's the minus sign. To get the length we use a quick multiply-and-add trick (the dot product) instead of measuring angles.


Active recall

Scalar projection of a\vec a onto b\vec b formula?
abb=ab^\dfrac{\vec a\cdot\vec b}{|\vec b|}=\vec a\cdot\hat b
Vector projection of a\vec a onto b\vec b formula?
abbbb\dfrac{\vec a\cdot\vec b}{\vec b\cdot\vec b}\,\vec b
Why does the vector form divide by bb\vec b\cdot\vec b, not b|\vec b|?
One b|\vec b| sets the length, one more makes b\vec b a unit direction b2\Rightarrow |\vec b|^2.
What does a negative scalar projection mean?
The angle is obtuse; the shadow points opposite to b\vec b.
How do you get the part of a\vec a perpendicular to b\vec b?
a=aprojba\vec a_\perp=\vec a-\text{proj}_{\vec b}\vec a
Is projba=projab\text{proj}_{\vec b}\vec a=\text{proj}_{\vec a}\vec b?
No — projection is not symmetric; direction differs.
Projection of (3,4)(3,4) onto the xx-axis (1,0)(1,0)?
(3,0)(3,0), scalar 33.
Which trig function appears in scalar projection and why?
cosθ\cos\theta — it gives the adjacent component along b\vec b.

Connections

  • Dot product — the engine behind projection.
  • Unit vectorsb^\hat b supplies the direction.
  • Orthogonal decomposition — splitting a\vec a into parallel + perpendicular.
  • Gram-Schmidt process — repeated projection to build orthonormal bases.
  • Least squares regression — projecting data onto the column space.
  • Work done by a force — physics application: W=FdW=\vec F\cdot\vec d uses the projection of force along displacement.

Concept Map

eliminates angle

equals

multiply by unit b-hat

equals

subtract from a

orthogonal to b

negative when theta gt 90

affects

motivates

used in

Dot product a.b = |a||b|cos theta

Scalar projection comp_b a

a.b / |b| = a.b-hat

Vector projection proj_b a

a.b / b.b times b

Perpendicular part a_perp

Split a into parallel + perpendicular

cos theta sign

Shadow on back side

Shadow intuition

Least-squares, Fourier, forces on ramp

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Socho suraj seedha upar se chamak raha hai aur ek vector a\vec a apni parchhai (shadow) kisi doosre vector b\vec b ki direction par daal raha hai. Wahi shadow hi projection hai — matlab "a\vec a ka kitna hissa b\vec b ki taraf point kar raha hai". Yeh idea bahut jagah kaam aata hai: ramp par force ka component, least-squares fitting, ya ek vector ko parallel + perpendicular parts mein todna.

Formula yaad rakhne ka shortcut: dot product ke andar pehle se cosθ\cos\theta chhupa hota hai, kyunki ab=abcosθ\vec a\cdot\vec b=|\vec a||\vec b|\cos\theta. Isiliye angle naapne ki zaroorat nahi. Scalar projection =abb=\dfrac{\vec a\cdot\vec b}{|\vec b|} — yeh ek number hai (length with sign). Vector projection =abbbb=\dfrac{\vec a\cdot\vec b}{\vec b\cdot\vec b}\,\vec b — yeh ek vector hai jo b\vec b ke saath align hota hai.

Ek bada confusion: vector wale mein denominator b|\vec b| nahi, balki bb=b2\vec b\cdot\vec b=|\vec b|^2 aata hai. Reason simple hai — ek b|\vec b| length banane mein lagta hai aur doosra b\vec b ko unit direction b^\hat b banane mein. Isiliye mantra: "Scalar mein ek b, vector mein b-squared."

Aur agar θ\theta obtuse ho (90 degree se zyada), to cosθ\cos\theta negative ho jaata hai, matlab shadow ulti taraf girti hai — yeh galti nahi, balki sahi answer hai. Sign ko kabhi mat hatao, warna direction ki information kho jaati hai.

Go deeper — visual, from zero

Test yourself — Linear Algebra (Full)

Connections