Tutorials › Linear Algebra › Proof That Gram-Schmidt Preserves Spans

Orthogonal Sets and Gram-Schmidt · Tutorial 648 of 1000

Proof That Gram-Schmidt Preserves Spans

Learn why the Gram–Schmidt recursion leaves the span of each initial segment unchanged, and how to verify that claim from its formulas.

Intermediate 11 min read

What You'll Learn

  • State the Gram–Schmidt recursion and the conditions under which it is defined.
  • Prove that each output belongs to the span of the inputs up to that stage.
  • Recover each input from its output and the preceding outputs.
  • Deduce equality of the corresponding initial-segment spans.
  • Check span preservation in Euclidean and polynomial examples.
  • Identify and correct an incorrect projection coefficient.

What Span Preservation Says

Gram–Schmidt changes the vectors in a list by subtracting components along earlier outputs. That subtraction alters the individual vectors, but it does not alter the set of vectors that all the list members can produce by linear combinations. More precisely, at every stage, the first \(k\) inputs and the first \(k\) outputs span the same subspace. The key is to use the recursion twice: once to express each output using inputs, and once to recover each input using outputs.

Let \(V\) be an inner product space over \(\mathbb{F}\), where \(\mathbb{F}\) is \(\mathbb{R}\) or \(\mathbb{C}\). For a list \(\mathbf{v}_1,\dots,\mathbf{v}_k\), its span, \(\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}\), is the set of all linear combinations \(c_1\mathbf{v}_1+\cdots+c_k\mathbf{v}_k\), with \(c_i\in\mathbb{F}\). A span is a set of vectors, while the input and output collections in Gram–Schmidt are ordered lists.

We use the inner product convention that the first slot is linear. Given inputs \(\mathbf{v}_1,\dots,\mathbf{v}_m\), the unnormalized Gram–Schmidt outputs are defined recursively by

$$ \mathbf{u}_1=\mathbf{v}_1,\qquad \mathbf{u}_k=\mathbf{v}_k-\sum_{j=1}^{k-1} \frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle} {\langle\mathbf{u}_j,\mathbf{u}_j\rangle}\mathbf{u}_j \quad (2\le k\le m). $$

Each denominator must be nonzero, so to carry out the recursion through stage \(m\), the outputs \(\mathbf{u}_1,\dots,\mathbf{u}_{m-1}\) must be nonzero. The last output \(\mathbf{u}_m\) may be zero: its formula only divides by earlier outputs. Normalizing outputs to have length one is a separate step and is not needed for the span argument.

Theorem (Span preservation): Suppose the Gram–Schmidt recursion is defined through stage \(m\) for \(\mathbf{v}_1,\dots,\mathbf{v}_m\in V\). Then, for every \(k\) with \(1\le k\le m\), \(\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}=\operatorname{span}\{\mathbf{u}_1,\dots,\mathbf{u}_k\}\).

Why the Recursion Gives Both Inclusions

Equality of spans means proving two containments. The recursion directly writes \(\mathbf{u}_k\) as \(\mathbf{v}_k\) minus a linear combination of earlier outputs. This places the new output in the span of the current input and earlier outputs. In the other direction, rearranging the same formula writes \(\mathbf{v}_k\) as the new output plus a linear combination of earlier outputs. Induction then makes each containment precise.

Proof. We prove the two containments for each initial segment by induction on \(k\). For \(k=1\), \(\mathbf{u}_1=\mathbf{v}_1\), so the spans are equal. Assume the spans agree at stage \(k-1\), where \(2\le k\le m\). The recursion gives \(\mathbf{u}_k=\mathbf{v}_k-\sum_{j=1}^{k-1}\frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle}{\langle\mathbf{u}_j,\mathbf{u}_j\rangle}\mathbf{u}_j\). Every \(\mathbf{u}_j\) in this sum belongs to \(\operatorname{span}\{\mathbf{u}_1,\dots,\mathbf{u}_{k-1}\}=\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\}\). Therefore \(\mathbf{u}_k\in\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}\). The earlier outputs also belong to this span by the induction hypothesis. Thus \(\operatorname{span}\{\mathbf{u}_1,\dots,\mathbf{u}_k\}\subseteq\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}\). Rearranging the recursion gives \(\mathbf{v}_k=\mathbf{u}_k+\sum_{j=1}^{k-1}\frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle}{\langle\mathbf{u}_j,\mathbf{u}_j\rangle}\mathbf{u}_j\). This puts \(\mathbf{v}_k\) in \(\operatorname{span}\{\mathbf{u}_1,\dots,\mathbf{u}_k\}\), and the earlier inputs belong there by the induction hypothesis. Hence \(\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}\subseteq\operatorname{span}\{\mathbf{u}_1,\dots,\mathbf{u}_k\}\). The two containments prove equality at stage \(k\), completing the induction. \(\square\)

The proof does not require that the inputs be linearly independent. It requires only that the recursion be defined: each denominator used must come from a nonzero earlier output. If the final output is zero, the formula still proves the span equality at that final stage.

