Vector Projection Calculator
Project one vector onto another to get the vector projection, scalar projection, orthogonal rejection and the angle between, for 2D or 3D vectors.
Vector projection projᵦa
projᵦa = ((a·b) / (b·b))·b = (32 / 77)·(4, 5, 6)
projᵦa = (1.662338, 2.077922, 2.493506)
This is the shadow a casts on the line through b — the part of a that points along b. Its length is 3.646738.
Scalar projection compᵦa
compᵦa = (a·b) / ‖b‖ = 32 / 8.774964 = 3.646738
A single signed number: how far along b the projection reaches. It is positive, so a leans in the same general direction as b.
Orthogonal rejection a − projᵦa
(-0.662338, -0.077922, 0.506494)
The leftover part of a, perpendicular to b, with length 0.837436. Perpendicularity check: (a − projᵦa)·b = -2.000e-9. Together the two pieces add back to a, which is the orthogonal decomposition of a with respect to b.
Angle between a and b
cos θ = (a·b) / (‖a‖·‖b‖) = 32 / (3.741657 × 8.774964)
θ = 12.9332° = 0.225726 rad
What is the Vector Projection Calculator?
The ByteTools Vector Projection Calculator works out the shadow one vector casts on another. Enter vectors a and b in two or three dimensions and it computes the vector projection projᵦa = ((a·b)/(b·b))·b, the scalar projection compᵦa = (a·b)/‖b‖, and the orthogonal rejection a − projᵦa, which is the part of a that b cannot account for.
- Vector projection, scalar projection and orthogonal rejection on one page
- Every formula shown with your numbers substituted in
- Perpendicularity check: the rejection's dot product with b is printed
- Angle between the vectors in both degrees and radians
- Works for 2D and 3D vectors, with decimals and fractions accepted
- Zero-vector input handled with a clear explanation, never a divide-by-zero
How to use the Vector Projection Calculator
- 1
Enter vector a — the one being projected — with two or three components separated by spaces or commas.
- 2
Enter vector b, the direction you are projecting onto, with the same number of components.
- 3
Read the vector projection, shown with the formula and the substituted numbers.
- 4
Check the scalar projection and what its sign means about the angle between the vectors.
- 5
Read the orthogonal rejection, its perpendicularity check, and the angle in degrees and radians.
About the Vector Projection Calculator
The ByteTools Vector Projection Calculator works out the shadow one vector casts on another. Enter vectors a and b in two or three dimensions and it computes the vector projection projᵦa = ((a·b)/(b·b))·b, the scalar projection compᵦa = (a·b)/‖b‖, and the orthogonal rejection a − projᵦa, which is the part of a that b cannot account for.
Each result is shown with the formula and the numbers substituted in, so it is easy to follow the working rather than just copying an answer. The rejection is checked for perpendicularity by taking its dot product with b — it should be zero, and the tool prints the value so you can see that it is. The angle between the two vectors is given in both degrees and radians from cos θ = (a·b)/(‖a‖‖b‖).
Everything runs locally in your browser as plain JavaScript. Your vectors are never uploaded, nothing is stored, and if b happens to be the zero vector the tool explains why no projection exists instead of dividing by zero.
Frequently asked questions
What is the formula for the projection of a onto b?
The vector projection is projᵦa = ((a·b)/(b·b))·b — take the dot product of the two vectors, divide by the squared length of b, and scale b by that number. The result points along b and represents the part of a that lies in b's direction.
What is the difference between scalar and vector projection?
The scalar projection is a single signed number, (a·b)/‖b‖, giving how far along b the shadow reaches. The vector projection is that same length turned back into a vector pointing along b. The scalar version divides by ‖b‖ once; the vector version divides by ‖b‖ twice and multiplies by b.
Can a vector projection be negative?
The scalar projection can be, and a negative value means the angle between a and b is obtuse, so a leans away from b. The vector projection then points opposite to b. Its length is still a positive number.
What is the orthogonal rejection?
It is what is left of a after the projection is removed: a − projᵦa. It is always perpendicular to b, and adding it back to the projection recovers a exactly. Together the two form the orthogonal decomposition of a with respect to b.
What happens if the vectors are perpendicular?
The dot product is zero, so the projection is the zero vector, the scalar projection is 0, and the rejection is just a itself. That makes sense: a perpendicular vector casts no shadow along b, and the angle comes out as exactly 90°.
Related tools
Gram-Schmidt Calculator
Turn any set of vectors into an orthogonal or orthonormal basis with the modified Gram-Schmidt process, showing every projection subtraction as a step.
Linear Independence Calculator
Test whether a set of vectors is linearly independent by comparing rank to vector count, and see the explicit relation when they turn out to be dependent.
QR Decomposition Calculator
Factor a matrix into an orthogonal Q and upper-triangular R using Householder reflections, with an orthogonality check and least-squares solving.
Distance Calculator
Calculate the straight-line distance and bearing between two points on a map by latitude/longitude using the Haversine formula — km, miles and nautical miles.
Matrix Calculator
Add, subtract and multiply matrices up to 6×6, transpose them or scale by a number. Type matrices as simple rows and get instant, copyable results.