Vector projection: check the perpendicular remainder
Separate a vector into parallel and perpendicular parts, then verify the result with a dot product.
Method
A projection answers how much of a vector points along a chosen direction. For a nonzero direction vector B, the vector projection of A is B multiplied by (A · B) divided by (B · B). This produces a vector, whereas the scalar projection is a signed length. Subtracting the vector projection from A gives a perpendicular remainder. Keep the components in the same coordinate system and unit. Reversing B changes the scalar projection's sign but leaves the projected vector unchanged.
Example only; replace these assumptions with your own values.
View data
- Inputs
- Vector A x · Vector A y · Vector A z
- Method
- Projection x = (ax*bx+ay*by+az*bz)/(bx^2+by^2+bz^2)*bx; Projection y = (ax*bx+ay*by+az*bz)/(bx^2+by^2+bz^2)*by; Projection z = (ax*bx+ay*by+az*bz)/(bx^2+by^2+bz^2)*bz
- Result
- Projection x · Projection y · Projection z
Worked example
Consider a displacement A and a horizontal direction B using the components below. The projected displacement keeps the horizontal component, while the remainder contains the vertical component. Their sum recovers A. A dot product of zero between the remainder and B verifies perpendicularity without relying on a drawing. In the calculator, enter the components in matching axes; for a planar example, use a zero component on the remaining axis.
A = (3, 4, 0); B = (2, 0, 0)
A · B = 6; B · B = 4
(6 / 4) B = (3, 0, 0)
A − (3, 0, 0) = (0, 4, 0)
(0, 4, 0) · (2, 0, 0) = 0
The remainder has dot product zero with the x-axis.
View data
- Projection length
- 3
- Perpendicular remainder length
- 4
- Original length
- 5
Checks and limits
A zero direction vector has no direction and makes the denominator zero, so it cannot be used as B. A zero vector A can still be projected onto a nonzero B. Rounded inputs or results can leave a small numerical residual instead of exact zero; compare it with the scale of the components. A negative scalar projection means the component points against the chosen direction. Projection alone does not give the angle between vectors; use the angle calculator when both vectors are nonzero.