Vector Projections
Vector projections measure how much of one vector points along another. The scalar projection of b onto a is (a · b) ÷ ‖a‖, the signed length of b’s “shadow” on a. The vector projection is ((a · b) ÷ ‖a‖²) a, the shadow itself as a vector. Together they split b into parts parallel and perpendicular to a.
Before this lesson: Vectors in 3D and Dot Product
What a projection means
Picture light shining straight down onto the line that contains a. The shadow that b casts on that line is the vector projection of b onto a, written proj_a b. Its signed length is the scalar projection, written comp_a b (also called the component of b along a).
The leftover piece, b − proj_a b, runs from the tip of the shadow up to the tip of b. It is perpendicular to a. So every vector b can be written as a part parallel to a plus a part perpendicular to a.
The scalar projection is positive when the angle between a and b is less than 90°, zero when they are perpendicular, and negative when the angle is more than 90°, because then the shadow points opposite a.
Vector projection formulas
\operatorname{comp}_{\mathbf{a}} \mathbf{b} = \dfrac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\|}\operatorname{proj}_{\mathbf{a}} \mathbf{b} = \dfrac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{a}\|^2} \, \mathbf{a}\mathbf{b}_{\perp} = \mathbf{b} - \operatorname{proj}_{\mathbf{a}} \mathbf{b}- The scalar projection is a number; the vector projection is a vector that points along a (or opposite a).
- The vector projection divides by ‖a‖² because it multiplies by a, which has length ‖a‖. Dividing by ‖a‖ twice makes the result not depend on how long a is.
- If u is a unit vector, the formulas simplify to comp_u b = u · b and proj_u b = (u · b)u.
- The perpendicular part b⊥ satisfies b⊥ · a = 0.
Vector projection examples
Example 1: Scalar and vector projection
Let a = ⟨2, 1, 2⟩ and b = ⟨3, 3, 6⟩. Find comp_a b and proj_a b.
\mathbf{a} \cdot \mathbf{b} = 2 \cdot 3 + 1 \cdot 3 + 2 \cdot 6Multiply matching components (see dot product).
= 6 + 3 + 12
Multiply.
= 21
Add.
\|\mathbf{a}\| = \sqrt{4 + 1 + 4} = \sqrt{9} = 3Find the magnitude of a (see vectors in 3D).
\operatorname{comp}_{\mathbf{a}} \mathbf{b} = \dfrac{21}{3} = 7Divide the dot product by ‖a‖.
\operatorname{proj}_{\mathbf{a}} \mathbf{b} = \dfrac{21}{9} \langle 2, 1, 2 \rangleDivide the dot product by ‖a‖² = 9 and multiply by a.
= \dfrac{7}{3} \langle 2, 1, 2 \rangleReduce the fraction.
= \left\langle \dfrac{14}{3}, \dfrac{7}{3}, \dfrac{14}{3} \right\rangleMultiply each component by 7/3.
Answer: comp_a b = 7 and proj_a b = ⟨14/3, 7/3, 14/3⟩. Check: the length of the projection is (7/3) · 3 = 7, the scalar projection.
Example 2: Parallel and perpendicular parts
Use Example 1 to write b = ⟨3, 3, 6⟩ as a part parallel to a plus a part perpendicular to a.
\mathbf{b}_{\perp} = \left\langle 3 - \dfrac{14}{3}, \; 3 - \dfrac{7}{3}, \; 6 - \dfrac{14}{3} \right\rangleSubtract the projection from b.
= \left\langle -\dfrac{5}{3}, \dfrac{2}{3}, \dfrac{4}{3} \right\rangleSubtract each component (see adding and subtracting fractions).
2 \cdot \left(-\dfrac{5}{3}\right) + 1 \cdot \dfrac{2}{3} + 2 \cdot \dfrac{4}{3} = -\dfrac{10}{3} + \dfrac{2}{3} + \dfrac{8}{3}Check: dot with a. Multiply.
= 0
Add.
Answer: b = ⟨14/3, 7/3, 14/3⟩ + ⟨−5/3, 2/3, 4/3⟩. The first part is parallel to a, and the second is perpendicular to a because its dot product with a is 0.
Example 3: A negative scalar projection
Find comp_a b and proj_a b for a = ⟨3, −4, 0⟩ and b = ⟨−2, 1, 7⟩.
\mathbf{a} \cdot \mathbf{b} = 3 \cdot (-2) + (-4) \cdot 1 + 0 \cdot 7Multiply matching components.
= -6 - 4 + 0
Multiply.
= -10
Add.
\|\mathbf{a}\| = \sqrt{9 + 16 + 0} = \sqrt{25} = 5Find the magnitude of a.
\operatorname{comp}_{\mathbf{a}} \mathbf{b} = \dfrac{-10}{5} = -2Divide the dot product by ‖a‖.
\operatorname{proj}_{\mathbf{a}} \mathbf{b} = \dfrac{-10}{25} \langle 3, -4, 0 \rangleDivide by ‖a‖² = 25 and multiply by a.
= -\dfrac{2}{5} \langle 3, -4, 0 \rangleReduce the fraction.
= \left\langle -\dfrac{6}{5}, \dfrac{8}{5}, 0 \right\rangleMultiply each component by −2/5.
Answer: comp_a b = −2 and proj_a b = ⟨−6/5, 8/5, 0⟩. The negative sign means the angle between a and b is more than 90°, so the shadow points opposite a.
Example 4: Distance from a point to a line
Find the distance from the point Q(4, 1, 3) to the line through the origin in the direction d = ⟨1, 2, 2⟩.
\mathbf{q} \cdot \mathbf{d} = 4 \cdot 1 + 1 \cdot 2 + 3 \cdot 2 = 4 + 2 + 6Let q = ⟨4, 1, 3⟩. Multiply matching components.
= 12
Add.
\|\mathbf{d}\|^2 = 1 + 4 + 4 = 9Square the magnitude of d.
\operatorname{proj}_{\mathbf{d}} \mathbf{q} = \dfrac{12}{9} \langle 1, 2, 2 \rangle = \left\langle \dfrac{4}{3}, \dfrac{8}{3}, \dfrac{8}{3} \right\rangleMultiply d by 12/9 = 4/3.
\mathbf{q}_{\perp} = \left\langle 4 - \dfrac{4}{3}, \; 1 - \dfrac{8}{3}, \; 3 - \dfrac{8}{3} \right\rangleSubtract the projection from q.
= \left\langle \dfrac{8}{3}, -\dfrac{5}{3}, \dfrac{1}{3} \right\rangleSubtract each component.
\|\mathbf{q}_{\perp}\| = \dfrac{\sqrt{64 + 25 + 1}}{3}Find the magnitude; factor out the 1/3.
= \dfrac{\sqrt{90}}{3}Add.
= \dfrac{3\sqrt{10}}{3} = \sqrt{10} \approx 3.16Simplify the root (see simplifying square roots).
Answer: the distance is √10 ≈ 3.16. The perpendicular part is the shortest path from Q to the line.
Example 5: Pushing a cart up a ramp (word problem)
A cart moves 10 meters up a straight ramp in the direction d = ⟨4, 0, 3⟩. A rope pulls it with force F = ⟨10, 4, 8⟩ newtons. How much of the force acts along the ramp, and how much work does it do?
\mathbf{F} \cdot \mathbf{d} = 10 \cdot 4 + 4 \cdot 0 + 8 \cdot 3 = 40 + 0 + 24Multiply matching components.
= 64
Add.
\|\mathbf{d}\| = \sqrt{16 + 0 + 9} = \sqrt{25} = 5Find the magnitude of d.
\operatorname{comp}_{\mathbf{d}} \mathbf{F} = \dfrac{64}{5} = 12.8Divide the dot product by ‖d‖.
W = 12.8 \cdot 10 = 128
Multiply the force along the ramp by the distance.
Answer: 12.8 N of the force acts along the ramp, and the rope does 128 joules of work. The rest of the force is perpendicular to the ramp and does no work.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Dividing by ‖a‖ in the vector projection | proj_a b = (21/3)⟨2, 1, 2⟩ = ⟨14, 7, 14⟩ | Divide by ‖a‖² = 9: (21/9)⟨2, 1, 2⟩ = ⟨14/3, 7/3, 14/3⟩. |
| Projecting onto the wrong vector | Using ‖b‖ in the denominator of comp_a b | Divide by the length of the vector you project onto (a). |
| Dropping a negative sign | comp_a b = 2 in Example 3 | Keep the sign: −10 ÷ 5 = −2. |
| Mixing up the scalar and vector answers | proj_a b = 7 | The vector projection is a vector; 7 is the scalar projection. |
| Forgetting to multiply by a | proj_a b = 21/9 | Multiply the number 21/9 by the vector a. |
Related methods
Work as a dot product
The work done by a constant force F over a displacement D is W = F · D. In Example 5, D = 10 · (d ÷ ‖d‖) = ⟨8, 0, 6⟩, and F · D = 80 + 0 + 48 = 128 joules, the same answer. The dot product does the projection for you.
Projections in the plane
The same formulas work for 2D vectors with two components. For other uses of the dot product in the plane, such as angles between vectors, see the Precalculus lesson. The next lessons use projections and the cross product to find distances to lines and planes.
Practice problems
- Find comp_a b for a = ⟨0, 3, 4⟩ and b = ⟨2, 5, −5⟩.
- Find proj_a b for the vectors in Problem 1.
- Find proj_a b and comp_a b for a = ⟨1, 1, 1⟩ and b = ⟨2, −1, 5⟩.
- For Problem 3, find the part of b perpendicular to a and check it.
- Find the projection of ⟨5, 2, −3⟩ onto k = ⟨0, 0, 1⟩.
- Find proj_a b for a = ⟨2, −1, 3⟩ and b = ⟨1, 5, 1⟩.
- Find comp_a b for a = ⟨6, 2, −3⟩ and b = ⟨1, 4, 2⟩.
- Find the distance from Q(4, 4, 5) to the line through the origin in the direction ⟨2, 2, 1⟩.
- For a = ⟨3, 0, 0⟩ and b = ⟨1, 1, 0⟩, compare comp_a b with comp_b a.
- A wind force F = ⟨12, −5, 0⟩ N pushes a cart along a track in the direction ⟨3, 4, 0⟩. Find the force along the track and the work done over 50 m.
Show answers
1.
0 \cdot 2 + 3 \cdot 5 + 4 \cdot (-5) = 0 + 15 - 20
Multiply matching components.
= -5
Add.
\sqrt{0 + 9 + 16} = \sqrt{25} = 5Find ‖a‖.
\dfrac{-5}{5} = -1Divide by ‖a‖.
Answer: −1
2.
\dfrac{-5}{25} \langle 0, 3, 4 \rangle = -\dfrac{1}{5} \langle 0, 3, 4 \rangleDivide a · b = −5 by ‖a‖² = 25 and reduce.
= \left\langle 0, -\dfrac{3}{5}, -\dfrac{4}{5} \right\rangleMultiply each component.
Answer: ⟨0, −3/5, −4/5⟩
3.
1 \cdot 2 + 1 \cdot (-1) + 1 \cdot 5 = 6
Find a · b.
1 + 1 + 1 = 3
Find ‖a‖².
\dfrac{6}{3} \langle 1, 1, 1 \rangle = \langle 2, 2, 2 \rangleMultiply a by 6/3 = 2.
\dfrac{6}{\sqrt{3}} = 2\sqrt{3} \approx 3.46Divide a · b by ‖a‖ = √3 and rationalize (see rationalizing the denominator).
Answer: proj_a b = ⟨2, 2, 2⟩, comp_a b = 2√3 ≈ 3.46
4.
\langle 2 - 2, \; -1 - 2, \; 5 - 2 \rangle = \langle 0, -3, 3 \rangle
Subtract the projection from b.
1 \cdot 0 + 1 \cdot (-3) + 1 \cdot 3 = 0
Check: dot with a.
Answer: ⟨0, −3, 3⟩, which is perpendicular to a
5.
5 \cdot 0 + 2 \cdot 0 + (-3) \cdot 1 = -3
k is a unit vector, so comp = b · k.
-3 \langle 0, 0, 1 \rangle = \langle 0, 0, -3 \rangle
Multiply k by −3.
Answer: ⟨0, 0, −3⟩
6.
2 \cdot 1 + (-1) \cdot 5 + 3 \cdot 1 = 2 - 5 + 3
Multiply matching components.
= 0
Add.
Answer: ⟨0, 0, 0⟩. The vectors are perpendicular, so b casts no shadow on a.
7.
6 \cdot 1 + 2 \cdot 4 + (-3) \cdot 2 = 6 + 8 - 6
Multiply matching components.
= 8
Add.
\sqrt{36 + 4 + 9} = \sqrt{49} = 7Find ‖a‖.
\dfrac{8}{7} \approx 1.14Divide by ‖a‖.
Answer: 8/7 ≈ 1.14
8.
4 \cdot 2 + 4 \cdot 2 + 5 \cdot 1 = 8 + 8 + 5
Let q = ⟨4, 4, 5⟩. Multiply matching components.
= 21
Add.
\dfrac{21}{9} \langle 2, 2, 1 \rangle = \left\langle \dfrac{14}{3}, \dfrac{14}{3}, \dfrac{7}{3} \right\rangleDivide by ‖d‖² = 9 and multiply by d.
\left\langle 4 - \dfrac{14}{3}, \; 4 - \dfrac{14}{3}, \; 5 - \dfrac{7}{3} \right\rangle = \left\langle -\dfrac{2}{3}, -\dfrac{2}{3}, \dfrac{8}{3} \right\rangleSubtract the projection from q.
\dfrac{\sqrt{4 + 4 + 64}}{3} = \dfrac{\sqrt{72}}{3}Find the magnitude.
= \dfrac{6\sqrt{2}}{3} = 2\sqrt{2} \approx 2.83Simplify.
Answer: 2√2 ≈ 2.83
9.
3 \cdot 1 + 0 \cdot 1 + 0 \cdot 0 = 3
Find a · b.
\dfrac{3}{3} = 1comp_a b: divide by ‖a‖ = 3.
\dfrac{3}{\sqrt{2}} \approx 2.12comp_b a: divide by ‖b‖ = √2.
Answer: comp_a b = 1 but comp_b a ≈ 2.12. They are equal only when ‖a‖ = ‖b‖ or a · b = 0.
10.
12 \cdot 3 + (-5) \cdot 4 + 0 \cdot 0 = 36 - 20
Multiply matching components.
= 16
Add.
\dfrac{16}{5} = 3.2Divide by the length of ⟨3, 4, 0⟩, which is 5.
3.2 \cdot 50 = 160
Multiply by the distance.
Answer: 3.2 N along the track and 160 J of work
Vector projections FAQ
What is the difference between scalar and vector projection?
The scalar projection comp_a b is a number: the signed length of b’s shadow on a. The vector projection proj_a b is a vector along a with that length, equal to the scalar projection times the unit vector a ÷ ‖a‖.
How do you find the projection of one vector onto another?
Find the dot product a · b and the squared length ‖a‖². Then proj_a b = (a · b ÷ ‖a‖²) a.
Can a scalar projection be negative?
Yes. It is negative when the angle between the vectors is more than 90°, which means the shadow points in the opposite direction from a.
What is the orthogonal component of a vector?
It is b − proj_a b, the part of b perpendicular to a. Its length is the distance from the tip of b to the line along a.
Summary
- Scalar projection: comp_a b = (a · b) ÷ ‖a‖, a signed length.
- Vector projection: proj_a b = ((a · b) ÷ ‖a‖²) a, a vector along a.
- b = proj_a b + (b − proj_a b) splits b into parts parallel and perpendicular to a.
- The perpendicular part gives the distance from a point to a line.
- Work along a path uses the component of the force along that path.
Previous lesson: Cross Product
Next lesson: Equations of Lines in 3D
Back to the Calculus 3 Index