Vectors
Formula and decomposition
A equals its projection on B plus the perpendicular rejection component.
Use this Vector Projection Calculator to enter values, adjust options, and review results in a compact responsive workspace.
Results are calculated automatically as you enter data.
A equals its projection on B plus the perpendicular rejection component.
▼ See explanations and tips below ▼
Vector projection is a way to describe how much of one vector points in the direction of another vector. If Vector A represents the vector you want to break apart and Vector B represents the direction you care about, the projection of A onto B is the part of A that lies parallel to B.
This idea is useful because a vector often contains more than one directional effect. A force may point partly forward and partly upward. A velocity may point partly along a route and partly sideways. A data vector may have one part explained by a chosen direction and another part left over. Projection separates those parts cleanly.
The projection of A onto B is not the same as the projection of B onto A. The first vector is the one being decomposed. The second vector defines the direction or line onto which the first vector is projected.
Vector projection connects geometry with component arithmetic. Instead of relying only on a drawing, you can use dot products to find the exact parallel part of a vector.
This matters in many settings:
Projection starts with the dot product. For two 3D vectors
and
the dot product is
In 2D, the same idea applies without the \(z\) components:
The magnitude of a vector is the square root of its dot product with itself:
To project A onto B, scale B by the ratio of \(A \cdot B\) to \(B \cdot B\):
Where:
The scalar projection is the signed amount of A in B's direction:
The rejection is the perpendicular remainder:
Together, the projection and rejection decompose A into two perpendicular parts:
The angle between nonzero A and nonzero B comes from the dot product formula:
So the angle is
If A is the zero vector, it has no direction, so the angle between A and B is not meaningful even though the projection and rejection can still be computed. B must be nonzero because a projection direction cannot have zero length.
Suppose
and
First compute the dot products:
Now find the scale factor:
Multiply B by this scale factor:
The rejection is what remains after subtracting the projection from A:
So A splits into a horizontal part and a vertical part:
The scalar projection is \(4\), and the projection length is also \(4\).
Suppose
and
Compute the dot products:
The scale factor is
Therefore,
The rejection is
The scalar projection is
This value is positive but small, so A has only a small component in the direction of B. The angle between the vectors is about \(86.6565^\circ\), which is close to a right angle.
Suppose
and
The dot product is
and
The projection is
The scalar projection is
The negative sign means A points partly opposite the direction of B. The projection length is still nonnegative:
This is why the signed scalar projection and the projection length should not be treated as the same thing.
Suppose
and
The projection of A onto B is
and the rejection is also
The angle between A and B is not defined because the zero vector has no direction. This is different from using the zero vector for B, which is not allowed at all because B defines the projection direction.
The projection vector is the part of A that runs along the direction of B. If the projection vector has the same general direction as B, the scalar projection is positive. If it points opposite B, the scalar projection is negative.
The scalar projection is signed:
The projection length is nonnegative. It tells you how long the projection vector is, without preserving the sign.
The rejection vector is the part of A perpendicular to B. A long rejection means much of A lies away from the direction B defines. A rejection close to zero means A is nearly parallel or antiparallel to B.
The dot product helps explain the sign and size of the projection:
The angle is reported in degrees when A and B are both nonzero. If A is exactly zero, the angle is not meaningful. Every finite nonzero B, including a very small one, defines a valid direction.
Using the zero vector for B. Vector B defines the direction of projection. A zero vector has no direction, so it cannot be used as the projection direction.
Reversing A and B. The projection of A onto B usually differs from the projection of B onto A. Always check which vector is being projected and which vector defines the direction.
Confusing scalar projection with projection length. The scalar projection is signed, while the projection length is nonnegative. A scalar projection of \(-2\) has projection length \(2\).
Forgetting the z-component in 3D mode. In 3D, the \(z\) components affect the dot product, projection, rejection, scalar projection, and angle. A 2D-looking graph cannot show the full 3D geometry.
Rounding too early. If you round the scale factor before multiplying by B, your projection and rejection may differ slightly from a calculator result. Keep full precision until the final step when possible.
Expecting physical unit conversion. Vector projection works on components. If the components represent meters, newtons, or another unit, all components should already be in consistent units before calculating. This calculator treats the entered components as unitless Cartesian components.
Assuming the projection is always between the tails of A and B. When the angle is obtuse, the projection points opposite the direction of B. This is normal and is shown by a negative scalar projection.
Use vector projection when you need to find how much of one vector lies in a chosen direction.
Common use cases include:
This calculation depends on the components you enter. If the components are wrong, incomplete, or in mixed units, the result will not represent the intended vector relationship.
The calculator supports 2D and 3D vectors. It does not handle complex-valued vectors, symbolic expressions, exact fraction output, or arbitrary-dimensional vectors.
Vector B must not be exactly zero. Every finite nonzero B, including a very small one, defines a direction. The calculator keeps dot-product and scale-factor diagnostics in mantissa/exponent form when ordinary decimal display would underflow or overflow.
A zero Vector A can still have a projection and rejection, but it does not have a meaningful direction, so the angle between A and B should not be interpreted.
Most numeric results are rounded for display. Very small nonzero values may appear in exponential notation, and rounded values may differ slightly from hand calculations that round intermediate steps.
In 3D mode, the numeric results include the \(z\) components. A graph preview may show only the x-y view, so use the numeric projection and rejection values for the full 3D result.
For coursework, engineering calculations, physics modeling, or other important decisions, double-check the input values, units, assumptions, and rounding. When the calculation affects safety, money, official records, or professional design work, consult a qualified professional or instructor.
The vector projection of A onto nonzero B is
This formula scales B so that the result is the part of A that lies parallel to B.
Vector projection gives a vector, such as \((4, 0)\) or \((0.190476, 0.047619, -0.095238)\). Scalar projection gives a signed number that tells how much of A lies in B's direction. The scalar projection can be negative, but the projection length is nonnegative.
Vector B defines the direction of projection. The zero vector has no direction, and the formula requires dividing by \(B \cdot B\), which equals zero when B is the zero vector.
A negative scalar projection means A points partly opposite the direction of B. The projection vector will lie on the same line as B but point in the opposite direction.
Yes, for an exact mathematical projection onto a nonzero vector, the rejection vector is perpendicular to B. Numerically, a displayed result may show tiny rounding differences, especially with decimal inputs or very small values.
No. The same dot-product formula applies. In 3D, the calculation includes the x, y, and z components instead of only x and y.
The angle describes how closely the directions of A and B align. An angle near \(0^\circ\) means they point in nearly the same direction, an angle near \(90^\circ\) means they are nearly perpendicular, and an angle near \(180^\circ\) means they point in nearly opposite directions.
Books and Textbooks
Calculator-Specific Behavior