Vector Projection Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter vectors a and b (z = 0 for 2D) to get the projection of a onto b and the part of a that is perpendicular to b.
Result
Vector projection proj_b a: x
Vector projection proj_b a: y
- Vector projection proj_b a: z
- Dot product a · b
- |b|²
- Scalar projection a · b ÷ |b|
- Perpendicular part a − proj_b a: x
- Perpendicular part a − proj_b a: y
- Perpendicular part a − proj_b a: z
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- a: x component: enter a number.
- a: y component: enter a number.
- a: z component (0 for 2D): enter a number.
- b: x component: enter a number.
- b: y component: enter a number.
- b: z component (0 for 2D): enter a number.
- Read the result: Vector projection proj_b a: x; the panel also shows Dot product a · b, |b|², Scalar projection a · b ÷ |b|, Vector projection proj_b a: y, Vector projection proj_b a: z, Perpendicular part a − proj_b a: x, Perpendicular part a − proj_b a: y and Perpendicular part a − proj_b a: z.
How this calculator works
The vector projection of a onto a nonzero vector b is proj_b a = (a · b ÷ |b|²) b, where a · b = aₓbₓ + a_yb_y + a_zb_z. Its signed length is the scalar projection a · b ÷ |b|, negative when the angle between a and b is more than 90°.
The rest of a, a − proj_b a, is perpendicular to b (its dot product with b is 0). Together they split a into a part along b and a part across it, as in the Gram–Schmidt process. Projection onto the zero vector is undefined and shows dashes.
The formula
| Symbol | Meaning |
|---|---|
| a: x component | |
| a: y component | |
| a: z component (0 for 2D) | |
| b: x component | |
| b: y component | |
| b: z component (0 for 2D) | |
| Dot product a · b | |
| |b|² | |
| Vector projection proj_b a: x |
Worked example
| a: x component | 1 |
|---|---|
| a: y component | 2 |
| a: z component (0 for 2D) | 3 |
| b: x component | 4 |
| b: y component | 5 |
| b: z component (0 for 2D) | 6 |
| Dot product a · b | 32 |
|---|---|
| Scalar projection a · b ÷ |b| | 3.6467 |
| Vector projection proj_b a: y | 2.0779 |
| Vector projection proj_b a: z | 2.4935 |
| Perpendicular part a − proj_b a: x | -0.6623 |
| Perpendicular part a − proj_b a: y | -0.0779 |
| Perpendicular part a − proj_b a: z | 0.5065 |
Vector projection proj_b a: x 1.6623
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is the projection of (3, 4) onto the x-axis (1, 0)?
(3, 0). The scalar projection is 3 and the perpendicular part is (0, 4).
What is the projection of (1, 2, 3) onto (4, 5, 6)?
a · b = 32 and |b|² = 77, so proj = (32/77)(4, 5, 6) ≈ (1.6623, 2.0779, 2.4935).