Tutorials › Linear Algebra › Why Independent Inputs Give Nonzero Residuals

Orthogonal Sets and Gram-Schmidt · Tutorial 649 of 1000

Why Independent Inputs Give Nonzero Residuals

Learn how a zero Gram–Schmidt residual signals redundancy in the input list, and why independent inputs therefore produce nonzero residuals at every step.

Intermediate 9 min read

What You'll Learn

  • Write the Gram–Schmidt residual using the inner product convention for real or complex spaces
  • Prove that preceding residuals and preceding inputs have the same span
  • Establish that a residual is zero exactly when its input belongs to the preceding span
  • Prove why an independent list produces a nonzero residual at each step
  • Recognize the first zero residual as evidence of dependence
  • Catch projection-coefficient errors that can lead to a false zero residual

The Question Behind a Zero Residual

Gram–Schmidt takes an ordered list of vectors and, one input at a time, subtracts the components lying in the directions already produced. The remaining vector is called a residual. If that residual is zero, the current input has contributed no new direction: it was already obtainable from the earlier inputs. This gives a precise connection between the calculation and linear independence.

Let \(V\) be an inner product space over \(\mathbb{F}\), where \(\mathbb{F}=\mathbb{R}\) or \(\mathbb{C}\), and consider a finite ordered list \(\mathbf{v}_1,\dots,\mathbf{v}_p\). We use the convention that the inner product is linear in its first slot and conjugate-linear in its second. In particular, \(\langle\mathbf{u},\mathbf{u}\rangle>0\) whenever \(\mathbf{u}\ne\mathbf{0}\). A list is linearly independent if the only scalars \(c_1,\dots,c_p\) satisfying \(\sum_{i=1}^p c_i\mathbf{v}_i=\mathbf{0}\) are all zero. The span of an empty list is \(\{\mathbf{0}\}\).

Definition: Suppose the previously constructed Gram–Schmidt residuals \(\mathbf{g}_1,\dots,\mathbf{g}_{k-1}\) are nonzero. Set \(\mathbf{g}_1=\mathbf{v}_1\), and for \(k\ge2\) define $$ \mathbf{g}_k=\mathbf{v}_k-\sum_{j=1}^{k-1} \frac{\langle\mathbf{v}_k,\mathbf{g}_j\rangle} {\langle\mathbf{g}_j,\mathbf{g}_j\rangle}\mathbf{g}_j. $$ The vector \(\mathbf{g}_k\) is the residual at step \(k\). The formula is defined only when the earlier denominators are nonzero.

The fraction in the formula is the coefficient that removes the component along \(\mathbf{g}_j\): because the inner product is linear in its first slot, subtracting that multiple makes the remainder orthogonal to \(\mathbf{g}_j\). Here the central issue is not orthogonality itself, but whether a residual can be zero. The answer depends on what the earlier inputs can already produce.

Earlier Residuals Have the Same Span as Earlier Inputs

At any step where the recursion is defined, each residual is its input minus a combination of preceding residuals. Consequently, replacing the inputs one by one with their residuals does not change the span. This fact lets us translate membership in a span of residuals into membership in a span of the original inputs.

Proposition: If the Gram–Schmidt steps through \(k\) are defined, then for every \(r\) with \(1\le r\le k\), \(\operatorname{span}\{\mathbf{g}_1,\dots,\mathbf{g}_r\}=\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_r\}\).

