Quick answer

Scalar projection comp_b(a) = (a·b)/|b|. Vector projection proj_b(a) = ((a·b)/|b|²) b when b ≠ 0.

Formula

  • comp_b(a) = |a| cos θ when b is the axis
  • proj_b(a) = ((a · b) / |b|²) b

Introduction

This site’s main tool returns θ. Use it first when the question is angular, then apply the projection formulas below with the magnitudes you already know.

Open the Angle Between Two Vectors Calculator for θ, then read angle and dot product for the shared identity.

If your assignment mixes ramps and components, skim angle between two vectors examples for numeric templates before you project onto an axis.

What projection measures

Scalar projection returns a signed length along the b axis. Vector projection returns the actual vector along b that captures that component of a.

Engineering resolves forces along ramps; graphics projects onto light directions; statistics may project feature vectors onto axes in PCA-style thinking.

Projection is not the same as angle, but the two share cos θ. Once you know θ between a and b, the component along b often involves |a| cos θ.

Choose the axis b deliberately. Projecting onto the wrong axis is a modeling mistake, not a arithmetic mistake.

Projection formulas

  • comp_b(a) = (a · b) / |b|
  • proj_b(a) = ((a · b) / |b|²) b
  • cos θ = (a · b) / (|a| |b|)

If θ is known, comp_b(a) can also be written |a| cos θ when b is the reference direction. Match the method to the givens in your problem.

Angle steps are listed in how to find the angle between two vectors.

Projection workflow

  1. Build a and b in components. Same start as any angle problem.
  2. Compute a · b and |b|. You need both for scalar projection.
  3. Divide for scalar projection. comp_b(a) = (a·b)/|b|.
  4. Scale b for vector projection. Multiply b by (a·b)/|b|².
  5. Find θ when direction matters. Use arccos on cos θ = (a·b)/(|a||b|).

Numeric projection

Let a = (4, 3) and b = (1, 0). Then a·b = 4, |b| = 1, comp_b(a) = 4, and proj_b(a) = (4, 0). The angle between a and b is arccos(4/5) ≈ 36.87°.

Perpendicular axes give zero projection; see parallel and perpendicular vectors.

Second axis: a = (2, 2) and b = (0, 1). Here a·b = 2, |b| = 1, comp_b(a) = 2, proj_b(a) = (0, 2). The angle is 45° because cos θ = 2/(2√2).