Reading the Two Directions in a Calculation

Worked Example: Two Vectors in R²

Apply Gram–Schmidt to \(\mathbf{v}_1=(1,1)\) and \(\mathbf{v}_2=(1,0)\) using the usual dot product. Compute the outputs and show how the second vector is recovered.

The first output is \(\mathbf{u}_1=\mathbf{v}_1=(1,1)\), and \(\langle\mathbf{u}_1,\mathbf{u}_1\rangle=1^2+1^2=2\). The coefficient of \(\mathbf{u}_1\) in the second step is

$$ \frac{\langle\mathbf{v}_2,\mathbf{u}_1\rangle} {\langle\mathbf{u}_1,\mathbf{u}_1\rangle} =\frac{(1)(1)+(0)(1)}{2} =\frac12. $$

Thus the second output is \(\mathbf{u}_2=(1,0)-\frac12(1,1)=(\frac12,-\frac12)\). The recursion itself gives \(\mathbf{u}_2\in\operatorname{span}\{\mathbf{v}_1,\mathbf{v}_2\}\), and rearranging it recovers \(\mathbf{v}_2=\mathbf{u}_2+\frac12\mathbf{u}_1\). Also \(\mathbf{v}_1=\mathbf{u}_1\), so every input lies in the span of the outputs, while both outputs are combinations of the inputs. Therefore the two lists have the same span.

Check: The recovered vector is \((\frac12,-\frac12)+\frac12(1,1)=(1,0)=\mathbf{v}_2\). The outputs are orthogonal because \(\langle\mathbf{u}_1,\mathbf{u}_2\rangle=(1)(\frac12)+(1)(-\frac12)=0\).

The containment argument depends on the structure of the formulas, not on the particular coordinates. At each stage, the new output is the current input plus a combination of earlier outputs. Conversely, the current input is the new output plus a combination of those same earlier outputs. The next examples show this structure in a three-vector calculation and in a space that is not \(\mathbb{R}^n\).

Worked Example: Three Vectors in R³

For \(\mathbf{v}_1=(1,0,1)\), \(\mathbf{v}_2=(1,1,0)\), and \(\mathbf{v}_3=(0,1,1)\), calculate the unnormalized outputs and explicitly recover each input.

First, \(\mathbf{u}_1=(1,0,1)\), with \(\langle\mathbf{u}_1,\mathbf{u}_1\rangle=2\). For the second input, \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle=1\), so

$$ \mathbf{u}_2=\mathbf{v}_2-\frac12\mathbf{u}_1 =(1,1,0)-\frac12(1,0,1) =\left(\frac12,1,-\frac12\right). $$

Its squared norm is \(\frac14+1+\frac14=\frac32\). For the third input, the coefficients are

$$ \frac{\langle\mathbf{v}_3,\mathbf{u}_1\rangle}{\langle\mathbf{u}_1,\mathbf{u}_1\rangle} =\frac{1}{2}, \qquad \frac{\langle\mathbf{v}_3,\mathbf{u}_2\rangle}{\langle\mathbf{u}_2,\mathbf{u}_2\rangle} =\frac{\frac12}{\frac32} =\frac13. $$

Therefore

$$ \begin{aligned} \mathbf{u}_3 &=\mathbf{v}_3-\frac12\mathbf{u}_1-\frac13\mathbf{u}_2\\ &=(0,1,1)-\left(\frac12,0,\frac12\right) -\left(\frac16,\frac13,-\frac16\right)\\ &=\left(-\frac23,\frac23,\frac23\right). \end{aligned} $$

The formulas recover the inputs as \(\mathbf{v}_1=\mathbf{u}_1\), \(\mathbf{v}_2=\mathbf{u}_2+\frac12\mathbf{u}_1\), and \(\mathbf{v}_3=\mathbf{u}_3+\frac12\mathbf{u}_1+\frac13\mathbf{u}_2\). Hence each initial input span equals its corresponding output span. For instance, at stage three, the last reconstruction checks as \(\left(-\frac23,\frac23,\frac23\right)+(\frac12,0,\frac12)+(\frac16,\frac13,-\frac16)=(0,1,1)\).

Check: The subtractions give orthogonal outputs: \(\langle\mathbf{u}_1,\mathbf{u}_2\rangle=\frac12-\frac12=0\), \(\langle\mathbf{u}_1,\mathbf{u}_3\rangle=-\frac23+\frac23=0\), and \(\langle\mathbf{u}_2,\mathbf{u}_3\rangle=-\frac13+\frac23-\frac13=0\). These checks agree with the computed projections.

The Same Argument in a Polynomial Space

Worked Example: Initial Spans in P₂

Let \(V=P_2\), the real polynomials of degree at most two, with inner product \(\langle f,g\rangle=\int_0^1 f(x)g(x)\,dx\). Apply Gram–Schmidt to \(v_1(x)=1\), \(v_2(x)=x\), and \(v_3(x)=x^2\), and verify the reconstruction formulas.

