Vector Projection Calculator - Scalar, Projection, and Rejection
Use this vector projection calculator to find the scalar projection, the projected vector, and the rejection vector for 2D or 3D inputs in one pass.
Vector Projection Calculator
Results
What Is a Vector Projection Calculator?
A vector projection calculator computes how much of one vector lies along another, in both scalar and vector form, so you can read the answer without rebuilding the dot-product formula by hand. Type the components of the target vector a and the source vector b, pick 2D or 3D, and the result panel returns the scalar projection, the projected vector, and the rejection vector in one pass.
- • Decompose a force into a useful component: An engineer decomposing a force along a beam axis and its perpendicular component reads both pieces side by side without solving two equations by hand.
- • Find the closest point on a line to a point: A student working through the closest-point-on-a-line problem reads the projection vector as the closest point to b on the line through a.
- • Check perpendicularity with the scalar output: A physics student checks whether two vectors are perpendicular: a scalar projection of exactly 0 confirms a · b = 0.
- • Project a velocity onto a heading: A robotics or navigation reader projects a measured velocity onto a desired heading and reads the scalar projection as the speed along that heading.
Projection splits a vector into a part parallel to another vector and a part perpendicular to it. The parallel part is the projection, the perpendicular part is the rejection (the orthogonal complement), and the two always add back to b.
Use the scalar output for the signed length of b in the direction of a, the projection vector for the actual arrow on the line, and the rejection for what is left over.
When you only need the dot product of a and b without the projection step, Dot Product Calculator returns a · b in the same 2D and 3D format.
How the Vector Projection Calculator Works
The tool computes the dot product of a and b, divides by the magnitude of a (or its square for the vector form), and returns the scalar projection, the projection vector, and the rejection. The projection is undefined when the target vector is the zero vector.
- ax, ay, az: Components of vector a (the line being projected ONTO). The z term is used only in 3D mode.
- bx, by, bz: Components of vector b (the vector being projected). The z term is used only in 3D mode.
- dimension: 2D treats the z terms as 0; 3D includes them.
- direction: Standard projection is b onto a; the toggle swaps the roles for proj_b(a).
- scalar projection: Signed length of b in the direction of a, equal to a · b / |a|. Positive along a, negative opposite, zero when perpendicular.
- projection vector: The vector on the line through a closest to b. Equals (a · b / a · a) * a.
- rejection vector: b - projection. The part of b perpendicular to a. Zero when a and b are parallel.
Both forms come from the same dot product. The scalar version divides by the magnitude of a; the vector version divides by the squared magnitude and multiplies the result by a.
Worked example: project b = (5, 6) onto a = (3, 4) in 2D
a = (3, 4), b = (5, 6), 2D, direction = b onto a
a · b = 3*5 + 4*6 = 39. |a| = 5. a · a = 25. Scalar projection = 39 / 5 = 7.8. factor = 39 / 25 = 1.56. proj = (4.68, 6.24). perp = (0.32, -0.24).
Scalar projection = 7.8, projection vector = (4.68, 6.24), rejection vector = (0.32, -0.24).
Most of b lies along a, and a small perpendicular remainder is left over. The dot product 39 and squared magnitude 25 confirm the calculation.
According to Weisstein, Eric W. "Projection." MathWorld, the vector projection of a vector a onto a vector u is proj_u(a) = (a · u / |u|^2) * u, and the length of that projection is |proj_u(a)| = |a · u| / |u|
According to Paul Dawkins (Lamar University), Dot Product notes, the projection of b onto a is p = (a · b / a · a) * a, and the rejection (perpendicular component) is b - p
When the formula needs |a| for the scalar projection and you want to confirm the squared magnitude on its own, Vector Magnitude Calculator returns the length of a single vector in the same units.
Key Concepts Behind a Vector Projection Calculator
Four short ideas cover every projection problem you will run into.
Scalar vs vector projection
The scalar projection comp_a(b) = a · b / |a| is a signed number, positive when b has a component along a and negative when it points partly opposite. The vector projection proj_a(b) = (a · b / a · a) * a is the actual arrow on the line through a.
Projection as closest point on a line
Geometrically, proj_a(b) is the closest point to b on the line through a. The line from that closest point to b is the rejection, and it is always perpendicular to a. That is the reason projection is the workhorse of least-squares fitting.
Dot product in the formula
The dot product a · b is the only piece of b that survives the projection, and a · a rescales the result so the formula returns an actual vector. If a · b is 0 the vectors are perpendicular; if a · b equals a · a the vectors point exactly the same way.
Decomposing b into parallel and perpendicular parts
Every projection comes with a companion rejection, and the two always add back to b. Projection plus rejection is a complete decomposition of b.
Projections generalize 'how much of one thing lies along another' from real numbers to vectors, and the same formula works for 2D, 3D, and beyond.
When you want to rewrite proj_a(b) as (b · u) * u where u is the unit vector in the direction of a, Unit Vector Calculator returns u from any (x, y, z) input.
How to Use the Vector Projection Calculator
Five short steps take any pair of 2D or 3D vectors to the scalar projection, the projected vector, and the rejection vector in one entry.
- 1 Enter the target vector a: Type the x, y, and z components of a in the first row. For 2D problems leave a_z at 0 or pick the 2D toggle to ignore it.
- 2 Enter the source vector b: Type the x, y, and z components of b in the second row. Both vectors must use the same dimension.
- 3 Pick the dimension and direction: Choose 2D or 3D. Standard notation projects b onto a; switch the toggle to a onto b for the reverse.
- 4 Read the scalar and the projection vector: The first result row is the signed scalar projection. The next three rows are the x, y, z components of the projected vector.
- 5 Cross-check with the rejection: Add the projection and the rejection back together. The sum must equal b component-by-component.
A physics student splits a force b = (5, 6) onto a beam direction a = (3, 4). The panel returns scalar = 7.8, projection = (4.68, 6.24), rejection = (0.32, -0.24). The force along the beam is 4.68 in x and 6.24 in y; the small rejection is the shear the beam has to absorb.
When the cross-check step asks you to add the projection and the rejection back together to recover b, Vector Addition Calculator returns the sum vector component by component.
Benefits of Using This Vector Projection Calculator
Five concrete benefits explain why the projection and the rejection belong in the same panel.
- • Both projection forms in one entry: The scalar projection and the vector projection come from the same dot product, so the tool returns both at once.
- • Rejection shown alongside the projection: Adding the projection and rejection back together recovers b, the easiest sanity check on the page.
- • Direction toggle for proj_a(b) and proj_b(a): Standard notation projects b onto a, but some problems ask for proj_b(a). The toggle swaps the roles without re-entering the components.
- • Zero-vector error surfaced explicitly: When the target vector is the zero vector, the calculator returns a clear error rather than dividing by zero silently.
- • Works in 2D and 3D with the same formula: The 2D / 3D toggle moves users from planar problems to spatial ones without re-typing into a different calculator.
Readers who already have the dot product and only want the projection vector can skip the scalar output and read the three projection rows directly.
When the problem needs the component of b perpendicular to the plane spanned by a and a second vector, Cross Product Calculator gives the 3D cross product that completes the decomposition.
Factors That Affect Your Projection Result
Three things change the answer you should expect, plus two practical caveats about the projection formula.
Magnitude of the target vector a
The scalar projection scales inversely with |a|. Doubling a halves the scalar projection while keeping the projection direction. The squared magnitude a · a sits in the denominator, which is why zero-length targets break the formula.
Angle between a and b
The sign of the scalar projection follows cos(theta). At theta = 0 the projection equals b; at theta = 90 the projection is the zero vector; at theta = 180 it flips direction.
Dimension of the input space
2D and 3D use the same formula. In 3D the z term contributes to both a · b and a · a.
- • Projection onto the zero vector is undefined because no line is specified. The page surfaces that case as a clear error rather than producing a number.
- • The projection is rounded to 4 decimals for vector components and 6 for the scalar. High-precision metrology may want to extend the precision.
Use the direction toggle when the problem says 'project a onto b' rather than 'project b onto a', and confirm the order of vectors before pasting the projection into the next step.
According to Khan Academy, Linear Algebra: Projections, the projection of a vector onto a line is the closest point on that line to the original vector, with formula proj_u(x) = (x · u / u · u) * u
Frequently Asked Questions
Q: What is a vector projection calculator?
A: A vector projection calculator computes how much of one vector lies along another, returning the scalar projection, the projected vector, and the perpendicular rejection vector in one entry. It is the workhorse tool for decomposing a vector into parallel and perpendicular parts and for the closest-point-on-a-line problem.
Q: How do you project one vector onto another?
A: Take the dot product of the target vector a and the source vector b, divide by the dot product of a with itself, and scale a by the resulting scalar. The product is the vector projection; the scalar alone is the scalar projection; the rejection is b minus the projection.
Q: What is the formula for vector projection?
A: proj_a(b) = (a · b / a · a) * a. The scalar projection is comp_a(b) = a · b / |a|. Both formulas rely on the dot product of the two input vectors, and they give the same projection vector when the scalar form is multiplied by the unit vector in the direction of a.
Q: What is the difference between scalar and vector projection?
A: The scalar projection comp_a(b) = a · b / |a| is a signed number that gives the length of b in the direction of a. The vector projection proj_a(b) = (a · b / a · a) * a is the actual arrow on the line through a. The scalar is for a length, the vector is for the projected arrow itself.
Q: Can you project a 2D vector onto a 3D vector?
A: Yes, by setting the 3D vector's missing components to zero so the two inputs live in the same space. The dot product ignores the implicit zeros and the projection formula gives the answer for the 2D projection of the 3D vector. The 2D / 3D toggle performs that flattening for you.
Q: What happens when you project a vector onto the zero vector?
A: The projection is undefined because there is no line to project onto. The dot product a · a is zero, the formula divides by zero, and the calculator returns a clear error message instead of NaN. Pick a non-zero target vector to get a sensible projection.