AI Tools Free

Vector Projection Calculator

Enter First vector (x, y, z) as your source vector a and Second vector (x, y, z) as your non-zero target vector b in this vector projection calculator to compute the orthogonal projection proj_b(a) = ((a . b) / (b . b)) * b in your browser. Leave both z-coordinates at 0 for 2D vectors, inspect the preloaded orthogonal baseline (0, 0, 0), or project 3D coordinates up to +-1,000,000,000.

Free to useNo sign-upRuns in your browser
Enter your details

Enter the inputs, then select Calculate.

Your result
Enter your details

Result will appear here

How to Calculate Vector Projection & Core Formula

Understanding how to calculate vector projection starts with splitting a vector a = (x, y, z) into two perpendicular parts relative to a target direction b = (u, v, w): a parallel shadow a_parallel = proj_b(a) that lies directly along the line of b, and an orthogonal rejection a_perp = a - a_parallel that meets b at a 90-degree angle. Because the unit direction vector along b is b_hat = b / ||b|| and the signed scalar shadow length is comp_b(a) = (a . b) / ||b||, multiplying the scalar shadow by b_hat combines the two ||b|| denominators into ||b||^2 = b . b.

proj_b(a) = ((a . b) / (b . b)) * b = ((x*u + y*v + z*w) / (u^2 + v^2 + w^2)) * (u, v, w)

Notice that the vector projection formula never requires taking a square root. In client-side JavaScript (batch11-tools.js), the calculator evaluates both the numerator a . b and denominator b . b using Kahan compensated summation (kahan), divides them to obtain the exact scalar factor scale, and multiplies each coordinate of b by scale with 12-significant-digit formatting.

Diagram showing orthogonal vector projection of vector a onto vector b and perpendicular rejection
Geometric right-triangle decomposition showing vector a, target vector b, parallel projection vector proj_b(a), and perpendicular rejection vector a - proj_b(a).

2D & 3D Vector Projection Quick Reference Table

Use this benchmark table to compare source vectors a, target direction vectors b, scalar multipliers k = (a . b) / (b . b), and orthogonal rejections a_perp = a - proj_b(a) before running your own inputs in the projection of a vector calculator.

Scenario / ApplicationSource Vector a = (x, y, z)Target Vector b = (u, v, w)Scale Factor k = (a . b) / (b . b)Vector Projection proj_b(a)Orthogonal Rejection a - proj_b(a)
Orthogonal Axes (Preloaded)(1, 0, 0)(0, 1, 0)0 / 1 = 0(0, 0, 0)(1, 0, 0)
2D Horizontal Axis Projection(3, 4, 0)(1, 0, 0)3 / 1 = 3(3, 0, 0)(0, 4, 0)
2D 45-Degree Diagonal Projection(4, 2, 0)(1, 1, 0)6 / 2 = 3(3, 3, 0)(1, -1, 0)
2D Ramp Parallel Force(6, 8, 0)(3, 4, 0)50 / 25 = 2(6, 8, 0)(0, 0, 0)
2D Obtuse Opposite Projection(-2, -1, 0)(3, 1, 0)-7 / 10 = -0.7(-2.1, -0.7, 0)(0.1, -0.3, 0)
3D Integer Quadruple Line(2, 2, 6)(1, 2, 2)18 / 9 = 2(2, 4, 4)(0, -2, 2)
3D Obtuse Quadruple Line(-2, -2, -6)(1, 2, 2)-18 / 9 = -2(-2, -4, -4)(0, 2, -2)
3D Gram-Schmidt Step(3, 3, 6)(1, 2, 2)21 / 9 = 7/3(2.33333333333, 4.66666666667, 4.66666666667)(0.66666666667, -1.66666666667, 1.33333333333)
3D Space Diagonal Projection(3, 0, 0)(1, 1, 1)3 / 3 = 1(1, 1, 1)(2, -1, -1)
Zero Source Vector onto Line(0, 0, 0)(2, -3, 6)0 / 49 = 0(0, 0, 0)(0, 0, 0)