Proof. For \(r=1\), \(\mathbf{g}_1=\mathbf{v}_1\), so the spans are equal. Assume the equality holds for \(r-1\). The recursion expresses \(\mathbf{g}_r\) as \(\mathbf{v}_r\) minus a combination of \(\mathbf{g}_1,\dots,\mathbf{g}_{r-1}\). Thus \(\mathbf{g}_r\) belongs to \(\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_r\}\), using the induction hypothesis. Every earlier \(\mathbf{g}_j\) also belongs to that span, so \(\operatorname{span}\{\mathbf{g}_1,\dots,\mathbf{g}_r\}\) is contained in it. Conversely, rearranging the recursion expresses \(\mathbf{v}_r\) as \(\mathbf{g}_r\) plus a combination of earlier residuals. The induction hypothesis also puts each earlier input in the span of the earlier residuals. Therefore every input through \(r\) belongs to \(\operatorname{span}\{\mathbf{g}_1,\dots,\mathbf{g}_r\}\). Both inclusions give the claimed equality. \(\square\)

A Zero Residual Is Exactly a Span Membership

Theorem: Suppose Gram–Schmidt has produced nonzero residuals \(\mathbf{g}_1,\dots,\mathbf{g}_{k-1}\), so the next step is defined. Then $$ \mathbf{g}_k=\mathbf{0} \quad\Longleftrightarrow\quad \mathbf{v}_k\in\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\}. $$ For \(k=1\), the right-hand span is \(\{\mathbf{0}\}\), and the statement means \(\mathbf{g}_1=\mathbf{0}\) exactly when \(\mathbf{v}_1=\mathbf{0}\).

Proof. First let \(k\ge2\). In the recursion, the sum being subtracted belongs to \(\operatorname{span}\{\mathbf{g}_1,\dots,\mathbf{g}_{k-1}\}\). If \(\mathbf{g}_k=\mathbf{0}\), then the recursion says that \(\mathbf{v}_k\) equals that sum. Hence \(\mathbf{v}_k\) belongs to the span of the earlier residuals, which equals the span of the earlier inputs by the proposition. Conversely, suppose \(\mathbf{v}_k\) belongs to the span of the earlier inputs. The same span equality puts it in \(\operatorname{span}\{\mathbf{g}_1,\dots,\mathbf{g}_{k-1}\}\). The subtracted sum in the recursion is the component-removal combination, and the residual is orthogonal to each earlier residual. To see that membership forces this remainder to vanish, write \(\mathbf{v}_k=\sum_{j=1}^{k-1}a_j\mathbf{g}_j\). The recursion then gives \(\mathbf{g}_k=\sum_{j=1}^{k-1}b_j\mathbf{g}_j\) for some scalars \(b_j\). Since \(\mathbf{g}_k\) is orthogonal to every \(\mathbf{g}_j\), it is orthogonal to itself. Positive definiteness gives \(\langle\mathbf{g}_k,\mathbf{g}_k\rangle=0\) only for \(\mathbf{g}_k=\mathbf{0}\). For \(k=1\), \(\mathbf{g}_1=\mathbf{v}_1\), so the equivalence follows directly from the definition of the empty span. \(\square\)

This theorem answers both directions of the question. A zero residual cannot appear unless the current input is redundant relative to the earlier list; and if the current input is redundant, its residual must be zero. The theorem applies as long as the preceding steps are defined, which matters because a zero residual cannot be used as a denominator in a later projection.

Why Independence Guarantees Every Residual Is Nonzero

For an independent list, no input can belong to the span of its predecessors. This characterization follows directly from the definition, including the first input.

Proposition: A finite ordered list \(\mathbf{v}_1,\dots,\mathbf{v}_p\) is linearly independent if and only if, for each \(k\), \(\mathbf{v}_k\notin\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\}\).

Proof. Suppose the list is independent. If some \(\mathbf{v}_k\) belonged to the span of its predecessors, it could be written as a linear combination of them. Moving that combination to one side would give a nontrivial linear relation, with coefficient \(1\) on \(\mathbf{v}_k\), contradicting independence. This reasoning also covers \(k=1\): membership in the empty span would mean \(\mathbf{v}_1=\mathbf{0}\), a nontrivial relation by itself. Conversely, suppose every input lies outside the span of its predecessors. If there were a nontrivial relation \(\sum_{i=1}^p c_i\mathbf{v}_i=\mathbf{0}\), choose the largest index \(k\) for which \(c_k\ne0\). All coefficients with index greater than \(k\) are zero. Solving the relation for \(\mathbf{v}_k\) by dividing by \(c_k\) would put it in the span of its predecessors, a contradiction. Thus every coefficient in a relation must be zero, which is independence. \(\square\)

