Lelifi·tools

Vector Projection Calculator

Projecting v = (3, 4, 0) onto u = (1, 2, 0) gives (2.2, 4.4, 0) with a scalar projection of 4.9193. Both come from proj = ((u dot v) / |u|^2) u = (11/5) u. Enter your two vectors and the calculator returns the dot product, both projections, the angle and the perpendicular piece that remains.

Enter two vectors and get the scalar projection, the vector projection and the perpendicular leftover, with every step shown.

By the Lelifi editors ·

Key takeaways

Projecting v = (3, 4) onto u = (1, 2)v (3, 4)line of u (1, 2)proj (2.2, 4.4)leftover (0.8, -0.4)The dashed piece is perpendicular to the line of u: comp = 4.9193, leftover length = 0.8944.
v = (3, 4, 0) splits into a projection of (2.2, 4.4, 0) along u = (1, 2, 0) and a perpendicular leftover of length 0.8944.
The sign of the projection follows cos(angle), with |v| = 5 in all three panelsvuangle 60 degreescomp = 2.5vuangle 90 degreescomp = 0vuangle 120 degreescomp = -2.5The dashed drop stays perpendicular to u in every panel; only the foot on the u line moves.
With |v| = 5 the scalar projection is 5 cos(angle): 2.5 at 60 degrees, 0 at 90 degrees, and -2.5 at 120 degrees, so the sign alone tells you which side of u the vector leans toward.
On this page
  1. What projecting a vector onto another vector means
  2. The two projection formulas
  3. Worked example: the share of a force that does work
  4. A table of worked projections
  5. What the sign and the angle tell you
  6. Traps that skew a projection
  7. Neighboring tools for the rest of the vector work

What projecting a vector onto another vector means

Picture a ramp with a crate on it. You push the crate with a force that points partly forward and partly down, but only the forward share of that force moves the crate along the ramp. Vector projection is the math that isolates that share: it answers the question of how much of one vector lies in the direction of another, and it returns the answer both as a signed length and as a full vector sitting along the target direction.

Geometry gives the cleanest definition. Drop a perpendicular from the tip of vector v down to the line that runs through vector u. The foot of that perpendicular marks the projection: a point on the line of u such that the piece you chopped off v is exactly at a right angle to u. Because the leftover piece is perpendicular, nothing of it points along u, which is why the projection is the whole contribution of v in that direction. MIT OpenCourseWare develops this picture in its linear algebra text and shows the projection as the vector on the u line whose length is the length of v multiplied by the cosine of the angle between the two vectors.

The idea splits into two related quantities that people often mix up. The scalar projection, also called the component of v along u, is a single signed number: how long the shadow is, negative if v points against u. The vector projection is the shadow itself, a vector that points along u and has that signed length. This page's calculator returns both, along with the perpendicular piece that remains once the shadow is removed.

The two projection formulas

Both quantities come from the dot product. For a vector v projected onto a vector u, the scalar projection is compuv = (u dot v) / |u|, and the vector projection is projuv = ((u dot v) / |u|2) u. Dividing by |u|2 instead of |u| converts the signed length into the scalar that multiplies u itself, so the result lands on the line of u automatically. OpenStax Calculus Volume 3, section 2.3 lists both forms as its standard definitions.

Work the first example with whole numbers you can check by hand. Take v = (3, 4, 0) and u = (1, 2, 0). The dot product is 1 x 3 + 2 x 4 + 0 x 0 = 11. The squared length of u is 1 + 4 = 5, and the length of u is 2.2361. The scalar projection is 11 / 2.2361 = 4.9193, and the vector projection is (11/5) x (1, 2, 0) = (2.2, 4.4, 0). Subtracting the projection from v leaves (0.8, -0.4, 0), a leftover of length 0.8944 that is perpendicular to u, which you can confirm because its dot product with u is 0.8 - 0.8 = 0.

Three checks catch most arithmetic slips. The projection must be a scalar multiple of u, the leftover v minus proj must have a dot product of zero with u, and the Pythagorean relation |v|2 = |proj|2 + |leftover|2 must hold. Here |v| = 5, and indeed 5 x 5 = 4.91932 + 0.89442 = 24.2 + 0.8 = 25.

