Orthogonality
View .md

Gram-Schmidt Process

The Gram-Schmidt process converts any set of independent vectors into an orthogonal basis for the same space.

Algorithm

Given vectors a1,a2,…,an\mathbf{a}_1, \mathbf{a}_2, \ldots, \mathbf{a}_n:

  1. q1=a1∥a1∥\mathbf{q}_1 = \frac{\mathbf{a}_1}{\|\mathbf{a}_1\|}

  2. q2=a2−(a2⋅q1)q1∥⋯∥\mathbf{q}_2 = \frac{\mathbf{a}_2 - (\mathbf{a}_2 \cdot \mathbf{q}_1)\mathbf{q}_1}{\|\cdots\|}

  3. q3=a3−(a3⋅q1)q1−(a3⋅q2)q2∥⋯∥\mathbf{q}_3 = \frac{\mathbf{a}_3 - (\mathbf{a}_3 \cdot \mathbf{q}_1)\mathbf{q}_1 - (\mathbf{a}_3 \cdot \mathbf{q}_2)\mathbf{q}_2}{\|\cdots\|}

Each step: subtract the projections onto all previous q\mathbf{q}'s, then normalize.

QR Factorization

Gram-Schmidt produces:

A=QRA = QR

Where:

  • QQ — orthogonal matrix (columns are orthonormal)
  • RR — upper triangular matrix

Why QR Is Better Than AA

  • QTQ=IQ^TQ = I (easy to invert)
  • Solving Ax=bAx = b becomes Rx=QTbRx = Q^Tb (no need for ATAA^TA)