Linear Algebra
Advanced

Vector Projection

Projection of vector a onto vector b.

Formula

projb⃗a⃗=a⃗⋅b⃗∣b⃗∣2b⃗\text{proj}_{\vec{b}}\vec{a} = \frac{\vec{a}\cdot\vec{b}}{|\vec{b}|^2}\vec{b}

Variables

\vec{a},\vec{b}Vectors

Example

Projecting (3, 3) onto the x-axis (1, 0) gives (3, 0).

How it works

The projection of \(\vec a\) onto \(\vec b\) is the part of \(\vec a\) that lies in the direction of \(\vec b\). The factor \(\frac{\vec a\cdot\vec b}{|\vec b|^2}\) comes from matching the length of this parallel component using the dot product, which measures how strongly two vectors point in the same direction. Multiplying that scalar by \(\vec b\) gives the actual vector along \(\vec b\) with the correct magnitude and direction.

When to use it

Use this when you need to split a vector into components parallel and perpendicular to another vector, such as resolving forces, computing shadow lengths, or finding how much one direction contributes to another in geometry or data analysis. It is especially useful in least-squares, physics, and coordinate-free vector calculations.

Worked example, step by step

Let \(\vec a = (4, 2)\) and \(\vec b = (1, 3)\). Step 1: Compute the dot product: \(\vec a \cdot \vec b = 4\cdot 1 + 2\cdot 3 = 10\). Step 2: Compute \(|\vec b|^2\): \(|\vec b|^2 = 1^2 + 3^2 = 10\). Step 3: Find the projection scalar: \(\frac{\vec a\cdot\vec b}{|\vec b|^2} = \frac{10}{10} = 1\). Step 4: Multiply by \(\vec b\): \(\text{proj}_{\vec b}\vec a = 1(1,3) = (1,3)\). Final answer: \(\text{proj}_{\vec b}\vec a = (1,3)\).

Common mistakes to avoid

  • Using \(|\vec b|\) instead of \(|\vec b|^2\) in the denominator
  • Projecting onto the wrong vector and reversing \(\vec a\) and \(\vec b\)
  • Forgetting that the result must be a vector parallel to \(\vec b\), not just a scalar

Did You Know?

Vector projection is how you find the "shadow" of one vector onto another — key to least-squares fitting.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026