The first output is \(u_1(x)=1\), and \(\langle u_1,u_1\rangle=\int_0^1 1\,dx=1\). Since \(\langle x,1\rangle=\int_0^1x\,dx=\frac12\), the next output is \(u_2(x)=x-\frac12\). Its squared norm is

$$ \langle u_2,u_2\rangle =\int_0^1\left(x-\frac12\right)^2dx =\frac13-\frac12+\frac14 =\frac1{12}. $$

For \(x^2\), the coefficient of \(u_1\) is \(\langle x^2,1\rangle/\langle1,1\rangle=\frac13\). The coefficient of \(u_2\) is \(\langle x^2,u_2\rangle/\langle u_2,u_2\rangle\), where

$$ \langle x^2,u_2\rangle =\int_0^1\left(x^3-\frac12x^2\right)dx =\frac14-\frac16 =\frac1{12}. $$

Thus that second coefficient is \(1\), and \(u_3(x)=x^2-\frac13-u_2(x)=x^2-x+\frac16\). The reverse formulas are \(v_1=u_1\), \(v_2=u_2+\frac12u_1\), and \(v_3=u_3+u_2+\frac13u_1\). The last identity checks directly: \(x^2-x+\frac16+x-\frac12+\frac13=x^2\). Both directions of the recursion therefore give the same initial spans for these polynomial lists.

Check: The outputs are orthogonal in the stated inner product. We have \(\langle u_1,u_2\rangle=\int_0^1(x-\frac12)\,dx=0\) and \(\langle u_1,u_3\rangle=\int_0^1(x^2-x+\frac16)\,dx=\frac13-\frac12+\frac16=0\). For the remaining pair, expanding the product gives \(u_3u_2=x^3-\frac32x^2+\frac23x-\frac1{12}\), whose integral is \(\frac14-\frac12+\frac13-\frac1{12}=0\).

A Triangular View of the Formulas

Proposition: At each stage \(k\), the output \(\mathbf{u}_k\) is the input \(\mathbf{v}_k\) plus a linear combination of \(\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\). Conversely, \(\mathbf{v}_k\) is \(\mathbf{u}_k\) plus a linear combination of \(\mathbf{u}_1,\dots,\mathbf{u}_{k-1}\).

Proof. The second statement is the recursion rearranged: \(\mathbf{v}_k=\mathbf{u}_k+\sum_{j=1}^{k-1}\frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle}{\langle\mathbf{u}_j,\mathbf{u}_j\rangle}\mathbf{u}_j\). For the first statement, use induction. At \(k=1\), \(\mathbf{u}_1=\mathbf{v}_1\), so the statement holds with an empty sum. Suppose each \(\mathbf{u}_j\), for \(j<k\), is \(\mathbf{v}_j\) plus a combination of earlier inputs. Substituting those expressions into \(\mathbf{u}_k=\mathbf{v}_k-\sum_{j=1}^{k-1}\frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle}{\langle\mathbf{u}_j,\mathbf{u}_j\rangle}\mathbf{u}_j\) expresses \(\mathbf{u}_k\) as \(\mathbf{v}_k\) plus a combination of \(\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\). This proves the first statement at stage \(k\), and induction completes the proof. \(\square\)

The word “triangular” describes the restriction that stage \(k\) only involves vectors from stages \(1\) through \(k\); later vectors never enter its formula. It is another way to understand why each initial segment has the same span: each list can be built from the other without using any vector beyond the same stage.

Common Pitfall: Omitting the Denominator

A projection coefficient is not generally just \(\langle\mathbf{v}_k,\mathbf{u}_j\rangle\). It also divides by the squared norm of the vector being projected onto. In the first worked example, the incorrect calculation \(\mathbf{u}_2=(1,0)-1(1,1)=(0,-1)\) uses the inner product \(1\) as the coefficient and omits the denominator \(\langle\mathbf{u}_1,\mathbf{u}_1\rangle=2\). It fails the defining orthogonality check: \(\langle(0,-1),(1,1)\rangle=-1\ne0\). The correction is to use \(1/2\), yielding \(\mathbf{u}_2=(1/2,-1/2)\) and \(\langle\mathbf{u}_2,\mathbf{u}_1\rangle=1/2-1/2=0\).

Span preservation is a statement about the list at every stage, not just about the final output collection. It follows from two explicit identities: the recursion expresses an output through the current input and earlier outputs, and its rearrangement expresses the current input through the current output and earlier outputs. Keeping both directions visible prevents a one-sided containment from being mistaken for equality.

Check Your Understanding

Use the recursion and the two-containment argument to answer these questions.

  1. In one sentence, state what equality of the input and output spans means for an initial segment.
  2. Why must the earlier outputs in the recursion be nonzero?
  3. For \(\mathbf{u}_2=\mathbf{v}_2-c\mathbf{u}_1\), write the formula that recovers \(\mathbf{v}_2\) from the outputs.
  4. In the polynomial example, verify directly that \(v_2=u_2+\frac12u_1\).
  5. Does the span-preservation proof require that the final output be nonzero? Explain using the recursion formula.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon