Use perpendicular structure to decompose vectors and compute closest approximations
Orthogonality generalizes perpendicularity. Inner products define angles and lengths, orthonormal bases simplify coordinates, projections find closest points in subspaces, and Gram–Schmidt converts an independent set into an orthonormal one without changing its span.
Inner products, norms, and angles
Measure alignment between vectors
Acute alignment
The vectors point generally in the same direction.
Orthogonal
Nonzero vectors meet at a right angle.
Obtuse alignment
The vectors point generally in opposite directions.
The Cauchy–Schwarz inequality |u·v|≤‖u‖‖v‖ guarantees that the cosine formula remains between −1 and 1.
Projection onto a direction
Split a vector into parallel and perpendicular components
Every vector v can be written as v=projᵤ(v)+r, where r=v−projᵤ(v) and u·r=0. The projection is the point on span{u} closest to v.
Do not omit the denominator
The shortcut projᵤ(v)=(v·u)u is valid only when u is a unit vector. For an arbitrary u, divide by u·u.
Projection onto a subspace
Use orthonormal columns whenever possible
If Q has orthonormal columns spanning W, the projection matrix is P=QQᵀ and proj_W(b)=QQᵀb. If A has independent but nonorthonormal columns, P=A(AᵀA)⁻¹Aᵀ.
A projection matrix is idempotent: applying the projection twice has the same effect as applying it once.
Interactive projection and Gram–Schmidt laboratory
Calculate components and construct an orthonormal basis
Dot product, angle, and projection
Three-dimensional calculations are shown numerically; the canvas displays the first two coordinates.
Gram–Schmidt orthonormalization
Enter three row vectors in R³. Dependent vectors are identified and omitted.
Run Gram–Schmidt to construct Q.
QR factorization and least squares
Turn orthogonality into a computational method
Applying Gram–Schmidt to the independent columns of A produces A=QR, where Q has orthonormal columns and R is upper triangular. For least squares, Ax≈b becomes Rx=Qᵀb. Modern software usually uses numerically stable variants such as modified Gram–Schmidt or Householder reflections.
Why Q helps
QᵀQ=I, so coordinates in the Q basis are simple dot products.
Why R helps
Upper-triangular systems are solved efficiently by back substitution.
Review questions
Check angles, projections, and orthonormal structure