Theorem: If \(\mathbf{v}_1,\dots,\mathbf{v}_p\) is linearly independent, Gram–Schmidt is defined at every step and each residual \(\mathbf{g}_k\) is nonzero.

Proof. At the first step, independence implies \(\mathbf{v}_1\ne\mathbf{0}\), so \(\mathbf{g}_1=\mathbf{v}_1\ne\mathbf{0}\). Suppose the first \(k-1\) steps have produced nonzero residuals. The recursion at step \(k\) is therefore defined. By the preceding proposition, independence gives \(\mathbf{v}_k\notin\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\}\). The zero-residual criterion then implies \(\mathbf{g}_k\ne\mathbf{0}\). Induction proves the claim for every step. \(\square\)

In particular, independence is the guarantee that all the denominators in the Gram–Schmidt recursion are nonzero: each denominator is \(\langle\mathbf{g}_j,\mathbf{g}_j\rangle\), which is positive because \(\mathbf{g}_j\ne\mathbf{0}\). The guarantee comes from the input list, not from a special choice of arithmetic during the calculation.

Worked Examples: Nonzero and Zero Residuals

Worked Example: An Independent List in R³

Apply Gram–Schmidt to \(\mathbf{v}_1=(1,1,0)\), \(\mathbf{v}_2=(1,0,1)\), and \(\mathbf{v}_3=(0,1,1)\), using the usual dot product. The calculation will show a nonzero residual at each step.

First, \(\mathbf{g}_1=\mathbf{v}_1=(1,1,0)\), with \(\langle\mathbf{g}_1,\mathbf{g}_1\rangle=2\). At the second step, \(\langle\mathbf{v}_2,\mathbf{g}_1\rangle=1\), so \(\mathbf{g}_2=(1,0,1)-\tfrac12(1,1,0)=(\tfrac12,-\tfrac12,1)\). Its squared norm is \(\tfrac14+\tfrac14+1=\tfrac32\), so it is nonzero.

For the third input, \(\langle\mathbf{v}_3,\mathbf{g}_1\rangle=1\) and \(\langle\mathbf{v}_3,\mathbf{g}_2\rangle=-\tfrac12+1=\tfrac12\). Therefore the two projection coefficients are \(\tfrac12\) and \((\tfrac12)/(\tfrac32)=\tfrac13\):

$$ \begin{aligned} \mathbf{g}_3 &=(0,1,1)-\frac12(1,1,0)-\frac13\left(\frac12,-\frac12,1\right)\\ &=\left(-\frac23,\frac23,\frac23\right). \end{aligned} $$

This residual is nonzero. As an orthogonality check, \(\mathbf{g}_3\cdot\mathbf{g}_1=-\tfrac23+\tfrac23=0\), and \(\mathbf{g}_3\cdot\mathbf{g}_2=-\tfrac13-\tfrac13+\tfrac23=0\). Since all three residuals are nonzero, the zero-residual criterion and the sequential characterization show that the input list is independent.

Worked Example: A Redundant Input Produces Zero

Take \(\mathbf{v}_1=(1,0)\), \(\mathbf{v}_2=(0,1)\), and \(\mathbf{v}_3=(2,3)\) in \(\mathbb{R}^2\). The first residuals are \(\mathbf{g}_1=(1,0)\) and \(\mathbf{g}_2=(0,1)\); they have squared norms \(1\) and \(1\), and their mutual dot product is \(0\).

