Mathwords logoMathwords

Scalar Projection — Definition, Formula & Example

Scalar projection is the signed length of the shadow that one vector casts onto the line of another vector. It is a single number, positive when the two vectors point roughly the same way and negative when they point roughly opposite ways.

For vectors a,b∈Rn\mathbf{a}, \mathbf{b} \in \mathbb{R}^n with b≠0\mathbf{b} \neq \mathbf{0}, the scalar projection of a\mathbf{a} onto b\mathbf{b} is the real number compba=a⋅b^\text{comp}_{\mathbf{b}}\mathbf{a} = \mathbf{a} \cdot \hat{\mathbf{b}}, where b^=b/∥b∥\hat{\mathbf{b}} = \mathbf{b}/\|\mathbf{b}\| is the unit vector in the direction of b\mathbf{b}. If a≠0\mathbf{a} \neq \mathbf{0} and θ\theta is the angle between a\mathbf{a} and b\mathbf{b}, this equals ∥a∥cos⁡θ\|\mathbf{a}\|\cos\theta.

Key Formula

compba=a⋅b∥b∥=∥a∥cos⁡θ\text{comp}_{\mathbf{b}}\mathbf{a} = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{b}\|} = \|\mathbf{a}\|\cos\theta
Where:
  • a\mathbf{a} = The vector being projected
  • b\mathbf{b} = The nonzero vector whose direction you project onto
  • a⋅b\mathbf{a} \cdot \mathbf{b} = The dot product of the two vectors
  • ∥b∥\|\mathbf{b}\| = The magnitude (length) of b
  • θ\theta = The angle between a and b, with 0 ≤ θ ≤ 180°

Worked Example

Problem: Find the scalar projection of a=⟨2,−9⟩\mathbf{a} = \langle 2, -9 \rangle onto b=⟨3,4⟩\mathbf{b} = \langle 3, 4 \rangle, and explain what its sign tells you.
Step 1: Compute the dot product of a and b.
a⋅b=(2)(3)+(−9)(4)=6−36=−30\mathbf{a} \cdot \mathbf{b} = (2)(3) + (-9)(4) = 6 - 36 = -30
Step 2: Find the magnitude of b, the vector you project onto.
∥b∥=32+42=25=5\|\mathbf{b}\| = \sqrt{3^2 + 4^2} = \sqrt{25} = 5
Step 3: Divide the dot product by the magnitude of b.
compba=−305=−6\text{comp}_{\mathbf{b}}\mathbf{a} = \frac{-30}{5} = -6
Answer: The scalar projection is −6-6. The shadow of a\mathbf{a} on the line through b\mathbf{b} has length 6, and the negative sign means it points opposite to b\mathbf{b}. So the angle between the vectors is greater than 90∘90^\circ.

Why It Matters

In multivariable calculus, the directional derivative Duf=∇f⋅uD_{\mathbf{u}}f = \nabla f \cdot \mathbf{u} is the scalar projection of the gradient onto the unit direction u\mathbf{u}. In physics, the work done by a constant force equals the scalar projection of the force onto the displacement times the distance moved.

Common Mistakes

Mistake: Dividing the dot product by the magnitude of a, the vector being projected, instead of b.
Correction: You divide by the length of the vector you project onto. For the example, −30/∥b∥=−30/5=−6-30/\|\mathbf{b}\| = -30/5 = -6, while −30/∥a∥=−30/85-30/\|\mathbf{a}\| = -30/\sqrt{85} is the scalar projection of b onto a, a different number.

Related Terms

  • Vector Space Projection — Maps a vector onto a whole subspace, not just a length
  • Dot Product — Supplies the numerator of the scalar projection formula
  • Projection — Vector projection equals this scalar times the unit vector
  • Magnitude of a Vector — Length of b used as the denominator
  • Unit Vector — Scalar projection is the dot product with this vector
  • Scalar — Explains why the result is one number, not a vector
  • Inner Product — Generalizes the dot product used to define projections
  • Directional Derivative — Scalar projection of the gradient onto a unit direction
  • Work — Force's scalar projection on the displacement times distance