Skip to content

Vector Projection Calculator

Project a 2D or 3D vector onto a direction and check the perpendicular remainder.

Inputs

Processed in your browser.

—

p = projᵥ(u), r = u − p

Vector u splits into p along v and a perpendicular remainder r.

Result

Enter values and calculate.

How to use

This calculator decomposes an original vector u into a part p along a reference vector v and a perpendicular remainder r. Select 2D for x and y coordinates, or 3D when z is also needed. Enter both vectors in the same coordinate system and compatible units. The order matters: u is the vector being projected, and v sets the target direction. This supports geometry exercises, directional motion and component checks without requiring you to normalize v first.

Replace the editable example values with your own data, choose the comparison or dimension where available, and press Calculate. Enter submits the same form. The result is confirmed only after this action. Editing a number or changing a selection removes the previous result and disables Copy result, so an old answer cannot be mistaken for the current calculation. Clear empties the number fields while keeping the selected mode. After a successful calculation, Copy result copies the input and the numerical output as plain text. If clipboard access is blocked, select the visible text instead. Pale values are a runnable example. Focusing a number field clears all example numbers once. Your later entries are kept. Input preview — calculate to confirm the result.

How it works and reading the result

The formula is p = (u · v)/(v · v) v, with r = u − p. Equivalently, normalize v to a unit direction d, calculate the signed scalar s = u · d, then use p = sd. The implementation uses this unit-direction form. The scalar has a sign; it is not always the nonnegative length of the projection. The projection length is |s|. In exact arithmetic r · v = 0, so the remaining component is perpendicular to the reference direction.

The result lists the projection vector, scalar component, residual vector, residual dot product and relative orthogonality error. A small relative error is useful when the vectors are large because an absolute dot product alone can be misleading. The diagram draws u and v from the same origin, p along the reference line, and r from the tip of p to the tip of u. Thus p + r = u is visible as a head-to-tail sum. Solid and dashed strokes plus labels distinguish the vectors without relying only on color.

Examples

Example 1: choose 2D, u = (3, 4) and v = (1, 0). The projection is p = (3, 0), scalar s = 3, residual r = (0, 4), and r · v = 0. The diagram keeps the same scale on both axes, so this horizontal reference and vertical residual form a right angle.

Example 2: choose 3D, u = (2, −1, 3) and v = (0, 0, −2). The projection is (0, 0, 3), scalar s = −3 and residual (2, −1, 0). The negative scalar means that p points opposite to v, although the projection length is 3. The dot-product check is zero.

Limits and troubleshooting

Only two or three real components are supported. v cannot be zero, but u can be zero. Use a decimal point, not a comma as an input decimal separator. Values may be zero or have magnitudes from 1e−12 to 1e12. Ordinary outputs show at most two decimals; small nonzero outputs retain additional significant digits. Calculations use unrounded values. The 3D figure is explicitly a parallel projection onto screen coordinates (x − 0.6z, y − 0.4z): angles and lengths are distorted and different points can overlap. Confirm perpendicularity from the dot product, not the apparent screen angle. Copy includes values, not an image.

Use at most 15 significant input digits.

Frequently asked questions

Does multiplying v by a positive number change p?

No. It changes the reference vector’s length but leaves the reference line and projection unchanged.

What if I reverse v?

The signed scalar reverses sign, but p and the residual remain the same.

Can the projection be zero?

Yes. If u is perpendicular to v, p is the zero vector and the entire original vector becomes the residual.

Why did a z coordinate disappear?

2D mode hides and ignores z. Switching back to 3D restores the field, and you must calculate again to confirm a result.