Worked example: the share of a force that does work

Projection earns its keep in physics the moment a force and a motion point in different directions. Suppose a cable pulls a sled with a force of F = (50, 20, 0) newtons while the sled moves along a displacement of s = (6, 8, 0) meters. The work done by the force is the dot product F dot s = 50 x 6 + 20 x 8 = 460 joules, but the question a designer usually asks is different: what force acts along the direction of travel?

Project F onto s. The squared length of s is 36 + 64 = 100, so the scalar multiplier is 460 / 100 = 4.6, and the vector projection is 4.6 x (6, 8, 0) = (27.6, 36.8, 0) newtons. The scalar projection, the signed length of that vector, is 460 / 10 = 46 newtons, since |s| = 10 meters. Only that 46 newton share of the pull pushes the sled along its path; the perpendicular leftover, 22.4 and -16.8 components summing to 28 newtons, does no work at all because it is perpendicular to the motion.

Laid out line by line, the arithmetic looks like this, and each row is the input to the next one:

QuantityWorkingValue
Force dot displacement50 x 6 + 20 x 8460 J
Squared length of s36 + 64100 m squared
Scalar multiplier460 / 1004.6
Vector projection4.6 x (6, 8, 0)(27.6, 36.8, 0) N
Scalar projection460 / 1046 N
Perpendicular leftover(50, 20, 0) minus (27.6, 36.8, 0)(22.4, -16.8, 0) N
Length of the leftoversquare root of 78428 N
Angle between F and sarccos(46 / 53.852)31.3 degrees

The same projection also hands you the angle for free. The scalar projection equals |F| times the cosine of the angle between the vectors, so cos(angle) = 46 / |F|. The length of F is 50 x 50 + 20 x 20 = 2900 under a square root, about 53.852 newtons, giving cos(angle) = 46 / 53.852 = 0.8542, which is an angle of about 31.3 degrees. If a textbook answer disagrees with that angle, the error is almost always in the dot product, not in the cosine step.

A table of worked projections

The table collects projections the way they show up on homework and on the job, computed with the same two formulas above. Each row is a vector v projected onto a vector u, with the scalar projection and the resulting vector. The last two rows show the special cases worth recognizing on sight: a perpendicular pair projects to zero, and a vector that points against u projects to a negative multiple.

vuu dot vcompuvprojuv
(3, 4, 0)(1, 2, 0)114.919(2.20, 4.40, 0)
(5, 0, 0)(1, 1, 0)53.536(2.50, 2.50, 0)
(1, 3, 1)(2, 1, 2)72.333(1.56, 0.78, 1.56)
(0, 5, 0)(3, 0, 0)00(0, 0, 0)
(-2, 1, 0)(1, 0, 0)-2-2(-2, 0, 0)

The third row is the exercise from the MIT 18.01 study guide for chapter 11 (2023): B = (1, 3, 1) projected onto A = (2, 1, 2), where the dot product is 7, the squared length of A is 9, and the projection is (7/9) x (2, 1, 2). Reading the rows top to bottom, the pattern is that only the ratio of dot product to squared length matters, which is why the formulas never need the angle directly.

What the sign and the angle tell you

The scalar projection carries a sign, and the sign is information. A positive value means v leans in the same direction as u, a negative value means v leans against u, and zero means the two are perpendicular. That makes the scalar projection the cheapest orthogonality test available: compute one dot product and divide by one length. In quality control and computer graphics the same test decides whether a surface faces a viewer or faces away.

Because compuv = |v| cos(angle), the scalar projection is also the leg of a right triangle with |v| as the hypotenuse. Doubling the length of v doubles the projection, while changing the length of u changes nothing about the scalar projection, only about the vector that carries it. A common exam trap rescales u and expects the component to move; it does not, since the component measures v's share, not u's.

The pattern shows up cleanly if you hold the length of v fixed at 5 and sweep the angle while u points along the positive x-axis. The scalar projection is then 5 cos(angle), so the table below is just the cosine curve scaled by five:

