The Gram–Schmidt Process & QR Factorization
Orthonormal bases are wonderful to compute with — but where do they come from? The Gram–Schmidt process manufactures one from any basis, normalizing and then, for each later vector, subtracting its projection onto the span of the vectors already processed before normalizing what remains (Theorem 8.15). The result depends on the order of the inputs (Remark 8.6), and when the vectors are the columns of a matrix the whole computation repackages into the QR factorization , with orthonormal and upper triangular with positive diagonal (Theorem 8.16).
Before you start — give these a try
Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.
In Example 8.7 the first unit vector is . Compute the projection coefficient used to form , where . (This equals the off-diagonal entry .)
For and , compute the orthogonal projection — the part of that Gram–Schmidt subtracts off. Enter it as a vector.
What you’ll be able to do
- State and carry out Theorem 8.15: set , then for each later vector subtract its projection onto the span of the vectors already processed and normalize.
- Compute the perpendicular component and the resulting unit vector .
- Explain Remark 8.6: the orthonormal basis depends on the order of the input vectors, and each is determined only up to sign, so the basis is not unique.
- State Theorem 8.16 and read the entries of off the Gram–Schmidt data: (with ) and for .
- Run a full Gram–Schmidt computation end to end (as in Example 8.7) and package the columns of as a QR factorization with positive diagonal.
In your course
· MATH2015 · Linear Algebra & Probability- Theorem 8.15The Gram–Schmidt processNormalizing and, for , subtracting the projection of onto before normalizing, yields an orthonormal basis of with .
- Remark 8.6Order dependence of the processThe orthonormal basis produced by Gram–Schmidt depends on the order of the original vectors; different orderings produce different orthonormal bases.
- Theorem 8.16QR factorizationA matrix with linearly independent columns factors as , where has orthonormal columns () and is upper triangular with positive diagonal entries ; with this convention the factorization is unique.
- Example 8.7Orthonormal basis of a subspace of
- Example 8.8QR factorization of a matrix via Gram–Schmidt
From a basis to an orthonormal basis
Having seen how convenient orthonormal bases are, a natural question is how to build one. Given a basis of a subspace (with the standard dot product), the Gram–Schmidt process produces an orthonormal basis of the same space , one vector at a time. The first step is pure normalization: since , set Every later must be a unit vector orthogonal to all the ones before it, i.e. . The idea is to strip from the part that already lies in that span, leaving a genuinely new, perpendicular direction that we then scale to unit length.
The general step: subtract the projection
Suppose are already built. Resolve relative to the subspace . The parallel part is the orthogonal projection, and subtracting it leaves the perpendicular part Because the are orthonormal, each projection coefficient is simply the dot product , and the result is orthogonal to every earlier . Normalizing gives the next basis vector (Theorem 8.15). The division is always legal: is linearly independent of , so .
Order dependence and non-uniqueness
Gram–Schmidt is deterministic once the order of the inputs is fixed — but that order is a real choice. Remark 8.6: different orderings of generally produce different orthonormal bases of the same subspace. The reason is structural: is always a unit vector along the first input, so whichever vector is fed in first steers everything after it. There is a second, smaller ambiguity: replacing any by leaves the set orthonormal, so even for a fixed order each output vector is pinned down only up to sign. This is why, when we want an answer with a single correct value, we test invariant quantities — a projection onto a fixed span, a length , or a coefficient (with ) — rather than asking for the orthonormal basis itself.
The QR factorization
Gram–Schmidt is really a change of basis from to the orthonormal . Rearranging the step formula, each original vector is a combination of the new ones, , which collects columnwise into This is the QR factorization (Theorem 8.16). Here has orthonormal columns, so , and is upper triangular because is built from only — never a later . Its entries come straight from the process: for , and the diagonal (with ). Insisting on this positive diagonal makes and unique.
Let be a basis of a subspace . For , resolve with respect to , where Then and for form an orthonormal basis of , and for every .
The orthonormal basis produced by the Gram–Schmidt process depends on the order of the vectors in the original basis: different orderings of generally produce different orthonormal bases of the same subspace .
Let be an matrix with linearly independent columns . Then , where is the matrix with orthonormal columns produced by Gram–Schmidt (so ), and is the upper-triangular matrix with (and ) on the diagonal and above it. With this positive-diagonal convention the factorization is unique.
Worked examples
Find an orthonormal basis of the subspace spanned by and (Example 8.7).
- 1
Normalize . Its length is , so
- 2
Projection coefficient. Compute
- 3
Subtract the projection. The perpendicular component is
- 4
Orthogonality check. , as required.
- 5
Normalize . Its length is , so
Apply the full Gram–Schmidt process to , , to obtain an orthonormal basis of .
Using the Gram–Schmidt computation from Example 8.7, write the QR factorization of (whose columns are ), with having a positive diagonal.