Step-by-Step Guide to Using the Vector Projection Calculator

Follow these three steps to enter the projected vector a, set the target direction b, and export your 3D coordinate tuple.

Enter the Vector Being Projected

Type the coordinates of the source vector a into First vector x (#x, default 1), First vector y (#y, default 0), and First vector z (#z, default 0).

Input and settings
Step 1 entering First vector x, y, and z as the source vector to project
First vector inputs x=1, y=0, z=0 representing the source vector a.

Enter the Non-Zero Target Vector

Fill in Second vector x (#u), Second vector y (#v, preloaded with 1), and Second vector z (#w) for the line vector b onto which a is projected. Keep both z inputs at 0 for 2D vectors.

Tool result
Step 2 entering Second vector x, y, and z as the non-zero target vector
Second vector inputs u=0, v=1, w=0 defining the target direction vector b.

Run and Copy the Projected Vector

Click Calculate result to generate the projected vector tuple (x, y, z). Use Copy or Download to transfer the result into your Gram-Schmidt worksheet or physics model.

Review the details
Step 3 viewing the calculated vector projection tuple in the output panel
Result panel showing the projected vector tuple with Copy and Download controls.

Practical Worked Examples for Projection Calculator Vector Workflows

These three worked examples show how a projection calculator vector workflow resolves orthogonal axes, 2D planar shadows, and 3D force components.

Orthogonal Basis Check: (1, 0, 0) onto (0, 1, 0)

With the preloaded vectors a = (1, 0, 0) and b = (0, 1, 0), the dot product is 1(0) + 0(1) + 0(0) = 0 while b . b = 0^2 + 1^2 + 0^2 = 1. Scaling b by 0 / 1 = 0 returns (0, 0, 0) because a horizontal vector casts zero shadow onto a vertical axis.

Worked example 1 showing orthogonal vector projection returning (0, 0, 0)
Orthogonal x-axis vector (1, 0, 0) casting a zero projection (0, 0, 0) onto the y-axis (0, 1, 0).

2D Diagonal Line Projection: (4, 2, 0) onto (1, 1, 0)

To project the 2D planar vector a = (4, 2, 0) onto the 45-degree line b = (1, 1, 0), compute a . b = 4(1) + 2(1) + 0(0) = 6 and b . b = 1^2 + 1^2 + 0^2 = 2. Multiplying b by k = 6 / 2 = 3 produces the projected vector (3, 3, 0).

Worked example 2 projecting (4, 2, 0) onto (1, 1, 0) to get (3, 3, 0)
2D vector (4, 2, 0) projected onto the 45-degree line (1, 1, 0) to yield (3, 3, 0).

3D Cable Force Along a Rail: (2, 2, 6) onto (1, 2, 2)

A winch pulls with force a = (2, 2, 6) kN on a carriage constrained to a 3D rail aligned with b = (1, 2, 2). Here a . b = 2(1) + 2(2) + 6(2) = 18 and b . b = 1^2 + 2^2 + 2^2 = 9, giving scale factor k = 18 / 9 = 2. Multiplying (1, 2, 2) by 2 returns the effective rail force (2, 4, 4) kN.

Worked example 3 projecting 3D force vector (2, 2, 6) onto (1, 2, 2) to get (2, 4, 4)
3D force vector (2, 2, 6) kN resolved along rail direction (1, 2, 2) to yield (2, 4, 4) kN.

How to Read and Verify the Vector Projection Output

The calculator outputs the projected vector proj_b(a) as an ordered Cartesian triple (px, py, pz). Because proj_b(a) = k * b where k = (a . b) / (b . b), the output vector lies along the infinite line spanned by your target vector b:

Multiplier sign and orientation: When k > 0 (acute angle theta < 90°), both proj_b(a) and b point along the same forward ray because the dot product a . b is positive. When k = 0 (right angle theta = 90°), the output is (0, 0, 0), proving orthogonality. When k < 0 (obtuse angle theta > 90°), a negative dot product flips the projection 180° so that it points antiparallel to b.

Orthogonal rejection verification: Subtract the output triple from your first vector a to form the orthogonal rejection a_perp = a - proj_b(a). Entering a_perp and b into the Dot Product Calculator must return 0 (for example, in the 3D rail case above, (2, 2, 6) - (2, 4, 4) = (0, -2, 2), and 0(1) + (-2)(2) + 2(2) = 0).

Diagram showing orthogonal decomposition a = proj_b(a) + a_perp where a_perp . b = 0
Verification diagram showing that the rejection vector a - proj_b(a) is perpendicular to target vector b with dot product zero.

Scope Limits, Direction Order & Related Vector Calculators

Keep these three mathematical properties in mind before exporting your coordinates:

Direction order and non-zero target guard: Vector projection is not commutative (proj_b(a) != proj_a(b)). First vector is always the vector being projected (a), and Second vector is always the target line (b). Setting all three coordinates of Second vector to 0 triggers 'Target vector cannot be zero.', whereas scaling Second vector by any non-zero constant leaves proj_b(a) unchanged.

Compute the numerator a . b in the Dot Product Calculator, find vector lengths in the Vector Magnitude Calculator, measure the angle in the Vector Angle Calculator, convert b into a unit vector in the Vector Normalizer, subtract proj_b(a) from a in the Vector Linear Combination Calculator, or find normal vectors and clearances in the Cross Product Calculator and Point to Line Distance Calculator.

Related vector calculators connected to the Vector Projection Calculator
Workflow map connecting the Vector Projection Calculator to Dot Product, Vector Magnitude, Vector Normalizer, and Vector Linear Combination tools.

Frequently Asked Questions About Vector Projection Calculator

Answers about using Vector Projection Calculator and understanding its results.

What is the formula for projecting vector a onto vector b?

The orthogonal projection of a = (x, y, z) onto a non-zero vector b = (u, v, w) is proj_b(a) = ((a . b) / (b . b)) * b. Compute the dot product xu + yv + zw, divide it by the squared length u^2 + v^2 + w^2 of the target vector b, and multiply each component of b by that scalar ratio.

What is the difference between scalar projection and vector projection?

The scalar projection (comp_b(a) = (a . b) / ||b|| = ||a|| cos(theta)) is a single signed number that gives the signed length of a's shadow along b. The vector projection proj_b(a) multiplies that signed length by the unit direction vector b / ||b||, returning a full 3-component vector (px, py, pz).

Why does projecting (1, 0, 0) onto (0, 1, 0) return (0, 0, 0)?

The preloaded vectors a = (1, 0, 0) and b = (0, 1, 0) lie along the perpendicular x and y axes (90 degrees apart). Because their dot product is 1(0) + 0(1) + 0(0) = 0, the scale multiplier k = 0 / 1 is zero, so the projection onto the y-axis is the zero vector (0, 0, 0).

How do you find the orthogonal rejection vector (a perpendicular to b)?

Once you calculate the parallel projection a_parallel = proj_b(a), subtract its coordinates from your original vector a: a_perp = a - proj_b(a). This rejection vector is strictly perpendicular to b and represents the normal force component or Gram-Schmidt orthogonal basis step, which you can compute in the Vector Linear Combination Calculator.

Why can the first vector be zero, but the second target vector cannot be zero?

Projecting a zero vector a = (0, 0, 0) onto a valid line b gives (0 / (b . b)) * b = (0, 0, 0). However, if the target vector b is (0, 0, 0), it has no line of direction and its squared norm b . b is 0, causing division by zero and triggering 'Target vector cannot be zero.'

Calculate with your input

Choose another tool for your next calculation, conversion, or text task.

Calculate