Orthogonality and Projections

1 min read

Two vectors are orthogonal if ab=0\mathbf{a} \cdot \mathbf{b} = 0. An orthonormal set has all vectors mutually orthogonal with unit length.

Projection of b\mathbf{b} onto a\mathbf{a}:

projab=abaaa\text{proj}_{\mathbf{a}}\mathbf{b} = \frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{a} \cdot \mathbf{a}}\mathbf{a}

Projection onto a subspace spanned by orthonormal columns QQ: proj=QQb\text{proj} = QQ^\top\mathbf{b}.

Gram-Schmidt process: takes any basis and produces an orthonormal one — iteratively subtract projections onto previous vectors and normalize.

Key properties of orthogonal matrices (QQ=IQ^\top Q = I):

  • They preserve lengths and angles (rotations and reflections)
  • Q1=QQ^{-1} = Q^\top — trivially cheap to invert
  • Condition number is 1 → numerically stable

Where this appears in ML:

  • Principal Component Analysis (PCA) — finds orthogonal directions of maximum variance
  • Singular Value Decomposition (SVD) — decomposes any matrix into orthogonal rotations + scaling
  • Attention — queries and keys live in spaces where dot product measures alignment; orthogonal means "unrelated"
  • Weight orthogonalization — initialization and regularization technique to preserve gradient norms
  • Least squares — the residual bAx^\mathbf{b} - A\hat{\mathbf{x}} is orthogonal to the column space of AA

See also: Dot Product, Vector Spaces and Basis, Singular Value Decomposition (SVD)

Linked from