Real inner products, their norms and the needed inequalities
An inner product on a real vector space is a map that is symmetric, linear in each argument, and positive definite: for . Linearity gives . Define . It is zero exactly at zero and satisfies . The standard example on is . Vectors are orthogonal when their inner product is zero, and a list is orthonormal when distinct members are orthogonal and each member has norm one.
If , insert into the nonnegative square . Expanding by bilinearity gives , hence . If the same inequality holds directly. Equality for means , equivalently ; the zero-vector cases also give equality. Finally expand and apply the bound to its cross term to obtain . Both sides to be square-rooted are nonnegative, so the triangle inequality follows. Thus this is a norm, and normalization of any nonzero vector divides by a positive real number. No complex bilinear convention is being used.
Finite basis existence and extension, without a counting assumption
Let be a real vector space supplied with a finite spanning list . First prove that every independent list has length at most . After insertions, maintain a spanning list consisting of and surviving old vectors. Expand in this list. Some coefficient on a surviving old vector is nonzero; otherwise would be in the span of the earlier , contradicting independence. Solve for that old vector and replace it by . The new list spans the same space and keeps every earlier insertion. If , after steps the first independent vectors already span , contradicting independence of . This proves the bound, including .
Every subspace has a finite basis. Start with the empty independent list. If its current span is not , choose one vector of outside that span. A relation with nonzero coefficient on the new vector would express it in the old span, so the enlarged list remains independent. The proved bound permits at most additions; therefore the process stops with an independent spanning list for . If , it stops immediately with the empty basis. Starting instead with any given independent list in proves that list extends to a basis of . Only a bounded finite selection is used. Finally, if two bases have sizes , use each as the finite spanning list in the bound to obtain and . Thus basis size, called dimension, is well-defined. This supplies the existence, extension and dimension facts used in rank–nullity.
Orthonormal bases and extension while retaining prescribed vectors
Suppose in addition that has a real positive-definite inner product. On an independent list , define successively
Inductively the previous are orthonormal. For , taking the inner product with gives . If , then lies in the previous span, a contradiction. Division by its positive norm is therefore legal. The displayed formula and its rearrangement show that the first old and new vectors span the same space, completing the induction. Apply this to a basis to obtain an orthonormal basis, also for a subspace. To extend a prescribed orthonormal list, first extend it to an ordinary basis by the proved theorem and then apply this construction in that order. On the prescribed first vectors no component is subtracted and the norm is one, so every prescribed vector is retained exactly. Empty lists and the zero subspace require no division. This proves the orthonormal extension used in SVD and projection existence.
An orthogonal basis makes inner products and coordinates easy to compute, but a basis usually arrives as an arbitrary linearly independent list. Gram-Schmidt turns that list into an orthogonal one by removing, at each stage, the part already explained by earlier directions. The order of the input matters: changing it can change the output, although the resulting list still spans the same subspace.
The projection idea
First consider one nonzero vector and a vector . To remove a multiple of and leave a perpendicular remainder, choose so that
Since , the denominator is positive and this coefficient is unique. With several mutually orthogonal directions, subtracting one such component does not change the inner products with the others.
Suppose are already nonzero and mutually orthogonal, and let . The coefficient of the component of along is
Thus the part left after removing all earlier orthogonal directions is
The denominators are legal because an orthogonal set contains no zero vector. When , the sum is empty and . This empty case is useful for the zero subspace, but it never asks us to normalize the zero vector.
Theorem
Orthogonal remainder theorem
Let be an orthogonal subset of , and let . Define
Then for every .
For a fixed , expansion gives
All terms with vanish. The remaining term is . If , the formula says that was already in the earlier span; for an arbitrary vector that can happen. Gram-Schmidt avoids this zero remainder by requiring an independent input list.
Projection and membership
For an orthogonal list , the same formula gives a useful membership test. Define
The orthogonal remainder theorem gives . Also,
The forward implication is immediate from the projection formula. Conversely, if , taking the inner product with gives because the cross terms vanish; substitution gives . Thus a nonzero remainder records exactly the part of outside the current span.
Proof
Projection plus an orthogonal remainder
Let and set
Then , and the orthogonal remainder theorem gives for every generator. By linearity, , so . If is empty, the sum is , , and the same statement reads .
Suppose also with and . Then belongs to and is perpendicular to . Consequently , so ; hence and . The decomposition into a part in and an orthogonal remainder is therefore unique.
This decomposition gives a precise meaning to “remove the old directions.” The vector is the part reconstructed from the available orthogonal generators, and is the part that no linear combination of them can explain. If , the membership criterion says , so the projection is all of . If , then and it supplies a new direction perpendicular to every direction already in . In the Gram-Schmidt induction, this is why the next independent input cannot disappear: a zero residual would put it in the earlier span. The uniqueness argument also matters computationally. It says that two different lists of coefficients cannot produce two different “orthogonal parts” of the same vector while both satisfying the defining conditions. The condition forces that ambiguity to vanish, because a real inner product is positive definite. This is the exact geometric content behind the coefficient formula, while the worked calculations show how to evaluate it without relying on a picture.
The Gram-Schmidt process
Theorem
Gram-Schmidt orthogonalization process
Let and let be a linearly independent list in . Define
and, for ,
Then every is nonzero, the vectors are pairwise orthogonal, and for every ,
The empty input list is handled separately: its span is the zero subspace , and its output is the empty orthogonal list. There is no to define and no vector to normalize in that case.
The algorithm must use the constructed orthogonal vectors in the subtractions. The original generally are not orthogonal, so subtracting their projections independently does not remove the correct component.
Proof
The three invariants in the induction
We prove simultaneously at stage that (i) the new vector is nonzero, (ii) the constructed vectors are orthogonal, and (iii) the partial spans are equal. The base case is ; both spans are the same line.
Assume all three statements through . The earlier are nonzero, so every denominator in the definition of is valid. The orthogonal remainder theorem gives for every , proving the new orthogonality.
The defining equation writes as a combination of and earlier , so the new -span is contained in the new -span. Rearranging gives
which gives the reverse inclusion. Finally, if , this equation places in , contradicting input independence. Thus the new vector is nonzero, and all three assertions follow without assuming the conclusion in advance.
This is why orthogonality means more than a list of zero dot products: an orthogonal set also excludes zero vectors. The nonzero check makes normalization legal.
Subtract old directions in three dimensions
Worked example
Three independent vectors in
Take the ordered list
The determinant of the matrix with these columns is , so the input is independent. First,
For the second vector,
For the third, both constructed directions matter:
so
The squared norms are , and direct products give
The span invariant is visible:
Thus the output spans exactly the same as the input.
The arithmetic at the third stage can be audited before accepting the answer: and . The subtraction therefore removes , leaving ; this explains the negative first coordinate rather than treating it as a sign to be guessed.
Counterexample mode
Why original w-vectors cannot replace v-vectors
A tempting but incorrect third step is
This vector has dot product with , so it is not orthogonal to the first direction. The repair is to subtract projections onto and , which gives the correct . The input and constructed lists are different even though their partial spans agree.
Keep fractional projection coefficients exact
Here the projection coefficients are fractions. Keep them exact through each subtraction, then check orthogonality and the equality of spans.
Worked example
Fractional projections in three dimensions
Start with
| Step | Projection data | New orthogonal vector | Span preserved |
|---|---|---|---|
| none | |||
| , |
The input determinant is , so these columns are independent. In particular, the final residual must be nonzero. Here and ; hence the second coefficient in the third row is . The resulting has squared norm , and direct products give .
Normalization and boundary cases
Theorem
From an orthogonal basis to an orthonormal basis
If is an orthogonal basis, define
Every has norm , and scaling preserves pairwise orthogonality. The result is an orthonormal basis of the same subspace.
Worked example
Normalize the first output
For the first example,
Therefore
This uses the first output, not the distinct table input.
Because each norm is positive, keeps the orientation of ; multiplying by recovers the exact vector rather than its negative.
For the unit checks, , , and . Moreover, , so each is recovered from by scaling; both directions of every span equality are preserved.
Worked example
An orthonormal basis from a constraint in
Let
Writing shows that has the basis
These vectors are independent: if , then coordinates 2, 3, and 4 force . The constraint already shows that they lie in .
The process gives
Here and , giving the coefficient . Also , while and , giving . Thus
Their squared norms are . Hence
For example, and ; the displayed scaling factors make all three norms equal to . Each vector has coordinate sum zero and each pair has dot product zero. Since , each is recovered from by scaling, so normalization preserves both directions of every span equality. The nullspace has dimension , so these vectors form an orthonormal basis of .
The arithmetic also verifies the span claim in both directions. From the three definitions,
Conversely, each displayed is built from the corresponding and previous vectors. Thus the change from to is triangular with diagonal coefficient , so no direction is lost. The normalized vectors stay in : for the coordinate sum is , for it is , and for it is . Their squared lengths are respectively , , and , all equal to . These coordinate checks certify the constraint and the normalization independently of the orthogonality calculation.
Theorem
Every finite-dimensional subspace has an orthonormal basis
Every subspace of has a finite basis. In positive dimension, Gram-Schmidt gives a nonzero orthogonal basis, and normalization gives an orthonormal basis. The zero subspace has the empty basis, already orthogonal and orthonormal by the empty-list convention; no division by a norm occurs.
Common mistake
Dependent input creates a zero remainder
If and , then
The next normalization would be undefined. Remove redundant vectors first; Gram-Schmidt is designed for an independent ordered list.
Quick checks
Checkpoint
What is the first Gram-Schmidt vector ?
Read the first line of the recursive definition.
Solution · Answer
It is ; the first input direction is retained.
Checkpoint
What property does Gram-Schmidt preserve besides orthogonality?
Use the partial-span equality.
Solution · Answer
It preserves every partial span: .
Checkpoint
How do you turn an orthogonal basis into an orthonormal basis?
Use the norm of each constructed vector.
Solution · Answer
For every nonzero , divide by its norm: .
Checkpoint
Apply the first two steps to and .
Compute , then the single projection coefficient.
Solution · Guided solution
, and the projection coefficient is . Hence
Check . Also , so the old and new pairs span the same plane.
Checkpoint
Why is a zero remainder a warning for an independent input list?
Relate a zero remainder to the earlier span.
Solution · Guided solution
The remainder is zero exactly when the current vector lies in the earlier span, which contradicts independence.
Checkpoint
Suppose orthogonal vectors have norms 3 and 4. What are the corresponding unit vectors?
Normalize each vector separately.
Solution · Guided solution
They are and ; both have norm and remain orthogonal.
Related notes
Read 9.2 Orthogonal sets and orthonormal bases first, because Gram-Schmidt uses the orthogonal coefficient formula. The constraint-space example also uses the nullspace and basis methods from 6.2 Subspaces and 6.5 Basis and dimension.
The next note, 9.4 Cauchy-Schwarz and triangle inequalities, develops inequalities that bound these inner-product calculations.