Let W be a subspace of Rn (or of a finite-dimensional inner product space V). Every b can be written uniquely as
b=p+e,p∈W,e∈W⊥,
where W⊥ is the orthogonal complement of W. The vectorp=projWb is the orthogonal projection of b onto W, and e=b−p is the error. The map b↦projWb is a linear map; its matrixP is the orthogonal projection matrix onto W.
Drop a perpendicular from b to W: its foot is p. The error is orthogonal to every vector of W, not just to p; checking e⊥p alone is not enough.
In the figure, e stands perpendicular to the whole planeW, not only to p. For any other w∈W the points b,p,w form a right triangle with the right angle at p, so the hypotenuse ∥b−w∥ is longer than ∥e∥. Pythagoras makes this exact: ∥b−w∥2=∥e∥2+∥p−w∥2. So orthogonality is what makes p the closest point of W to b in the Euclidean norm; this best-approximation property is the basis of least squares.
Move the entries of b and switch between a line and a plane W: the error e=b−p stays perpendicular to W. Switch on the comparison to see that every other w∈W lies farther from b than p.
Best approximation: ∥b−projWb∥<∥b−w∥ for every w∈W with w=projWb.
Onto a line spanned by a=0:p=a⊤aa⊤ba and P=a⊤aaa⊤.
With an orthonormalbasisq1,…,qk of W as columns of Q:p=i∑(qi⊤b)qi and P=QQ⊤.
If W=Col(A), the column space of an n×k matrix A of full column rank: P=A(A⊤A)−1A⊤.
A square matrixP is an orthogonal projection matrix if and only if P2=P and P⊤=P; it then projects onto its column space.
Every orthogonal projection matrix is idempotent, but oblique projections are idempotent without being symmetric, so not every idempotent matrix is an orthogonal projection.
I−P is the orthogonal projection onto W⊥, and ∥Pb∥≤∥b∥.
Onto a line. Project b=(1,2,3)⊤ onto the line spanned by a=(1,1,1)⊤:a⊤b=6 and a⊤a=3, so p=(2,2,2)⊤ and e=(−1,0,1)⊤. Check a⊤e=0. The distance from b to the line is ∥e∥=2.
Onto a plane. Let W=Col(A) with A=101010 and b=(1,2,5)⊤. Then A⊤A=diag(2,1),A⊤b=(6,2)⊤, so the coefficients are (3,2)⊤ and
p=(3,2,3)⊤,e=(−2,0,2)⊤,P=2102101021021.
The error is orthogonal to both columns, P is symmetric with P2=P, and trP=2=dimW.
Aliases: orthogonal projector, projection onto a subspace, perpendicular projection
Keywords: proj_W b, P = A(A^T A)^{-1} A^T, P = Q Q^T, (a^T b / a^T a) a, best approximation, projection matrix
Symbols: element of, real numbers, square root, sum
Last updated: 22 October 2026 19:04
Orthogonal ProjectionGram-Schmidt AlgorithmLeast SquaresMoore-Penrose InverseInner ProductEuclidean NormOrthogonal VectorsOrthogonal ComplementIdempotent MatrixDistance Between a Point and a LineOrthonormal Basis