Vector Projection Calculator
- Dot product a . b = 2.00 x 1.00 + 3.00 x 2.00 + 6.00 x 2.00 = 20.00.
- Scalar projection = (a . b) / |b| = 20.00 / 3.00 = 6.67 — the signed length of the shadow a casts on b.
- Vector projection = (a . b / |b|^2) x b = 2.2222 x b = (2.22, 4.44, 4.44).
This vector projection calculator computes the projection of vector a onto vector b — the component of a that lies along b, or geometrically the shadow a casts on the line of b. It returns two results. The scalar projection, (a · b) / |b|, is the signed length of that shadow; it is negative when the angle between the vectors is obtuse. The vector projection, ((a · b) / |b|²) × b, is a vector parallel to b. For example, projecting a = (3, 4, 0) onto b = (1, 0, 0) gives the vector (3.00, 0.00, 0.00), confirming that projecting onto a unit axis keeps just that component. Another example: a = (2, 3, 6) onto b = (1, 2, 2) yields a dot product of 20.00, |b| = 3.00, a scalar projection of 6.67, and a vector projection of (2.22, 4.44, 4.44).
The dot-product method used here is the accepted standard because it decomposes any vector into a part parallel to b and a part perpendicular to b using only multiplication and addition. The leftover part of a, after subtracting the projection, is perpendicular to b — the basis of Gram-Schmidt orthogonalisation and of work calculations in physics. This page shows the formula, step-by-step workings, worked examples, and sources so you can verify every result. A third example illustrates a case with a zero component: a = (5, -1, 2) onto b = (0, 3, 4) gives a dot product of 5.00, a scalar projection of 1.00, and a vector projection of (0.00, 0.60, 0.80).
Worked examples
Projection onto the x-axis
Primary result: (3.00, 0.00, 0.00) — projecting onto a unit axis simply keeps the x component. (3 · 4 · 0 · 1 · 0 · 0)
| Vector projection of a onto b | (3.00, 0.00, 0.00) |
| Scalar projection (signed length) | 3.00 |
| Dot product a . b | 3.00 |
| Magnitude of b | 1.00 |
A textbook 3D example
Primary result: (2.22, 4.44, 4.44) — dot product 20.00 over a b of length 3.00 gives a scalar projection of 6.67. (2 · 3 · 6 · 1 · 2 · 2)
| Vector projection of a onto b | (2.22, 4.44, 4.44) |
| Scalar projection (signed length) | 6.67 |
| Dot product a . b | 20.00 |
| Magnitude of b | 3.00 |
A short shadow
Primary result: (0.00, 0.60, 0.80) — a dot product of just 5.00 means a casts only a unit-length shadow on b. (5 · -1 · 2 · 0 · 3 · 4)
| Vector projection of a onto b | (0.00, 0.60, 0.80) |
| Scalar projection (signed length) | 1.00 |
| Dot product a . b | 5.00 |
| Magnitude of b | 5.00 |
Shadows and components: the idea
Picture a flat surface and a stick held above it. When light shines straight down, the stick casts a shadow across the surface. That shadow is the simplest way to understand what a vector projection calculator computes. If you treat vector b as the direction of the surface, then the projection of vector a onto b is the shadow a casts along the line of b. It captures how much of a runs in the same direction as b, and nothing else.
The same idea shows up wherever a force or movement needs to be split into useful and unused parts. Think of pushing a cart along a track: only the part of your push that points along the track does any real work. The sideways push is wasted. The shadow along the track is the component that matters. A vector projection calculator isolates that component so you can see exactly how much of one vector acts along another.
There are two related results to keep straight. The scalar projection is the signed length of that shadow, calculated as (a · b) / |b|. It is negative when the angle between the vectors is obtuse, meaning a points partly backward relative to b. The vector projection is the shadow written as a full vector, parallel to b, calculated as ((a · b) / |b|²) × b. The scalar tells you how long the shadow is; the vector tells you where the shadow actually sits along b.
What remains after you subtract the projection from a is the part of a that is perpendicular to b. This leftover is the sideways push in the cart example, and it is the foundation of Gram-Schmidt orthogonalisation in linear algebra and of work calculations in physics. A few concrete results make the pattern clear. Projecting a = (3, 4, 0) onto b = (1, 0, 0) gives the vector (3.00, 0.00, 0.00): projecting onto a unit axis keeps just that component. For a = (2, 3, 6) onto b = (1, 2, 2), the dot product is 20.00, |b| = 3.00, the scalar projection is 6.67, and the vector projection is (2.22, 4.44, 4.44). For a = (5, -1, 2) onto b = (0, 3, 4), the dot product is 5.00, the scalar projection is 1.00, and the vector projection is (0.00, 0.60, 0.80).
The two formulas
The projection of vector a onto vector b is the component of a that lies along b — geometrically, the shadow a casts on the line of b. To find it, start with the dot product a · b, which encodes how much of a points in the direction of b. The scalar projection, also called the component of a in the direction of b, is obtained by dividing that dot product by the length of b: scalar projection = (a · b) / |b|. This gives the signed length of the shadow; it is negative when the angle between the vectors is obtuse, meaning a points partly against b.
To turn that signed length into a full vector, you need a direction as well as a magnitude. The direction is simply that of b itself, so the vector projection scales b by the scalar projection relative to the length of b. The formula becomes: vector projection = ((a · b) / |b|²) × b, a vector parallel to b. Note the denominator: the scalar projection divides by |b|, while the vector projection divides by |b|². The extra factor of |b| in the denominator cancels the length of b when multiplying by b, leaving a result whose magnitude equals the scalar projection and whose direction matches b.
A quick example shows why this matters. Project a = (3, 4, 0) onto b = (1, 0, 0): the dot product is 3, |b| is 1, and the vector projection is (3.00, 0.00, 0.00). Projecting onto a unit axis keeps just that component. A richer case is a = (2, 3, 6) onto b = (1, 2, 2): the dot product is 20.00, |b| is 3.00, the scalar projection is 6.67, and the vector projection is (2.22, 4.44, 4.44). A third example: a = (5, -1, 2) onto b = (0, 3, 4) gives a dot product of 5.00, a scalar projection of 1.00, and a vector projection of (0.00, 0.60, 0.80). A vector projection calculator handles these steps so you do not mix up the denominators.
The part of a left over after subtracting the projection is perpendicular to b — the basis of Gram-Schmidt orthogonalisation and of work calculations in physics. This perpendicular remainder is what lets you decompose any vector into components along and across a given direction, which is why the two formulas appear throughout linear algebra, mechanics, and engineering.
The worked examples
The clearest way to understand what a vector projection calculator does is to walk through the arithmetic. In each example below, the scalar projection uses the formula (a · b) / |b|, which gives the signed length of the shadow a casts on the line of b. The vector projection uses ((a · b) / |b|²) × b, producing a vector parallel to b. That vector is the component of a lying along b.
Example 1 is a special case that shows the rule in its simplest form. Project a = (3, 4, 0) onto b = (1, 0, 0). Because b is a unit vector along the x-axis, |b| = 1, so the formulas collapse: the scalar projection is just a · b = 3, and the vector projection is just 3 × (1, 0, 0) = (3, 0, 0). Projecting onto a unit axis keeps just that component and discards the rest. The result is (3.00, 0.00, 0.00).
Example 2 uses a = (2, 3, 6) onto b = (1, 2, 2). The dot product a · b = (2)(1) + (3)(2) + (6)(2) = 2 + 6 + 12 = 20.00, and |b| = √(1 + 4 + 4) = 3.00. The scalar projection is 20.00 / 3.00 = 6.67, the signed length of the shadow. The vector projection is (20.00 / 9.00) × (1, 2, 2) = 2.22 × (1, 2, 2) = (2.22, 4.44, 4.44). The part of a left over after subtracting this projection is perpendicular to b, the same principle behind Gram-Schmidt orthogonalisation and work calculations in physics.
Example 3 uses a = (5, -1, 2) onto b = (0, 3, 4). The dot product a · b = (5)(0) + (-1)(3) + (2)(4) = 0 - 3 + 8 = 5.00, and |b| = √(0 + 9 + 16) = 5.00. The scalar projection is 5.00 / 5.00 = 1.00. The vector projection is (5.00 / 25.00) × (0, 3, 4) = 0.20 × (0, 3, 4) = (0.00, 0.60, 0.80). Here the projection points along b with no x-component, because b itself has no x-component.
| a | b | a · b | |b| | Scalar projection | Vector projection |
|---|---|---|---|---|---|
| (3, 4, 0) | (1, 0, 0) | 3.00 | 1.00 | 3.00 | (3.00, 0.00, 0.00) |
| (2, 3, 6) | (1, 2, 2) | 20.00 | 3.00 | 6.67 | (2.22, 4.44, 4.44) |
| (5, -1, 2) | (0, 3, 4) | 5.00 | 5.00 | 1.00 | (0.00, 0.60, 0.80) |
Where projections appear next
The same projection you compute with a vector projection calculator shows up across linear algebra and physics, wearing different labels but doing identical work underneath. The core idea never changes: take a vector, keep only the part that runs along a chosen direction, and set the rest aside. That leftover part — the piece of a left over after subtracting the projection — is always perpendicular to b. This single geometric fact drives both Gram-Schmidt orthogonalisation and the way work is calculated in mechanics.
In Gram-Schmidt, you build an orthogonal set by repeatedly projecting each new vector onto the ones you already have, then subtracting those projections. What remains is perpendicular to every previous vector, so the set stays mutually orthogonal. Each subtraction step is exactly the vector projection formula in disguise: compute ((a . b) / |b|^2) times b, take it away from a, and move on. The scalar projection, (a . b) / |b|, gives the signed length you are trimming off — negative when the angle between the vectors is obtuse, which tells you the shadow falls on the far side of b.
Least-squares solutions rely on the same geometry. When a system has no exact answer, the best fit comes from projecting the data onto the column space of the matrix. The residual — what does not fit — lands perpendicular to that space, just as the leftover part of a stands perpendicular to b after projection. A vector projection calculator handles the arithmetic for small cases, and the same formula scales up to the matrix algebra behind regression and curve fitting.
In physics, work is the scalar projection of a force vector onto a displacement vector. If a force acts at an angle to the motion, only the component along the displacement does work; everything perpendicular contributes nothing. The same logic resolves forces on inclined planes and in statics: split each force into a part along a chosen axis and a part perpendicular to it, then analyse them separately. The worked example a = (3, 4, 0) onto b = (1, 0, 0) gives the vector (3.00, 0.00, 0.00), which is precisely what happens when you keep only the x-component of a force. Project a = (2, 3, 6) onto b = (1, 2, 2) and you get a dot product of 20.00, |b| = 3.00, a scalar projection of 6.67, and a vector projection of (2.22, 4.44, 4.44) — the full component of a running along b. The example a = (5, -1, 2) onto b = (0, 3, 4) gives a dot product of 5.00, a scalar projection of 1.00, and a vector projection of (0.00, 0.60, 0.80), showing how a vector mostly perpendicular to b still casts a small shadow along it.
FAQs
What is the difference between scalar and vector projection?
The scalar projection is a signed length; the vector projection is that length expressed as a vector along b. The scalar gives a single number showing magnitude and direction relative to b, while the vector projection includes both the length and the specific direction along b.
What does a negative scalar projection mean?
The angle between a and b is greater than 90 degrees, so the shadow points opposite to b. This means the projection extends in the direction away from b rather than along it, indicating the vectors are oriented more against each other than with each other.
What if b is a unit vector?
Then |b| = 1 and the formulas simplify: the vector projection is just (a . b) x b. Since the magnitude of b equals one, the denominator drops out, making the calculation straightforward. The dot product of a and b directly gives the scalar projection.
How is projection used in physics?
Work is the projection of force onto displacement; weight components on a slope are projections onto the slope directions. These applications show how projection isolates the relevant portion of a vector along a specific direction, simplifying calculations involving forces and motion.
What is the component left over called?
The orthogonal (perpendicular) component: a minus its projection onto b, which is perpendicular to b. After removing the projection along b, what remains is the part of a that stands at a right angle to b, completing the decomposition of a into two perpendicular vectors.
Can you project onto the zero vector?
No — the zero vector has no direction, so the projection is undefined. Since projection requires a direction along which to cast the shadow, the zero vector cannot serve as a target. Any formula involving division by the magnitude of b would fail.