Skip to content

Orthogonal Projection Calculator

Project a vector onto another vector or onto the column space of a matrix, with the orthogonal component.

AvailableRuns in your browserFree · No sign-up

Orthogonal Projection Calculator

Project onto

Comma- or space-separated.

Calculations use full double precision; this only affects display.

projₐ(b)

(1.4444, 2.8889, 2.8889)

= (13 ÷ 9) × a = 1.4444 × (1, 2, 2)
Dot product b·a
13
a·a
9
Scalar projection
4.3333
(b·a)/|a|, signed
Projection length
4.3333
Orthogonal component
(1.5556, -1.8889, 1.1111)
b − projₐ(b)
Its length
2.6874
  • Orthogonality check: (b − p)·a = 0 ✓ (zero to rounding)
  • Reconstruction check: |p + (b − p) − b| = 0 ✓
Step by step
  1. b·a = (3)(1) + (1)(2) + (4)(2) = 13
  2. a·a = (1)² + (2)² + (2)² = 9
  3. (b·a)/(a·a) = 1.4444, so projₐ(b) = 1.4444 · a = (1.4444, 2.8889, 2.8889)
  4. Orthogonal component: b − projₐ(b) = (1.5556, -1.8889, 1.1111)

Formulas

projₐ(b) = ((b · a) ÷ (a · a)) a

The projection is the closest point to b on the line through a; the orthogonal component b − projₐ(b) is perpendicular to a. If a is the zero vector there is no direction, so the projection is undefined.

proj(b) = QrQrᵀ b

For a subspace spanned by the columns of A, an orthonormal basis Qr from a stable QR factorization avoids forming AᵀA (which squares the condition number). Dependent columns are detected by the rank tolerance and don't change the subspace.

Your data is processed locally in your browser and is not uploaded to OZVILO servers.

How to use the Orthogonal Projection Calculator

  1. 1Choose whether to project onto a single vector or onto the column space of a matrix.
  2. 2Enter vector b, and either the direction vector a or the matrix A.
  3. 3Read the projection, the orthogonal component and its length, with checks that they're perpendicular.
  4. 4Open the steps or the orthonormal basis to follow the working.

Examples

  • Onto a vector

    Input
    b = (3, 1, 4), a = (1, 2, 2)
    Result
    projₐ(b) = (13/9)·a ≈ (1.4444, 2.8889, 2.8889)
  • Onto a plane

    Input
    b = (6, 0, 0), A columns (1, 1, 1) and (0, 1, 2)
    Result
    p = (5, 2, −1) · coefficients (5, −3) · distance 2.4495

Orthogonal Projection Calculator features

  • Projection onto a vector or a subspace
  • Orthogonal component and distance
  • Least-squares coefficients for full-rank A
  • Stable QR basis, rank detection

Frequently asked questions

What is the formula for projecting onto a vector?

projₐ(b) = ((b·a) ÷ (a·a)) × a. The result is the point on the line through a that is closest to b, and b − projₐ(b) is perpendicular to a.

How does projection onto a subspace work?

The tool builds an orthonormal basis Q of the column space with Householder QR and computes p = QQᵀb. This avoids the normal equations AᵀA, which can lose accuracy.

What if the columns of A are dependent?

The subspace is still well defined, so the projection is unique, but the coefficients aren't. The tool reports the rank and hides the coefficients in that case.

Can I project onto the zero vector?

No — the zero vector has no direction, so the projection is undefined, and the tool says so.