Vector projection splits a vector a into two pieces relative to a second vector b: the part of a that points along b (the projection), and the part left over that's perpendicular to b (the rejection). This decomposition shows up constantly in physics, computer graphics, and statistics — anywhere a quantity needs to be resolved into a component along a chosen direction and a component orthogonal to it.

How the Vector Projection Calculator works

The calculator starts from the dot product a·b and the squared magnitude of b, |b|². Dividing the first by the second gives a single scaling factor; multiplying b by that factor produces proj_b(a), a vector that always points along the same line as b (forward if a·b is positive, backward if negative, and to the zero vector if a and b are perpendicular).

The scalar projection, a·b / |b|, is that same scaling factor multiplied by |b| — equivalently, it's the signed length of proj_b(a). The rejection is whatever is left after subtracting the projection from a, and it's always perpendicular to b by construction: proj_b(a) and the rejection are the two orthogonal pieces that sum back to the original vector a.

Inputs and what they mean

Vector a and vector b are entered as their x, y (and z, in 3D mode) components. Vector b is the direction being projected onto — swapping a and b changes the result, since projection is not symmetric. Switching between 2D and 3D changes whether the z-component fields are shown; in 2D, z is treated as 0 for both vectors.

Limits and edge cases

The projection is undefined when b is the zero vector, since there's no direction to project onto — the calculator flags this explicitly rather than dividing by zero. When a and b are exactly perpendicular, the projection collapses to the zero vector and the rejection equals a itself, since none of a points along b. This calculator works with any consistent unit for the vector components — just use the same unit for both vectors.