An orthogonal basis is valuable, but most bases are not orthogonal when they are first given to you. Gram-Schmidt is the standard procedure that repairs that problem.
It starts from any linearly independent list and systematically removes the components that point in already-used directions. What remains is orthogonal, and the span is preserved at every step.
The projection idea behind Gram-Schmidt
Suppose are already orthogonal and w is any vector. If you
want the part of w that is perpendicular to every , you subtract the
components of w along those vectors:
Theorem
Orthogonal remainder theorem
Let be an orthogonal subset of , and let . Define
Then v is perpendicular to each .
This theorem is the engine of the algorithm. It tells you exactly how to build a new vector orthogonal to all the old ones.
Gram-Schmidt process
Theorem
Gram-Schmidt orthogonalization process
Let be a linearly independent subset of . Define
and for ,
Then:
- is orthogonal;
- for each ,
In particular, the final orthogonal set spans the same subspace as the original linearly independent set.
The second conclusion matters as much as the first. Gram-Schmidt does not merely produce some orthogonal vectors. It preserves the exact subspace you started with.
How to read the algorithm
The first vector is unchanged:
The second vector is the part of orthogonal to .
The third vector is the part of orthogonal to both and .
And so on. Each step removes everything already accounted for by the earlier orthogonal directions.
Worked example
A short Gram-Schmidt computation in R^3
Start with the linearly independent vectors
Set
Now compute
so
Next,
Therefore
The resulting set
is orthogonal and spans the same subspace as the original list.
From orthogonal to orthonormal
Gram-Schmidt gives an orthogonal basis. To get an orthonormal basis, normalize each nonzero vector:
Theorem
Every subspace has an orthonormal basis
Let be a subspace of . Then has an orthogonal basis, and after normalization it also has an orthonormal basis.
So orthonormal bases are not rare or special accidents. Every finite-dimensional subspace of admits one.
Worked example
Normalize the Gram-Schmidt output
Using the vectors from the previous example:
So an orthonormal basis is
Common mistake
Common mistake
Do not subtract projections onto the original w-vectors
In the recursive formula, each new vector must be built using the already constructed orthogonal vectors , not the original . If you subtract components along the original non-orthogonal vectors, the output need not become orthogonal.
Quick check
Quick check
What is the first Gram-Schmidt vector v_1?
Look at the definition.
Solution
Answer
Quick check
What property does Gram-Schmidt preserve besides orthogonality?
Think about the span conclusion in the theorem.
Solution
Answer
Quick check
How do you turn an orthogonal basis into an orthonormal basis?
Use normalization.
Solution
Answer
Exercises
Quick check
Apply the first two steps of Gram-Schmidt to and .
Compute , then subtract the component of along .
Solution
Guided solution
Quick check
Why does Gram-Schmidt require the original list to be linearly independent?
Think about what could happen to one of the new vectors.
Solution
Guided solution
Quick check
Suppose Gram-Schmidt gives orthogonal vectors with norms 3 and 4. What are the corresponding orthonormal vectors?
Normalize each one separately.
Solution
Guided solution
Related notes
Read 9.2 Orthogonal sets and orthonormal bases first, because Gram-Schmidt is built from the orthogonal coefficient formula.
The existence theorem here is one of the main practical tools for working with subspaces introduced earlier in 6.2 Subspaces and 6.5 Basis and dimension.
The equality cases in the next note, 9.4 Cauchy-Schwarz and triangle inequalities, explain why the projection steps here behave geometrically.