# What is the orthogonal projection?

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.

- Page: https://www.acalculator.org/math/orthogonal-projection-calculator
- JSON spec: https://www.acalculator.org/math/orthogonal-projection-calculator.json
- Version: 86fa22af513d

## Default answer

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⟩.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| a | Vector a (to project) | The vector you project, such as 3, 5, 1. |
| b | Vector b (onto) | The vector you project onto, with as many components as a. It cannot be all zeros. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| projection | Projection of a onto b | proj_b a = (a · b ÷ b · b) × b, as exact fractions. |
| decimal | Projection in decimals | The same projection with each component to 6 significant digits. |
| scalar | Scalar projection | comp_b a = a · b ÷ ‖b‖: the signed length of the projection. |
| orthogonal | Part of a orthogonal to b | a − proj_b a, as exact fractions: it is at a right angle to b. |
| factor | Multiple of b | a · b ÷ b · b: the projection is this number times b. |
| dot | Dot product a · b | a₁b₁ + a₂b₂ + … + aₙbₙ. |
| angle | Angle between a and b | arccos(a · b ÷ (‖a‖ ‖b‖)) in degrees. None when a is the zero vector. |

## Method

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

## Assumptions

- 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.

## Worked examples

1. a = 3 or 5, b = -1 or 4 gives projection = ⟨−10/13, 40/13, 30/13⟩, decimal = ⟨−0.769231, 3.07692, 2.30769⟩, orthogonal = ⟨49/13, 25/13, −17/13⟩, factor = 10/13, dot = 20, scalar = 3.922323, angle = 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. a = 4 or 3, b = 1 or 0 gives projection = ⟨4, 0⟩, orthogonal = ⟨0, 3⟩, scalar = 4, angle = 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. a = 1 or 2, b = -2 or 1 gives projection = ⟨0, 0⟩, orthogonal = ⟨1, 2⟩, dot = 0, scalar = 0, angle = 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. a = 0.5 or 1.5, b = 1 or 1 gives projection = ⟨1, 1⟩, factor = 1, scalar = 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).

## FAQ

### 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.

## Sources

- 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)
