Vector projection tells us how much of one vector points in the direction of another vector. If
\(A\)
is the vector we want to decompose and
\(B\)
is the direction vector, then the projection of
\(A\)
onto
\(B\)
splits
\(A\)
into two parts:
a component parallel to
\(B\),
and a component perpendicular to
\(B\).
This is one of the most useful ideas in mechanics, geometry, engineering, and physics because it lets us isolate the part of a force,
velocity, displacement, or field that acts along a chosen direction.
Scalar projection
The scalar projection of
\(A\)
onto
\(B\)
is also called the scalar component or signed shadow of
\(A\)
along
\(B\).
It is given by
Scalar projection formula.
\[
\begin{aligned}
\operatorname{comp}_B A &= \frac{A \cdot B}{|B|}
\end{aligned}
\]
This quantity is a scalar, not a vector. Its sign matters:
if it is positive, the shadow points in the same direction as
\(B\);
if it is negative, the shadow points opposite to
\(B\).
If it is zero, then
\(A\)
is perpendicular to
\(B\).
Vector projection
The vector projection keeps both magnitude and direction. It points along
\(B\)
and tells us the actual vector component of
\(A\)
that lies parallel to
\(B\).
The standard formula is
Vector projection formula.
\[
\begin{aligned}
\operatorname{proj}_B A &= \frac{A \cdot B}{|B|^2}\,B
\end{aligned}
\]
This can also be written using the unit vector in the direction of
\(B\).
If
\(\hat{b} = B/|B|\),
then
\[
\begin{aligned}
\operatorname{proj}_B A &= (A \cdot \hat{b})\,\hat{b}
\end{aligned}
\]
Both formulas say the same thing. The first is convenient when you already know
\(B\),
while the second emphasizes that projection is “scalar component times unit direction”.
Parallel and perpendicular decomposition
Once the projection is known, the original vector can be decomposed into
\[
\begin{aligned}
A &= \operatorname{proj}_B A + A_{\perp}
\end{aligned}
\]
where
\(A_{\perp}\)
is the component of
\(A\)
perpendicular to
\(B\).
Therefore,
\[
\begin{aligned}
A_{\perp} &= A - \operatorname{proj}_B A
\end{aligned}
\]
A very important check is that
\(A_{\perp}\)
is orthogonal to
\(B\):
\[
\begin{aligned}
A_{\perp} \cdot B &= 0
\end{aligned}
\]
In practical calculations, you may get a tiny nonzero value because of rounding, but theoretically the result should be exactly zero.
Connection with the angle between vectors
If
\(\theta\)
is the angle between
\(A\)
and
\(B\),
then the dot product satisfies
\[
\begin{aligned}
A \cdot B &= |A|\,|B| \cos\theta
\end{aligned}
\]
Substituting that into the scalar projection formula gives
\[
\begin{aligned}
\operatorname{comp}_B A &= |A| \cos\theta
\end{aligned}
\]
This is why the scalar projection is often described as the “shadow length” of
\(A\)
on the line of
\(B\).
If the angle is acute, the projection is positive.
If the angle is obtuse, the projection is negative.
If the angle is \(90^\circ\), the projection vanishes.
Worked 2D example
Use the sample vectors
\(A = \langle 5,2 \rangle\)
and
\(B = \langle 3,0 \rangle\).
Step 1. Compute the dot product.
\[
\begin{aligned}
A \cdot B &= 5\cdot 3 + 2\cdot 0 = 15
\end{aligned}
\]
Step 2. Compute the magnitude of \(B\).
\[
\begin{aligned}
|B| &= \sqrt{3^2 + 0^2} = 3
\end{aligned}
\]
Step 3. Compute the scalar projection.
\[
\begin{aligned}
\operatorname{comp}_B A &= \frac{15}{3} = 5
\end{aligned}
\]
Step 4. Compute the vector projection.
\[
\begin{aligned}
\operatorname{proj}_B A &= \frac{15}{3^2}\langle 3,0 \rangle \\
&= \frac{15}{9}\langle 3,0 \rangle \\
&= \langle 5,0 \rangle
\end{aligned}
\]
Step 5. Compute the perpendicular part.
\[
\begin{aligned}
A_{\perp} &= \langle 5,2 \rangle - \langle 5,0 \rangle \\
&= \langle 0,2 \rangle
\end{aligned}
\]
So in this example, all of the x-direction part of
\(A\)
lies along
\(B\),
while the y-direction part is completely perpendicular.
Force interpretation
One of the most common applications is resolving a force into a component along a chosen direction. Suppose a force
\(F\)
acts at an angle to a surface or axis. The projection of
\(F\)
onto that axis gives the effective part of the force that actually acts along it.
This is why vector projection is central in statics, dynamics, work, and constrained motion.
Important restriction
Projection onto the zero vector is undefined. The formulas require division by
\(|B|\)
or
\(|B|^2\),
so we must have
\(B \neq 0\).
Geometrically, this makes sense because the zero vector has no direction, and projection requires a direction line to project onto.
Summary
| Concept |
Formula |
Meaning |
| Dot product |
\(A \cdot B\) |
Measures alignment between the vectors |
| Scalar projection |
\(\operatorname{comp}_B A = (A \cdot B)/|B|\) |
Signed amount of \(A\) along \(B\) |
| Vector projection |
\(\operatorname{proj}_B A = (A \cdot B / |B|^2)B\) |
Parallel vector component of \(A\) along \(B\) |
| Perpendicular component |
\(A_{\perp} = A - \operatorname{proj}_B A\) |
Remaining part orthogonal to \(B\) |
| Orthogonality check |
\(A_{\perp}\cdot B = 0\) |
Confirms the split is correct |