Tutorials › Linear Algebra › Every Finite-Dimensional Inner Product Space Has an Orthonormal Basis

Orthogonal Sets and Gram-Schmidt · Tutorial 653 of 1000

Every Finite-Dimensional Inner Product Space Has an Orthonormal Basis

Learn how Gram-Schmidt turns an arbitrary basis of a finite-dimensional inner product space into an orthonormal basis, and why the construction cannot produce a zero residual.

Intermediate 12 min read

What You'll Learn

  • State the existence theorem for orthonormal bases in finite-dimensional inner product spaces.
  • Apply the Gram-Schmidt recursion to an ordered basis.
  • Explain why each residual is orthogonal to all earlier outputs.
  • Prove that linear independence prevents any residual from being zero.
  • Track how the span is preserved through the construction.
  • Check orthonormality and span in real and polynomial-space examples.

From an Arbitrary Basis to an Orthonormal One

An orthonormal basis combines two useful features: its vectors describe every vector in the space, and distinct basis vectors are mutually orthogonal and have length one. In a finite-dimensional inner product space, such a basis is not merely a convenient possibility. Starting with any basis, the Gram-Schmidt process constructs one. The key is that each new input vector has its earlier components removed; independence ensures that something nonzero remains to normalize.

Work over \(\mathbb{F}=\mathbb{R}\) or \(\mathbb{C}\). An inner product on a vector space \(V\) is a positive-definite inner product, with the convention that it is linear in its first slot and conjugate-linear in its second slot when \(\mathbb{F}=\mathbb{C}\). Write \(\|\mathbf{v}\|=\sqrt{\langle\mathbf{v},\mathbf{v}\rangle}\). A list is orthonormal if each vector has norm one and distinct vectors have inner product zero. A basis is an ordered, linearly independent list that spans \(V\).

Definition (Gram-Schmidt process): Given an ordered list \((\mathbf{v}_1,\dots,\mathbf{v}_n)\), define its residuals 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 n). $$ When each residual is nonzero, define \(\mathbf{q}_k=\mathbf{u}_k/\|\mathbf{u}_k\|\). The output list is \((\mathbf{q}_1,\dots,\mathbf{q}_n)\).

The coefficient in the recursion is chosen so that the corresponding component of \(\mathbf{v}_k\) is removed. The denominator is \(\langle\mathbf{u}_j,\mathbf{u}_j\rangle=\|\mathbf{u}_j\|^2\), which is positive for a nonzero residual. Thus the construction is defined as long as its residuals do not vanish. The next result establishes both that they do not vanish for independent inputs and that the construction preserves the span.

Why the Construction Works

Proposition: Let \((\mathbf{v}_1,\dots,\mathbf{v}_n)\) be a linearly independent list in an inner product space over \(\mathbb{R}\) or \(\mathbb{C}\). The Gram-Schmidt process is defined at every step. Its output \((\mathbf{q}_1,\dots,\mathbf{q}_n)\) is orthonormal, and, for every \(k\), \(\operatorname{span}\{\mathbf{q}_1,\dots,\mathbf{q}_k\}=\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\}\).

Proof. We proceed in order through the list. For \(k=1\), independence gives \(\mathbf{v}_1\ne\mathbf{0}\), so \(\mathbf{u}_1=\mathbf{v}_1\ne\mathbf{0}\). Normalizing it gives \(\|\mathbf{q}_1\|=1\), and the first spans agree.

Suppose the construction has reached step \(k\), with \(\mathbf{q}_1,\dots,\mathbf{q}_{k-1}\) orthonormal and with the first \(k-1\) spans equal. The recursion gives \(\mathbf{u}_k\). For each \(i<k\), using linearity in the first slot and orthonormality,

$$ \langle\mathbf{u}_k,\mathbf{q}_i\rangle =\langle\mathbf{v}_k,\mathbf{q}_i\rangle -\sum_{j=1}^{k-1} \frac{\langle\mathbf{v}_k,\mathbf{u}_j\rangle}{\langle\mathbf{u}_j,\mathbf{u}_j\rangle} \langle\mathbf{u}_j,\mathbf{q}_i\rangle =\langle\mathbf{v}_k,\mathbf{q}_i\rangle-\langle\mathbf{v}_k,\mathbf{q}_i\rangle=0. $$

Here \(\mathbf{u}_j=\|\mathbf{u}_j\|\mathbf{q}_j\), so the \(j=i\) term in the sum equals \(\langle\mathbf{v}_k,\mathbf{q}_i\rangle\), and every other term is zero. Hence \(\mathbf{u}_k\) is orthogonal to each earlier output.

