acalculator

What is the orthogonal projection?

Type two vectors with the same number of components. The orthogonal projection calculator projects a onto b in exact fractions and gives the scalar projection, the part of a at a right angle to b, and the angle between the vectors.

Your numbers

Read as: 3; 5; 1Numbers separated by commas, 2 to 10 of them.
Read as: -1; 4; 3Numbers separated by commas, 2 to 10 of them.
Projection of a onto b
⟨−10/13, 40/13, 30/13⟩

The projection of a onto b is ⟨−10/13, 40/13, 30/13⟩.

Projection in decimals
⟨−0.769231, 3.07692, 2.30769⟩
Scalar projection
3.922323
Part of a orthogonal to b
⟨49/13, 25/13, −17/13⟩
Multiple of b
10/13
Dot product a · b
20
Angle between a and b
48.4714

Projection of a onto b: ⟨−10/13, 40/13, 30/13⟩. The projection of a onto b is ⟨−10/13, 40/13, 30/13⟩.

How to calculate

Projects vector a onto vector b: the orthogonal (vector) projection in exact fractions, the scalar projection, the part of a orthogonal to b, and the angle between them.

Example with the default inputs (Vector a (to project) [3, 5, 1], Vector b (onto) [-1, 4, 3]): The projection of a onto b is ⟨−10/13, 40/13, 30/13⟩.

Method: proj_b a = (a · b ÷ b · b) × b; comp_b a = a · b ÷ ‖b‖; the orthogonal part is a − proj_b a.

  • Vectors with 2 to 10 components, the same number in a and b; b is not the zero vector.
  • Every number is read exactly as typed (0.5 is 1/2), so the projection and the orthogonal part are exact fractions.
  • The scalar projection and the angle use square roots, so they are double-precision numbers.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Vector a (to project) 3, 5, 1, Vector b (onto) -1, 4, 3 gives Projection of a onto b ⟨−10/13, 40/13, 30/13⟩, Projection in decimals ⟨−0.769231, 3.07692, 2.30769⟩, Part of a orthogonal to b ⟨49/13, 25/13, −17/13⟩, Multiple of b 10/13, Dot product a · b 20, Scalar projection 3.922323, Angle between a and b 48.471421.Source: OpenStax, Calculus Volume 3, §2.3 The Dot Product (proj_u v = (u · v ÷ ‖u‖²) u, comp_u v = u · v ÷ ‖u‖; Example 2.27: the projection of ⟨3, 5, 1⟩ onto ⟨−1, 4, 3⟩ is ⟨−10/13, 40/13, 30/13⟩), https://openstax.org/books/calculus-volume-3/pages/2-3-the-dot-product (retrieved 2026-10-02)
  2. Vector a (to project) 4, 3, Vector b (onto) 1, 0 gives Projection of a onto b ⟨4, 0⟩, Part of a orthogonal to b ⟨0, 3⟩, Scalar projection 4, Angle between a and b 36.869898.Source: OpenStax, Calculus Volume 3, §2.3 The Dot Product (proj_u v = (u · v ÷ ‖u‖²) u, comp_u v = u · v ÷ ‖u‖; Example 2.27: the projection of ⟨3, 5, 1⟩ onto ⟨−1, 4, 3⟩ is ⟨−10/13, 40/13, 30/13⟩), https://openstax.org/books/calculus-volume-3/pages/2-3-the-dot-product (retrieved 2026-10-02)
  3. Vector a (to project) 1, 2, Vector b (onto) -2, 1 gives Projection of a onto b ⟨0, 0⟩, Part of a orthogonal to b ⟨1, 2⟩, Dot product a · b 0, Scalar projection 0, Angle between a and b 90.Source: OpenStax, Calculus Volume 3, §2.3 The Dot Product (proj_u v = (u · v ÷ ‖u‖²) u, comp_u v = u · v ÷ ‖u‖; Example 2.27: the projection of ⟨3, 5, 1⟩ onto ⟨−1, 4, 3⟩ is ⟨−10/13, 40/13, 30/13⟩), https://openstax.org/books/calculus-volume-3/pages/2-3-the-dot-product (retrieved 2026-10-02)
  4. Vector a (to project) 0.5, 1.5, Vector b (onto) 1, 1 gives Projection of a onto b ⟨1, 1⟩, Multiple of b 1, Scalar projection 1.414214.Source: OpenStax, Calculus Volume 3, §2.3 The Dot Product (proj_u v = (u · v ÷ ‖u‖²) u, comp_u v = u · v ÷ ‖u‖; Example 2.27: the projection of ⟨3, 5, 1⟩ onto ⟨−1, 4, 3⟩ is ⟨−10/13, 40/13, 30/13⟩), https://openstax.org/books/calculus-volume-3/pages/2-3-the-dot-product (retrieved 2026-10-02)