Angle (degrees)cos(angle)Scalar projectionSign
01.0005.00positive, fully along u
300.8664.33positive
600.5002.50positive
900.0000.00zero, perpendicular
120-0.500-2.50negative
180-1.000-5.00negative, fully against u

Read down the scalar projection column and you have the whole story of the sign: the value falls smoothly from 5 to 0 to -5, crossing zero exactly at the right angle. No separate sign test is needed, because the dot product already carries it.

When you need the perpendicular piece explicitly, subtract: v minus projuv is the part of v that u cannot see. Engineers use it to decompose a load into the part a bearing carries axially and the part it sees radially, and navigation uses it to split a wind vector into the share along the runway and the crosswind. The two pieces always satisfy the Pythagorean relation from the second section, which makes them a built in error check on any hand calculation.

Traps that skew a projection

Neighboring tools for the rest of the vector work

The calculator below runs both formulas at once: enter v and u in two or three dimensions, and it returns the dot product, the scalar projection, the vector projection and the perpendicular leftover. For the pieces this page treats as inputs, the dot product calculator works through the sum of products step by step, the vector magnitude calculator handles the square root of the squared length, and the vector addition calculator covers the componentwise sums that combine vectors back together. When the angle between two vectors is the goal rather than a component, the law of cosines calculator and the distance calculator cover the triangle side of the same geometry.

Frequently asked questions

What is the vector projection formula?

proj of v onto u equals ((u dot v) / |u|^2) x u. For v = (3, 4, 0) and u = (1, 2, 0) the dot product is 11 and |u|^2 is 5, so the projection is 2.2 x (1, 2, 0) = (2.2, 4.4, 0).

What is the scalar projection of v onto u?

It is (u dot v) / |u|, a signed length. In the example above that is 11 / 2.2361 = 4.9193, the length of the vector projection.

What does a negative projection mean?

The angle between the vectors is greater than 90 degrees, so v points against u. Projecting (-2, 1, 0) onto (1, 0, 0) gives -2, meaning the component runs opposite to u.

What is the projection of perpendicular vectors?

Zero. Perpendicular vectors have a dot product of 0, so both the scalar and vector projections are 0, and the leftover equals the original vector.

How do I project a 2D vector?

Set the third component to zero and use the same formulas. v = (5, 0, 0) projected onto u = (1, 1, 0) gives a scalar projection of 5 / 1.4142 = 3.5355 and a vector projection of (2.5, 2.5, 0).

Does the length of u change the scalar projection?

No. The scalar projection is |v| cos(angle), which depends only on v and the angle. Rescaling u from (1, 2, 0) to (2, 4, 0) leaves the scalar projection at 4.9193 for v = (3, 4, 0); only the vector projection changes.

How do I find the perpendicular component?

Subtract the vector projection from v. For v = (3, 4, 0) and u = (1, 2, 0) the leftover is (0.8, -0.4, 0), length 0.8944, and its dot product with u is 0.

What is the projection used for in physics?

Work and effective force. A force of (50, 20, 0) N acting along a displacement of (6, 8, 0) m projects to 46 N along the motion, and the work is 46 x 10 = 460 J.

How do I check a projection by hand?

Three checks: the projection is a multiple of u, the leftover is perpendicular to u (dot product 0), and |v|^2 = |proj|^2 + |leftover|^2. In the worked example that reads 25 = 24.2 + 0.8.

What is the difference between comp and proj?

comp is the signed length, a single number. proj is a vector: comp multiplied by the unit vector in the direction of u. They share the same sign and direction information.

What happens if u is the zero vector?

The projection is undefined because both formulas divide by the length of u. A direction of length zero points nowhere, so pick a nonzero direction.

How is projection related to the angle between vectors?

comp = |v| cos(angle), so cos(angle) = comp / |v|. For the force example, cos(angle) = 46 / 53.852 = 0.8542, about 31.3 degrees.

Spotted a wrong number or a broken result?

More Math tools

See all Math tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.