Back

Gram-Schmidt Orthogonalization

Two vectors that lean on each other, turned into a clean perpendicular pair. Gram-Schmidt keeps the first direction, $q_1 = v_1/|v_1|$, then strips out of $v_2$ everything that points along $q_1$: it subtracts the projection $(v_2\cdot q_1)\,q_1$, and what is left, the residual, is perpendicular to $q_1$ by construction. Normalize it and you have $q_2$. The scene animates that subtraction, the projection sliding off $v_2$ to leave the right-angle leg; the result is an orthonormal frame. The diagnostic sweeps $v_2$'s direction and plots the residual length, which vanishes when $v_2$ lines up with $v_1$ (nothing left to orthogonalize) and is largest when they are already perpendicular.

Figure 1. Gram-Schmidt orthogonalization in 2D. Top: v₁ and v₂, the projection of v₂ onto q₁, the perpendicular residual, and the resulting orthonormal frame q₁, q₂. Bottom: the residual length as v₂'s angle varies, zero when parallel to v₁ and maximal when perpendicular. Method: modified Gram-Schmidt.
v1 angle20
v1 length2.00
v2 angle70
v2 length2.40

WHAT TO TRY

  • Watch the projection (the part of v₂ along q₁) get subtracted off, leaving the perpendicular residual that becomes q₂.
  • Turn v₂ toward v₁: the residual shrinks. When they are parallel it hits zero, and the orthogonalization fails (the vectors are linearly dependent).
  • Turn v₂ to a right angle with v₁: the projection vanishes, the residual equals v₂ itself, and Gram-Schmidt barely changes anything.
  • The output q₁, q₂ stays a unit right-angle frame for every non-degenerate input; check the rail orthogonality readout.