How it works

For vectors a and b with the same number of components:

  • Dot product: a · b = a₁b₁ + a₂b₂ + … + aₙbₙ.
  • Multiple of b: t = (a · b) ÷ (b · b), where b · b = ‖b‖².
  • Orthogonal (vector) projection: proj_b a = t × b.
  • Orthogonal part: a − proj_b a. Its dot product with b is 0.
  • Scalar projection: comp_b a = (a · b) ÷ ‖b‖, with ‖b‖ = √(b · b).
  • Angle: θ = arccos((a · b) ÷ (‖a‖ ‖b‖)) in degrees, from 0° to 180°.

Rules

  • 2 to 10 components; a and b need the same number, or there is no answer.
  • b must not be the zero vector (no answer). If a is the zero vector, the angle is left out.
  • Every number is read exactly as typed (0.5 is 1/2), so t, the projection and the orthogonal part are exact fractions. The dot product shown is the exact value rounded to double precision.
  • The scalar projection and the angle are double-precision numbers: ‖a‖ and ‖b‖ are computed with a scaled square root, like Python’s math.hypot, and the cosine is clamped to −1 to 1. A value beyond the double-precision range is left out (for example the dot product of components near 10³⁰⁸); the exact fractions still show.

Output format. Vectors are written ⟨a, b, c⟩ with fractions in lowest terms (−10/13), whole numbers without a denominator, and a true minus sign (−). The decimal projection gives each component to 6 significant digits, trailing zeros dropped. The angle shows up to 4 decimals.

Worked examples by hand

a = ⟨3, 5, 1⟩ onto b = ⟨−1, 4, 3⟩. a · b = −3 + 20 + 3 = 20. b · b = 1 + 16 + 9 = 26, so t = 20/26 = 10/13. The projection is (10/13) × ⟨−1, 4, 3⟩ = ⟨−10/13, 40/13, 30/13⟩ ≈ ⟨−0.769231, 3.07692, 2.30769⟩. The orthogonal part is ⟨3 + 10/13, 5 − 40/13, 1 − 30/13⟩ = ⟨49/13, 25/13, −17/13⟩. The scalar projection is 20 ÷ √26 ≈ 3.922323. With ‖a‖ = √35, the angle is arccos(20 ÷ (√35 × √26)) ≈ 48.4714°.

a = ⟨4, 3⟩ onto b = ⟨1, 0⟩ (the x axis). a · b = 4, b · b = 1, so the projection is ⟨4, 0⟩ and the orthogonal part is ⟨0, 3⟩. The scalar projection is 4; the angle is arccos(4/5) ≈ 36.8699°.

a = ⟨1, 2⟩ onto b = ⟨−2, 1⟩. a · b = −2 + 2 = 0, so the projection is ⟨0, 0⟩, the orthogonal part is all of a, ⟨1, 2⟩, and the angle is 90°.

a = ⟨0.5, 1.5⟩ onto b = ⟨1, 1⟩. a · b = 2 and b · b = 2, so t = 1 and the projection is b itself, ⟨1, 1⟩. The scalar projection is 2 ÷ √2 = √2 ≈ 1.414214.

Other questions people ask

What is the orthogonal projection of a onto b?

The vector along b that is closest to a: proj_b a = (a · b ÷ b · b) × b. What is left, a − proj_b a, is at a right angle (orthogonal) to b, which gives the projection its name.

How do I compute a vector projection by hand?

Work out the dot product a · b and the squared length b · b, divide, and multiply b by the result. For a = ⟨3, 5, 1⟩ and b = ⟨−1, 4, 3⟩: a · b = 20, b · b = 26, so the projection is (10/13) × ⟨−1, 4, 3⟩ = ⟨−10/13, 40/13, 30/13⟩.

What is the difference between the vector and the scalar projection?

The vector projection is a vector along b. The scalar projection is a number, a · b ÷ ‖b‖: the length of the vector projection, negative when the projection points away from b. In the example above it is 20 ÷ √26 ≈ 3.9223.

What if the projection is zero?

Then a · b = 0, so a and b are orthogonal (at 90°). For ⟨1, 2⟩ and ⟨−2, 1⟩ the projection is ⟨0, 0⟩ and all of a is the orthogonal part.

Why can’t I project onto the zero vector?

The zero vector has no direction, and b · b = 0 would put a zero under the fraction. The calculator asks for a b with at least one component that is not 0.

Does the order of a and b matter?

Yes. Projecting a onto b gives a multiple of b; projecting b onto a gives a multiple of a. The dot product and the angle are the same either way.

Can I project onto a subspace with several vectors?

Not on this page, which projects onto one vector (a line). For a subspace, first make its basis orthogonal with the Gram–Schmidt calculator, then add the projections onto each basis vector.