If \(\mathbf{u}_k=\mathbf{0}\), the recursion would express \(\mathbf{v}_k\) as a linear combination of \(\mathbf{u}_1,\dots,\mathbf{u}_{k-1}\), and therefore of \(\mathbf{q}_1,\dots,\mathbf{q}_{k-1}\). By the span equality at step \(k-1\), it would then be a linear combination of \(\mathbf{v}_1,\dots,\mathbf{v}_{k-1}\), contradicting independence of the input list. Thus \(\mathbf{u}_k\ne\mathbf{0}\), so \(\mathbf{q}_k\) is defined and has norm one. It is orthogonal to every earlier \(\mathbf{q}_i\).

Finally, the recursion expresses \(\mathbf{u}_k\) as \(\mathbf{v}_k\) minus a combination of earlier vectors. Thus \(\mathbf{u}_k\), and hence \(\mathbf{q}_k\), belongs to the span of \(\mathbf{v}_1,\dots,\mathbf{v}_k\). Conversely, rearranging the recursion expresses \(\mathbf{v}_k\) as \(\mathbf{u}_k\) plus a combination of earlier residuals. Since each earlier residual is a nonzero scalar multiple of its normalized output, the two spans through step \(k\) are equal. This completes the induction. \(\square\)

Theorem (Existence of an orthonormal basis): Every finite-dimensional inner product space over \(\mathbb{R}\) or \(\mathbb{C}\) has an orthonormal basis.

Proof. If \(V\) has dimension zero, its empty basis is orthonormal: there are no vectors whose norms or pairwise inner products need to be checked. Otherwise, since \(V\) is finite-dimensional, it has a basis \((\mathbf{v}_1,\dots,\mathbf{v}_n)\) for some positive integer \(n\). A basis is linearly independent, so the proposition applies. It produces an orthonormal list with the same span as the basis. That span is \(V\), so the output list is an orthonormal basis of \(V\). \(\square\)

The theorem asserts existence, not that a particular orthonormal basis is unique. Different starting bases, or a different ordering of the same basis, can produce different outputs. What is guaranteed is that the process yields \(n\) orthonormal vectors spanning the same \(n\)-dimensional space.

Worked Constructions

Worked Example: An Orthonormal Basis of \(\mathbb{R}^2\)

Use the standard inner product and start with \(\mathbf{v}_1=(1,1)^{\top}\) and \(\mathbf{v}_2=(1,0)^{\top}\). These vectors are independent: if \(a\mathbf{v}_1+b\mathbf{v}_2=\mathbf{0}\), the second coordinate gives \(a=0\), and then the first gives \(b=0\).

The first residual is \(\mathbf{u}_1=\mathbf{v}_1\), with \(\|\mathbf{u}_1\|=\sqrt{2}\). Thus \(\mathbf{q}_1=(1,1)^{\top}/\sqrt{2}\). For the second residual, \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle=1\) and \(\langle\mathbf{u}_1,\mathbf{u}_1\rangle=2\), so

$$ \mathbf{u}_2=\begin{bmatrix}1\\0\end{bmatrix} -\frac{1}{2}\begin{bmatrix}1\\1\end{bmatrix} =\begin{bmatrix}1/2\\-1/2\end{bmatrix}, \qquad \|\mathbf{u}_2\|=\sqrt{\frac14+\frac14}=\frac{1}{\sqrt{2}}. $$

Therefore \(\mathbf{q}_2=(1,-1)^{\top}/\sqrt{2}\). Check the result: each vector has squared norm \((1+1)/2=1\), and their inner product is \((1-1)/2=0\). Also, \(\mathbf{v}_1=\sqrt{2}\mathbf{q}_1\) and \(\mathbf{v}_2=(\mathbf{q}_1+\mathbf{q}_2)/\sqrt{2}\). Thus the outputs span the original basis vectors and form an orthonormal basis.

Worked Example: Three Basis Vectors in \(\mathbb{R}^3\)

Take \(\mathbf{v}_1=(1,1,0)^{\top}\), \(\mathbf{v}_2=(1,0,1)^{\top}\), and \(\mathbf{v}_3=(0,1,1)^{\top}\). They are independent: a zero linear combination gives \(a+b=0\), \(a+c=0\), and \(b+c=0\); these equations imply \(a=b=c=0\).

First, \(\mathbf{u}_1=(1,1,0)^{\top}\), so \(\mathbf{q}_1=(1,1,0)^{\top}/\sqrt{2}\). Since \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle=1\) and \(\|\mathbf{u}_1\|^2=2\),

$$ \mathbf{u}_2=\begin{bmatrix}1\\0\\1\end{bmatrix} -\frac12\begin{bmatrix}1\\1\\0\end{bmatrix} =\begin{bmatrix}1/2\\-1/2\\1\end{bmatrix}, \qquad \|\mathbf{u}_2\|^2=\frac32. $$