The third input has projection coefficients \(\mathbf{v}_3\cdot\mathbf{g}_1=2\) and \(\mathbf{v}_3\cdot\mathbf{g}_2=3\). Thus $$ \mathbf{g}_3=(2,3)-2(1,0)-3(0,1)=(0,0). $$ The input is indeed in the preceding span, since \((2,3)=2(1,0)+3(0,1)\). Substituting that expression into the residual formula gives zero, exactly as the theorem predicts.

Worked Example: Residuals in a Polynomial Space

Consider the real polynomials of degree at most two with inner product \(\langle f,g\rangle=\int_{-1}^{1} f(x)g(x)\,dx\), and inputs \(v_1(x)=1\), \(v_2(x)=x\), \(v_3(x)=x^2\). For the first input, \(g_1(x)=1\) and \(\langle g_1,g_1\rangle=2\). Since \(\langle x,1\rangle=\int_{-1}^{1}x\,dx=0\), the second residual is \(g_2(x)=x\), with \(\langle g_2,g_2\rangle=\int_{-1}^{1}x^2\,dx=\tfrac23\).

For \(v_3\), its coefficient along \(g_1\) is \(\langle x^2,1\rangle/\langle1,1\rangle=(\tfrac23)/2=\tfrac13\). Its coefficient along \(g_2\) is \(\langle x^2,x\rangle/\langle x,x\rangle=0/(\tfrac23)=0\), because \(x^3\) is odd and its integral over \([-1,1]\) is zero. Hence \(g_3(x)=x^2-\tfrac13\), which is nonzero; for example, \(g_3(0)=-\tfrac13\).

As a check, \(\langle g_3,g_1\rangle=\tfrac23-\tfrac13(2)=0\), and \(\langle g_3,g_2\rangle=0\) because the integrand \(x^3-\tfrac13x\) is odd. The nonzero residuals show that none of the inputs belongs to the span of its predecessors, so the inputs are independent.

Common Mistake: Confusing a Zero Residual with a Zero Input

A zero residual does not mean that the original input was zero. For example, in the second worked example, \(\mathbf{v}_3=(2,3)\ne\mathbf{0}\), but its residual is \(\mathbf{0}\) because the entire input is already in the preceding span. The relevant question is not whether \(\mathbf{v}_k\) is zero; it is whether it adds anything beyond \(\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\).

Another possible error is omitting the squared norm from a projection coefficient. Let \(\mathbf{v}_1=(2,0)\) and \(\mathbf{v}_2=(1,1)\). A wrong calculation uses \(\mathbf{v}_2\cdot\mathbf{v}_1=2\) as the coefficient and obtains \(\mathbf{v}_2-2\mathbf{v}_1=(-3,1)\). This is not a residual orthogonal to \(\mathbf{v}_1\), since \((-3,1)\cdot(2,0)=-6\ne0\). The correct coefficient is \((\mathbf{v}_2\cdot\mathbf{v}_1)/(\mathbf{v}_1\cdot\mathbf{v}_1)=2/4=\tfrac12\), giving \(\mathbf{g}_2=(1,1)-\tfrac12(2,0)=(0,1)\). The check \((0,1)\cdot(2,0)=0\) confirms the correction; the residual is nonzero, as expected because \((1,1)\) is not a multiple of \((2,0)\).

Thus the exact diagnostic is span membership: when the current input is already in the span of the preceding inputs, the residual is zero; when the input list is independent, that cannot happen at any step.

Check Your Understanding

Use the residual criterion and the definition of independence to justify each answer.

  1. Why must the first residual of an independent list be nonzero?
  2. If \(\mathbf{g}_1,\mathbf{g}_2\) are nonzero and the third residual is zero, what can you conclude about \(\mathbf{v}_3\)?
  3. For inputs \((1,0)\), \((1,1)\), compute the second residual and explain why it is nonzero.
  4. In the polynomial example, which input lies in the span of the preceding inputs if the third input is changed to \(1+x\)? What is its residual?
  5. Explain why a nonzero residual at every step implies that the input list is independent.

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