Gram–Schmidt Orthogonalization
Statement
Let be an inner product space and a finite sequence of vectors. The Gram–Schmidt process produces vectors defined by
satisfying:
- Orthogonality: for .
- Span preservation: for all .
If the are linearly independent, no is zero and normalizing gives an orthonormal basis.
Visualization
Orthogonalize , , in :
Step 1: e1 = f1 = (1, 1, 0)
||e1||^2 = 2
Step 2: proj of f2 onto e1 = <f2,e1>/<e1,e1> * e1
= (1*1+0*1+1*0)/2 * (1,1,0)
= 1/2 * (1,1,0) = (1/2, 1/2, 0)
e2 = f2 - proj = (1,0,1) - (1/2,1/2,0) = (1/2, -1/2, 1)
||e2||^2 = 1/4 + 1/4 + 1 = 3/2
Step 3: proj of f3 onto e1 = <f3,e1>/2 * e1
= (0+1+0)/2 * (1,1,0) = (1/2, 1/2, 0)
proj of f3 onto e2 = <f3,e2>/(3/2) * e2
= (0+(-1/2)+1)/(3/2) * (1/2,-1/2,1)
= (1/2)/(3/2) * (1/2,-1/2,1)
= 1/3 * (1/2,-1/2,1) = (1/6,-1/6,1/3)
e3 = f3 - (1/2,1/2,0) - (1/6,-1/6,1/3)
= (0,1,1) - (4/6, 2/6, 2/6)
= (-2/3, 2/3, 2/3)
Check: <e1,e2> = 1/2 - 1/2 + 0 = 0 ✓
<e1,e3> = -2/3 + 2/3 + 0 = 0 ✓
<e2,e3> = -1/3 - 1/3 + 2/3 = 0 ✓
Proof Sketch
- Orthogonality by induction. Assume are pairwise orthogonal. For : , since all other subtracted terms are orthogonal to by hypothesis.
- Span preservation. Each differs from by a linear combination of , which by induction equals a combination of . So and , giving equality of spans.
- Nonzero output. If the are linearly independent, , so .
Connections
Gram–Schmidt is the foundational step in constructing QR DecompositionQR DecompositionEvery invertible real matrix factors as a product of an orthogonal matrix and an upper-triangular matrix.Read more → and in proving the Spectral TheoremSpectral TheoremEvery real symmetric matrix is orthogonally diagonalizableRead more → (where an eigenbasis can always be orthonormalized). The span-preservation property mirrors the row-span invariance of Rank–Nullity TheoremRank–Nullity TheoremThe dimensions of image and kernel of a linear map sum to the domain dimensionRead more →.
Lean4 Proof
-- Mathlib: Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
-- Two key theorems about `gramSchmidt`:
-- gramSchmidt_orthogonal : pairwise orthogonal output
-- span_gramSchmidt : output spans the same subspace as input
open inner_product_geometry in
theorem gs_pairwise_orthogonal
(ι : Type*) [LinearOrder ι] [LocallyFiniteOrder ι]
(E : Type*) [RCLike ℝ] [SeminormedAddCommGroup E] [InnerProductSpace ℝ E]
(f : ι → E) :
Pairwise fun a b => @inner ℝ E _ (gramSchmidt ℝ f a) (gramSchmidt ℝ f b) = 0 :=
gramSchmidt_pairwise_orthogonal ℝ f
theorem gs_span_eq
(ι : Type*) [LinearOrder ι] [LocallyFiniteOrder ι]
(E : Type*) [RCLike ℝ] [SeminormedAddCommGroup E] [InnerProductSpace ℝ E]
(f : ι → E) :
Submodule.span ℝ (Set.range (gramSchmidt ℝ f)) =
Submodule.span ℝ (Set.range f) :=
span_gramSchmidt ℝ fReferenced by
- Singular Value DecompositionLinear Algebra
- QR DecompositionLinear Algebra