Advertisement

Vector projection calculator

Find the part of A along B, or use a known projection factor or projection vector. Vector B supplies the projection direction.

Calculator

Projection of A onto B
(3, 0)
Projection factor
1.5000000000
Signed scalar projection
3.0000000000
Projection magnitude
3.0000000000
Perpendicular rejection A - projection
(0, 4)

Advertisement

How this calculator works

An orthogonal projection splits A into a component parallel to B and a perpendicular remainder. The projection factor scales B into that parallel component. The scalar projection measures signed length along B's direction, so it can be negative. A projection alone cannot recover all of A: any perpendicular remainder would give the same projection. If every other component of A is known, one missing component can be recovered when the corresponding component of B is nonzero. A known projection and nonzero factor also recover B.

Formula

proj_B(A) = ((A dot B)/(B dot B)) B. Factor = (A dot B)/|B|^2. Scalar projection = (A dot B)/|B|. Rejection = A - proj_B(A).

Worked example

A = (3, 4) projected onto B = (2, 0) gives factor 6/4 = 1.5, vector (3, 0), signed length 3 and rejection (0, 4). Projecting (-2, 3, 4) onto (1, 0, 0) instead gives (-2, 0, 0).

Advertisement

Frequently asked questions

Does reversing B change the projected vector?

No. Its span is the same line, so the projected vector stays the same. The scalar projection changes sign because B's positive direction reverses.

What if A and B are perpendicular?

Their dot product is zero, making the projection vector zero and leaving A entirely in the rejection.

Why can B not be zero?

A zero vector defines no direction and makes the denominator zero. A nonzero B is required in every mode.

Sources

Advertisement