Skip to content
MoneyDeck

Vector Projection Calculator

Project vector a onto b: scalar and vector projections, plus the rejection

Updated · Free, no signup

Separate components with commas or spaces.

Vector projection proj_b a

(4.2, 1.4)

Vector projection (exact)

(21/5, 7/5)

Scalar projection comp_b a

4.427189

Rejection a − proj_b a (perpendicular part)

(-0.2, 0.6)

Dot product a · b

14

Projection factor (a · b)/|b|²

1.4

Angle between a and b

8.1301 °

|a|

4.472136

|proj_b a|

4.427189

|rejection|

0.632456

  • Check: a = proj + rejection, and proj · rejection = 0 (zero means they are perpendicular).

Components

abproj_b aRejection
Component 1434.2-0.2
Component 2211.40.6

About the Vector Projection Calculator

This vector projection calculator projects a vector a onto a vector b. Enter the components of each vector — two, three or more dimensions — and you get the vector projection proj_b a, the scalar projection comp_b a (the signed length of the shadow of a along b), the rejection a − proj_b a that is perpendicular to b, the dot product and the angle between the vectors.

Projections show up everywhere vectors do: splitting a force into components along and across a ramp, computing work done by a force along a displacement, Gram–Schmidt orthogonalisation and least-squares fitting in linear algebra, and lighting or collision calculations in computer graphics. Students in calculus III, physics and linear algebra use it to check homework step by step.

Components can be integers, decimals or fractions such as 1/2. When all components are exact numbers the projection is also shown as exact fractions, so 7/5 is not rounded to 1.4.

How to use the vector projection calculator

  1. 1Enter the components of vector a, the vector being projected.
  2. 2Enter the components of vector b, the direction to project onto.
  3. 3Read the vector projection and the scalar projection.
  4. 4Use the rejection to get the part of a perpendicular to b.
  5. 5Check the component table, where proj + rejection adds back to a.

Formula and method

proj_b a = ((a · b) / |b|²) b; comp_b a = (a · b) / |b|; rejection = a − proj_b a

The projection of a onto b is the part of a that points along b — the "shadow" a would cast on the line through b. Its length is the scalar projection comp_b a = |a| cos θ = (a · b)/|b|, which is negative when the angle θ between the vectors exceeds 90°. Multiplying that length by the unit vector b/|b| gives the vector projection ((a · b)/|b|²) b.

The rejection a − proj_b a is the remainder of a, which is always perpendicular to b, so a splits into two orthogonal pieces. Projecting onto b only depends on b's direction, not its length: doubling b leaves the projection unchanged. b must not be the zero vector.

a · b
Dot product a₁b₁ + a₂b₂ + …
|b|
Length of b, √(b · b)
θ
Angle between a and b
comp_b a
Scalar projection (signed length)

Worked examples

Project (4, 2) onto (3, 1)

a · b = 4·3 + 2·1 = 14 and |b|² = 9 + 1 = 10, so proj_b a = 1.4·(3, 1) = (4.2, 1.4). The scalar projection is 14/√10 ≈ 4.4272, and the rejection (−0.2, 0.6) is perpendicular to b because −0.6 + 0.6 = 0.

3D: project (2, 3, 4) onto (1, 1, 1)

a · b = 9 and |b|² = 3, so the projection is 3·(1, 1, 1) = (3, 3, 3). The scalar projection is 9/√3 ≈ 5.1962 and the rejection (−1, 0, 1) has length √2.

Perpendicular vectors

a · b = −2 + 2 = 0, so the vectors meet at 90° and a has no component along b: the projection is the zero vector and the whole of a is the rejection.

4D vectors

The formula works in any dimension: a · b = 6, |b|² = 4, so the projection is 1.5·(1, 1, 1, 1), and the scalar projection is 6/2 = 3.

Frequently asked questions

What is the difference between scalar and vector projection?+

The scalar projection (a · b)/|b| is a single signed number: the length of a’s shadow along b. The vector projection multiplies that length by the unit vector in b’s direction, giving an actual vector ((a · b)/|b|²) b.

Is the projection of a onto b the same as b onto a?+

No. proj_b a lies along b and proj_a b lies along a, and their lengths differ unless |a| = |b|. Swap the inputs to get the other one.

Can a scalar projection be negative?+

Yes. If the angle between a and b is more than 90°, a · b is negative, so the scalar projection is negative and the vector projection points in the opposite direction to b.

What is the vector rejection?+

The rejection is a − proj_b a, the component of a perpendicular to b. Together, the projection and rejection split a into two orthogonal parts that add back to a — the basis of the Gram–Schmidt process.

How is vector projection used in physics?+

Work done by a force F over a displacement d is F · d, which is |d| times the scalar projection of F onto d. Projections also split gravity into components along and perpendicular to an inclined plane.

Related tools