Hence \(\mathbf{q}_2=(1,-1,2)^{\top}/\sqrt{6}\). For the third input, \(\langle\mathbf{v}_3,\mathbf{q}_1\rangle=1/\sqrt{2}\) and \(\langle\mathbf{v}_3,\mathbf{q}_2\rangle=1/\sqrt{6}\). Subtracting both components gives

$$ \mathbf{u}_3= \begin{bmatrix}0\\1\\1\end{bmatrix} -\frac12\begin{bmatrix}1\\1\\0\end{bmatrix} -\frac16\begin{bmatrix}1\\-1\\2\end{bmatrix} =\begin{bmatrix}-2/3\\2/3\\2/3\end{bmatrix}. $$

Its squared norm is \(4/3\), so \(\mathbf{q}_3=(-1,1,1)^{\top}/\sqrt{3}\). Check orthogonality: the numerators of the three pairwise dot products are \(1-1+0=0\), \(-1+1+0=0\), and \(1-1+0=0\). Each squared norm is one after division by its denominator: for \(\mathbf{q}_1\), \(2/2=1\); for \(\mathbf{q}_2\), \(1+1+4=6\); for \(\mathbf{q}_3\), \(1+1+1=3\). The proposition guarantees the outputs span the three inputs, so this is an orthonormal basis.

Worked Example: A Polynomial Inner Product

Let \(V=P_2\), the real polynomials of degree at most two, with inner product \(\langle f,g\rangle=\int_{-1}^{1}f(x)g(x)\,dx\). Start with the basis \((1,x,x^2)\). Its independence follows because a polynomial \(a+bx+cx^2\) is the zero polynomial only when all three coefficients are zero.

The first vector \(1\) has squared norm \(\int_{-1}^1 1\,dx=2\), giving \(q_1=1/\sqrt{2}\). Since \(\int_{-1}^1x\,dx=0\), the second residual is \(u_2=x\); its squared norm is \(\int_{-1}^1x^2\,dx=2/3\). Therefore \(q_2=\sqrt{3/2}\,x\).

For the third input, \(\langle x^2,q_1\rangle=2/(3\sqrt{2})\), while \(\langle x^2,q_2\rangle=0\), since the integral of \(x^3\) over \([-1,1]\) is zero. The first projection is \(1/3\), so \(u_3=x^2-1/3\). Its squared norm is

$$ \int_{-1}^{1}\left(x^2-\frac13\right)^2dx =\frac25-\frac49+\frac29 =\frac{8}{45}. $$

Thus \(q_3=\sqrt{45/8}(x^2-1/3)=\frac{\sqrt{10}}{4}(3x^2-1)\). To check, its squared norm is \((10/16)(9(2/5)-6(2/3)+2)=1\). Its inner product with \(q_1\) is a constant multiple of \(3(2/3)-2=0\); with \(q_2\) it is zero because the integrand is odd. Also \(\langle q_1,q_2\rangle=0\). The outputs are orthonormal and, by span preservation, form a basis of \(P_2\).

A Common Mistake: The Projection Denominator

In the \(\mathbb{R}^2\) example, a tempting but incorrect coefficient for removing the component along \(\mathbf{u}_1=(1,1)^{\top}\) is \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle/\|\mathbf{u}_1\|\). That would give \(1/\sqrt{2}\), and the supposed residual would be \((1-1/\sqrt{2},-1/\sqrt{2})^{\top}\). Its dot product with \(\mathbf{u}_1\) is \(1-\sqrt{2}\ne0\), so the component was not removed.

The correct coefficient is \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle/\langle\mathbf{u}_1,\mathbf{u}_1\rangle=1/2\), not a division by the norm. It gives residual \((1/2,-1/2)^{\top}\), whose dot product with \(\mathbf{u}_1\) is \(1/2-1/2=0\). Keep the squared norm in the projection formula; normalization by the norm happens afterward.

What the Theorem Provides

For any basis of a finite-dimensional inner product space, Gram-Schmidt preserves the span of each initial segment while replacing the list by an orthonormal one. Independence is essential: if an input is already in the span of the earlier inputs, its residual is zero and cannot be normalized. For a basis, that case cannot occur. The resulting orthonormal basis supports simpler coordinate calculations because inner products with its vectors directly identify coefficients: if \(\mathbf{v}=\sum_{j=1}^n c_j\mathbf{q}_j\), then \(\langle\mathbf{v},\mathbf{q}_i\rangle=c_i\). This follows by taking the inner product of the sum with \(\mathbf{q}_i\) and using orthonormality.

Check Your Understanding

Use the definitions and the span-preservation argument to answer the following.

  1. Why must the first vector of a basis have a nonzero norm?
  2. In the Gram-Schmidt recursion, what denominator is used to remove a component along a nonzero residual?
  3. Why would a zero residual contradict independence of the input basis?
  4. What does span preservation imply about the final output list when the inputs form a basis?
  5. How does the theorem handle an inner product space of dimension zero?

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