maths2u
Tier
⌕ Search ⌘K
Theorem

The Gram–Schmidt process

T-019Home MU-103Threads structure
Statement

Let \( V \) be an inner product space over \( \mathbb{F} \in \{\mathbb{R}, \mathbb{C}\} \), with inner product \( \langle \cdot, \cdot \rangle \) linear in the first slot and conjugate-linear in the second, and let \( (v_1, \dots, v_n) \) be a linearly independent list in \( V \). Then there exists an orthonormal list \( (e_1, \dots, e_n) \) in \( V \) — that is, \( \langle e_i, e_j \rangle = \delta_{ij} \) for all \( i, j \) — such that \[ \operatorname{span}(e_1, \dots, e_k) = \operatorname{span}(v_1, \dots, v_k) \quad \text{for every } k = 1, \dots, n. \] Moreover the list \( (e_1, \dots, e_k) \) satisfying this span condition is unique up to multiplying each \( e_k \) by a scalar of modulus \( 1 \); it is unique outright if one additionally demands \( \langle v_k, e_k \rangle \gt 0 \) for each \( k \). In particular, every finite-dimensional inner product space admits an orthonormal basis.

Why it matters

Gram–Schmidt is the constructive bridge between the algebraic notion of a basis and the geometric notion of an orthonormal frame. Orthonormal bases make everything computable: coordinates become inner products \( x = \sum_j \langle x, e_j \rangle e_j \), norms become Pythagorean sums \( \lVert x \rVert^2 = \sum_j \lvert \langle x, e_j \rangle \rvert^2 \), and orthogonal projections onto subspaces acquire explicit formulas. Without Gram–Schmidt, the existence of orthonormal bases — the fact underlying Fourier analysis, spectral theory, and least squares — would be a bare assertion.

The process is also the theoretical core of the \( QR \) decomposition, the workhorse of numerical linear algebra, and its infinite-dimensional avatar produces the classical families of orthogonal polynomials (Legendre, Hermite, Laguerre, Chebyshev) from the monomials \( 1, x, x^2, \dots \) by nothing more than a choice of inner product.

Hypotheses
Hypothesis.\( \langle \cdot, \cdot \rangle \) is a genuine inner product (positive definite). Drop positive definiteness and normalisation dies: on \( \mathbb{R}^2 \) with the Minkowski form \( \langle x, y \rangle = x_1 y_1 - x_2 y_2 \), the vector \( v = (1,1) \) satisfies \( \langle v, v \rangle = 0 \) although \( v \neq 0 \), so \( v / \lVert v \rVert \) is undefined and no orthonormal list can span the same line.
Hypothesis.The list \( (v_1, \dots, v_n) \) is linearly independent. If \( v_2 = 2v_1 \) in \( \mathbb{R}^2 \), then the second Gram–Schmidt vector is \( u_2 = v_2 - \langle v_2, e_1 \rangle e_1 = 0 \), and the normalisation \( e_2 = u_2 / \lVert u_2 \rVert \) is a division by zero. (Applied to a merely spanning list, the process still works if one discards each zero \( u_k \) as it appears — but the output then has fewer vectors than the input.)
Hypothesis.The scalar field is \( \mathbb{R} \) or \( \mathbb{C} \). Over the rational inner product space \( \mathbb{Q}^2 \subseteq \mathbb{R}^2 \) with the restricted dot product, the vector \( (1,1) \) has \( \lVert (1,1) \rVert = \sqrt{2} \notin \mathbb{Q} \): orthogonalisation survives, but the normalising scalar leaves the field, so no orthonormal basis of \( \operatorname{span}_{\mathbb{Q}}\big((1,1)\big) \) exists inside \( \mathbb{Q}^2 \).
Hypothesis.The list is finite (or countable). The recursion extends verbatim to a countable independent sequence \( (v_k)_{k \in \mathbb{N}} \), since each step uses only finitely many predecessors. But it does not directly orthonormalise an uncountable Hamel basis: there is no way to enumerate the recursion, and indeed a non-separable pre-Hilbert space need not have an orthonormal Hamel basis at all. Note that completeness of \( V \) is never used — the theorem holds in any pre-Hilbert space.
Proof

We argue by induction on \( k \), constructing \( e_1, \dots, e_k \) orthonormal with \( \operatorname{span}(e_1, \dots, e_j) = \operatorname{span}(v_1, \dots, v_j) \) for all \( j \leq k \).

1
\[ \text{Base case: } v_1 \neq 0, \text{ so } \lVert v_1 \rVert \gt 0; \text{ set } e_1 = \frac{v_1}{\lVert v_1 \rVert}. \]
A linearly independent list contains no zero vector (a zero entry gives the nontrivial relation \( 1 \cdot 0 = 0 \)); positive definiteness of the inner product then gives \( \langle v_1, v_1 \rangle \gt 0 \), so the square root \( \lVert v_1 \rVert \) is a positive real and division is legal. Homogeneity of the norm gives \( \lVert e_1 \rVert = 1 \), and \( \operatorname{span}(e_1) = \operatorname{span}(v_1) \) since the two vectors are nonzero scalar multiples of one another. A
2
\[ \text{Inductive hypothesis: } (e_1, \dots, e_{k-1}) \text{ orthonormal, } \operatorname{span}(e_1, \dots, e_j) = \operatorname{span}(v_1, \dots, v_j) \ \forall\, j \leq k-1. \]
Principle of mathematical induction; the base case is Step 1. We must produce \( e_k \). A
3
\[ \text{Define } u_k = v_k - \sum_{j=1}^{k-1} \langle v_k, e_j \rangle\, e_j. \]
This is the key move: subtract from \( v_k \) its orthogonal projection onto \( \operatorname{span}(e_1, \dots, e_{k-1}) \). The sum is a finite linear combination inside the vector space \( V \), so \( u_k \in V \) is well defined. B
4
\[ u_k \neq 0. \]
Suppose \( u_k = 0 \). Then \( v_k = \sum_{j \lt k} \langle v_k, e_j \rangle e_j \in \operatorname{span}(e_1, \dots, e_{k-1}) = \operatorname{span}(v_1, \dots, v_{k-1}) \), the last equality by the inductive hypothesis. But \( v_k \in \operatorname{span}(v_1, \dots, v_{k-1}) \) contradicts the linear independence of \( (v_1, \dots, v_k) \) (linear dependence lemma: a list is dependent iff some entry lies in the span of its predecessors). B
5
\[ \langle u_k, e_i \rangle = 0 \quad \text{for every } i \lt k. \]
Compute, using linearity of \( \langle \cdot, \cdot \rangle \) in the first slot: \( \langle u_k, e_i \rangle = \langle v_k, e_i \rangle - \sum_{j \lt k} \langle v_k, e_j \rangle \langle e_j, e_i \rangle \). By the inductive orthonormality, \( \langle e_j, e_i \rangle = \delta_{ji} \), so the sum collapses to its \( j = i \) term and the expression equals \( \langle v_k, e_i \rangle - \langle v_k, e_i \rangle = 0 \). Note this needs no conjugation care: the coefficients \( \langle v_k, e_j \rangle \) sit in the linear slot. C
6
\[ \text{Set } e_k = \frac{u_k}{\lVert u_k \rVert}. \]
Legal because \( u_k \neq 0 \) (Step 4) and the inner product is positive definite, so \( \lVert u_k \rVert \gt 0 \). Then \( \lVert e_k \rVert = 1 \), and for \( i \lt k \), \( \langle e_k, e_i \rangle = \lVert u_k \rVert^{-1} \langle u_k, e_i \rangle = 0 \) by Step 5. Since \( \langle e_i, e_k \rangle = \overline{\langle e_k, e_i \rangle} = 0 \) as well (conjugate symmetry), the extended list \( (e_1, \dots, e_k) \) is orthonormal. A
7
\[ \operatorname{span}(e_1, \dots, e_k) = \operatorname{span}(v_1, \dots, v_k). \]
(\( \subseteq \)) Each \( e_j \) with \( j \lt k \) lies in \( \operatorname{span}(v_1, \dots, v_{k-1}) \) by the inductive hypothesis, and \( e_k = \lVert u_k \rVert^{-1}\big( v_k - \sum_{j \lt k} \langle v_k, e_j \rangle e_j \big) \) is a linear combination of \( v_k \) and those \( e_j \), hence lies in \( \operatorname{span}(v_1, \dots, v_k) \). (\( \supseteq \)) Rearranging Step 3, \( v_k = \lVert u_k \rVert\, e_k + \sum_{j \lt k} \langle v_k, e_j \rangle e_j \in \operatorname{span}(e_1, \dots, e_k) \), and \( v_1, \dots, v_{k-1} \) lie in \( \operatorname{span}(e_1, \dots, e_{k-1}) \) inductively. A subspace containing a spanning set of another contains that subspace; both inclusions give equality. B
8
\[ \text{Induction closes: } (e_1, \dots, e_n) \text{ is orthonormal with the nested-span property.} \]
Steps 3–7 carry the hypothesis from \( k-1 \) to \( k \); after \( n \) steps the full list is built. Orthonormal lists are automatically linearly independent (if \( \sum_j a_j e_j = 0 \), pairing with \( e_i \) gives \( a_i = 0 \)), so \( (e_1, \dots, e_n) \) is a basis of \( \operatorname{span}(v_1, \dots, v_n) \). A
9
\[ \text{Uniqueness up to unimodular scalars.} \]
Suppose \( (f_1, \dots, f_n) \) is another orthonormal list with \( \operatorname{span}(f_1, \dots, f_k) = \operatorname{span}(v_1, \dots, v_k) \) for all \( k \). Fix \( k \) and write \( U_{k-1} = \operatorname{span}(v_1, \dots, v_{k-1}) \). Both \( e_k \) and \( f_k \) lie in the \( k \)-dimensional space \( U_k \) and are orthogonal to all of \( U_{k-1} \) (each is orthogonal to \( e_1, \dots, e_{k-1} \), respectively \( f_1, \dots, f_{k-1} \), which span \( U_{k-1} \)). The orthogonal complement of \( U_{k-1} \) inside \( U_k \) has dimension \( k - (k-1) = 1 \) by the rank–nullity count for the orthogonal projection \( U_k \to U_{k-1} \), so \( f_k = \lambda e_k \) for some \( \lambda \in \mathbb{F} \); then \( 1 = \lVert f_k \rVert = \lvert \lambda \rvert \). If moreover \( \langle v_k, e_k \rangle \gt 0 \) and \( \langle v_k, f_k \rangle \gt 0 \) are demanded, then \( \langle v_k, f_k \rangle = \overline{\lambda} \langle v_k, e_k \rangle \) forces \( \overline{\lambda} \gt 0 \), and with \( \lvert \lambda \rvert = 1 \) this gives \( \lambda = 1 \). C
Result
\[ (v_1, \dots, v_n) \text{ independent } \implies \exists\, (e_1, \dots, e_n) \text{ orthonormal with } \operatorname{span}(e_1, \dots, e_k) = \operatorname{span}(v_1, \dots, v_k) \ \forall k, \] \[ \text{via } e_k = \frac{u_k}{\lVert u_k \rVert}, \qquad u_k = v_k - \sum_{j=1}^{k-1} \langle v_k, e_j \rangle\, e_j. \]

Reading. Feed any linearly independent list into the machine one vector at a time; at each stage, subtract off the shadow the new vector casts on what you have already built, and rescale what remains to unit length. The output is an orthonormal list that spans exactly the same flag of subspaces — nothing is gained, nothing is lost, only the frame is straightened.

Scope. Valid in any real or complex inner product space, finite- or infinite-dimensional, complete or not; applies to any finite or countable linearly independent list. It does not require \( V \) itself to be finite-dimensional, and it fails as stated for indefinite bilinear forms, for scalar fields not closed under the needed square roots, and for uncountable lists.

Corollaries & converses
  • Orthonormal bases exist. Every finite-dimensional inner product space has an orthonormal basis: apply the process to any basis.
  • Extension. Every orthonormal list in a finite-dimensional inner product space extends to an orthonormal basis: extend to a basis, run Gram–Schmidt, and note the process leaves the already-orthonormal initial segment unchanged (each \( u_k = v_k \) when \( v_k \) is already unit and orthogonal to its predecessors).
  • \( QR \) decomposition. Every \( A \in GL_n(\mathbb{F}) \) factors uniquely as \( A = QR \) with \( Q \) unitary (orthogonal if \( \mathbb{F} = \mathbb{R} \)) and \( R \) upper triangular with positive diagonal: Gram–Schmidt on the columns of \( A \), with the span condition supplying triangularity of the change of basis.
  • Orthogonal complements. For any subspace \( U \) of a finite-dimensional inner product space \( V \), \( V = U \oplus U^{\perp} \): take an orthonormal basis of \( U \), extend, and split.
  • Schur triangularisation. Every operator on a finite-dimensional complex inner product space has an upper-triangular matrix with respect to some orthonormal basis: Gram–Schmidt applied to a basis realising triangular form preserves the invariant flag.
  • Converse direction. The natural converse — every orthonormal list arises as the Gram–Schmidt output of some independent list — is trivially true (feed the list to itself; the process fixes it). The sharper statement is the uniqueness clause: the span-flag condition pins each \( e_k \) down to a unimodular multiple, so Gram–Schmidt output is canonical once one normalises \( \langle v_k, e_k \rangle \gt 0 \). Note the process is not injective: many different independent lists (e.g. \( (v_1, v_2) \) and \( (v_1, v_2 + v_1) \)) produce the identical orthonormal list.
Fails without
  • Positive definiteness dropped. On \( \mathbb{R}^2 \) with \( \langle x, y \rangle = x_1 y_1 - x_2 y_2 \) take \( v_1 = (1, 1) \), \( v_2 = (1, 0) \): a linearly independent list, yet \( \langle v_1, v_1 \rangle = 0 \), so \( e_1 \) cannot be formed — the "unit vector along \( v_1 \)" does not exist, and no list orthonormal for this form spans the null line \( \operatorname{span}(v_1) \).
  • Linear independence dropped. In \( \mathbb{R}^2 \) take \( v_1 = (1, 0) \), \( v_2 = (2, 0) \). Then \( u_2 = v_2 - \langle v_2, e_1 \rangle e_1 = (2,0) - 2(1,0) = 0 \), and the recipe divides by \( \lVert u_2 \rVert = 0 \). No orthonormal list of length \( 2 \) can span the \( 1 \)-dimensional space \( \operatorname{span}(v_1, v_2) \), since orthonormal lists are independent.
  • Field not closed under the required square roots. In \( \mathbb{Q}^3 \) with the restricted dot product, take \( v_1 = (1, 1, 0) \). Any unit vector spanning \( \operatorname{span}_{\mathbb{Q}}(v_1) \) is \( \pm (1,1,0)/\sqrt{2} \), which has irrational coordinates: orthogonalisation stays inside \( \mathbb{Q}^3 \) (only field operations are used) but orthonormalisation escapes it.
Common errors
  • Projecting onto the original vectors. Writing \( u_k = v_k - \sum_j \frac{\langle v_k, v_j \rangle}{\langle v_j, v_j \rangle} v_j \) — subtracting projections onto the raw \( v_j \) rather than the already-orthogonalised \( e_j \) (or \( u_j \)). Unless the \( v_j \) happen to be orthogonal already, the output is not orthogonal.
  • Mixing the normalised and unnormalised formulas. The two correct recipes are \( u_k = v_k - \sum_j \langle v_k, e_j \rangle e_j \) (unit \( e_j \)) and \( u_k = v_k - \sum_j \frac{\langle v_k, u_j \rangle}{\langle u_j, u_j \rangle} u_j \) (raw \( u_j \), with the Gram-coefficient denominator). Using unit vectors and dividing by \( \langle e_j, e_j \rangle \) is harmless (it is \( 1 \)), but using raw \( u_j \) without the denominator is wrong.
  • Conjugation in the wrong slot (complex case). With the convention linear-in-first-slot, the coefficient is \( \langle v_k, e_j \rangle \), not \( \langle e_j, v_k \rangle = \overline{\langle v_k, e_j \rangle} \). Swapping them silently conjugates every coefficient and destroys orthogonality whenever the inner products are non-real.
  • Forgetting the square root. Normalising by \( \langle u_k, u_k \rangle \) instead of \( \lVert u_k \rVert = \sqrt{\langle u_k, u_k \rangle} \), producing vectors of norm \( \lVert u_k \rVert^{-1} \) rather than \( 1 \).
  • Assuming order does not matter. Running the process on \( (v_2, v_1) \) generally yields a different orthonormal basis than \( (v_1, v_2) \): the output depends on the flag of nested spans, not just on the subspace.
  • Normalising a dependent list. Applying the process to a spanning-but-dependent list and dividing by \( \lVert u_k \rVert = 0 \) at the first redundancy, instead of discarding zero vectors as they appear.
Discussion

The process is named for Jørgen Pedersen Gram, who used the orthogonalisation idea in an 1883 paper on series expansions by least squares, and Erhard Schmidt, who in 1907 stated the recursion in its modern form while building the theory of integral equations that grew into Hilbert space theory. Schmidt himself credited Gram; in fact the essential device is older still, appearing in work of Laplace (1812, in the analysis of observational errors) and in Cauchy. The name is thus a small lesson in how theorems accrete attributions: what is remembered is the formulation that fed into the dominant framework — here, Schmidt's, because it became the existence proof for orthonormal systems in \( L^2 \).

Conceptually, the theorem says the unitary group acts transitively on flags: any complete flag of subspaces \( U_1 \subseteq U_2 \subseteq \dots \subseteq U_n \) with \( \dim U_k = k \) is the flag of an orthonormal basis. This is the geometric content of the span condition, and it is why Gram–Schmidt appears wherever triangular and unitary structures interact — Schur's triangularisation theorem, the \( QR \) decomposition, and the Iwasawa decomposition \( G = KAN \) of \( GL_n(\mathbb{R}) \) (with \( K = O(n) \), \( A \) positive diagonal, \( N \) unipotent upper triangular) are all Gram–Schmidt in different clothing.

Numerically, the classical recursion as proved above is unstable: in floating-point arithmetic, cancellation in \( v_k - \sum_j \langle v_k, e_j \rangle e_j \) makes the computed \( e_k \) lose orthogonality, with error growth governed by the condition number of the input. The modified Gram–Schmidt variant — subtracting each projection immediately, updating \( v_k \leftarrow v_k - \langle v_k, e_j \rangle e_j \) one \( j \) at a time — is mathematically identical (expand the recursion and compare) but dramatically more stable; for orthogonality to machine precision one uses Householder reflections or reorthogonalisation instead. The distinction matters in practice: least-squares solvers built on classical Gram–Schmidt can fail catastrophically on nearly-dependent data.

In infinite dimensions the theorem is the engine of separable Hilbert space theory: applying the process to a countable dense sequence (after discarding dependencies) shows every infinite-dimensional separable Hilbert space has a countable orthonormal basis, whence every such space is isometrically isomorphic to \( \ell^2 \). Applied to the monomials in \( L^2 \big( (a,b), w(x)\,dx \big) \) it produces the classical orthogonal polynomials, and the three-term recurrence they satisfy is a shadow of the fact that multiplication by \( x \) is symmetric. There is also a closed form bypassing the recursion: with Gram determinant \( G_k = \det \big( \langle v_i, v_j \rangle \big)_{i,j \leq k} \), one has \( \lVert u_k \rVert^2 = G_k / G_{k-1} \), and \( u_k \) itself is expressible as a determinant with last row \( v_1, \dots, v_k \) — positivity of all \( G_k \) is exactly linear independence, tying Gram–Schmidt to the theory of positive definite matrices and the Cholesky factorisation \( G = R^{*} R \).

Common misconceptions. The process does not require finite dimension, completeness, or a finite list — only a countable independent list in a pre-Hilbert space. It does not produce "the" orthonormal basis of a subspace: different orderings of the input give genuinely different outputs. And it is not merely approximate in exact arithmetic — instability is a floating-point phenomenon, not a defect of the theorem.

Worked examples

Example 1. Orthonormalise \( v_1 = (1,1,0) \), \( v_2 = (1,0,1) \), \( v_3 = (0,1,1) \) in \( \mathbb{R}^3 \) with the standard dot product.

1
\[ e_1 = \frac{v_1}{\lVert v_1 \rVert} = \frac{1}{\sqrt{2}}(1, 1, 0). \]
\( \lVert v_1 \rVert^2 = 1 + 1 + 0 = 2 \); Step 1 of the theorem. A
2
\[ u_2 = v_2 - \langle v_2, e_1 \rangle e_1 = (1,0,1) - \tfrac{1}{\sqrt{2}} \cdot \tfrac{1}{\sqrt{2}}(1,1,0) = \left( \tfrac{1}{2}, -\tfrac{1}{2}, 1 \right). \]
\( \langle v_2, e_1 \rangle = (1 + 0 + 0)/\sqrt{2} = 1/\sqrt{2} \); this is the defining recursion. A
3
\[ e_2 = \frac{u_2}{\lVert u_2 \rVert} = \frac{1}{\sqrt{6}}(1, -1, 2). \]
\( \lVert u_2 \rVert^2 = \tfrac{1}{4} + \tfrac{1}{4} + 1 = \tfrac{3}{2} \), so \( \lVert u_2 \rVert = \sqrt{6}/2 \) and \( u_2 / \lVert u_2 \rVert = \tfrac{2}{\sqrt 6} \left( \tfrac12, -\tfrac12, 1 \right) \). Check: \( \langle e_2, e_1 \rangle = (1 - 1 + 0)/\sqrt{12} = 0 \). A
4
\[ u_3 = v_3 - \langle v_3, e_1 \rangle e_1 - \langle v_3, e_2 \rangle e_2 = (0,1,1) - \tfrac{1}{2}(1,1,0) - \tfrac{1}{6}(1,-1,2) = \left( -\tfrac{2}{3}, \tfrac{2}{3}, \tfrac{2}{3} \right). \]
\( \langle v_3, e_1 \rangle = (0 + 1 + 0)/\sqrt{2} = 1/\sqrt{2} \) and \( \langle v_3, e_2 \rangle = (0 - 1 + 2)/\sqrt{6} = 1/\sqrt{6} \); multiplying back through the unit vectors gives the stated components, e.g. first coordinate \( 0 - \tfrac12 - \tfrac16 = -\tfrac{2}{3} \). B
5
\[ e_3 = \frac{u_3}{\lVert u_3 \rVert} = \frac{1}{\sqrt{3}}(-1, 1, 1). \]
\( \lVert u_3 \rVert^2 = 3 \cdot \tfrac{4}{9} = \tfrac{4}{3} \), so \( \lVert u_3 \rVert = 2/\sqrt{3} \). Checks: \( \langle e_3, e_1 \rangle = (-1 + 1 + 0)/\sqrt{6} = 0 \), \( \langle e_3, e_2 \rangle = (-1 - 1 + 2)/\sqrt{18} = 0 \). A
\[ e_1 = \tfrac{1}{\sqrt{2}}(1,1,0), \quad e_2 = \tfrac{1}{\sqrt{6}}(1,-1,2), \quad e_3 = \tfrac{1}{\sqrt{3}}(-1,1,1). \]

Reading. An orthonormal basis of \( \mathbb{R}^3 \) whose first vector points along \( v_1 \) and whose first two vectors span the plane of \( v_1, v_2 \) — the nested-span guarantee in action.

Scope. Any reordering of the input would produce a different (equally valid) orthonormal basis.

Example 2 (Legendre polynomials). Orthonormalise \( 1, x, x^2 \) in the space \( \mathcal{P}_2(\mathbb{R}) \) with inner product \( \langle p, q \rangle = \int_{-1}^{1} p(x)\, q(x) \, dx \).

1
\[ e_1 = \frac{1}{\lVert 1 \rVert} = \frac{1}{\sqrt{2}}. \]
\( \lVert 1 \rVert^2 = \int_{-1}^{1} 1 \, dx = 2 \). The monomials are independent (a polynomial with a zero coefficient list is zero), so the theorem applies. A
2
\[ u_2 = x - \langle x, e_1 \rangle e_1 = x, \qquad e_2 = \sqrt{\tfrac{3}{2}}\, x. \]
\( \langle x, e_1 \rangle = \tfrac{1}{\sqrt 2} \int_{-1}^{1} x \, dx = 0 \) (odd integrand on a symmetric interval), so no correction is needed; \( \lVert x \rVert^2 = \int_{-1}^{1} x^2 dx = \tfrac{2}{3} \). A
3
\[ u_3 = x^2 - \langle x^2, e_1 \rangle e_1 - \langle x^2, e_2 \rangle e_2 = x^2 - \tfrac{1}{3}. \]
\( \langle x^2, e_1 \rangle = \tfrac{1}{\sqrt{2}} \int_{-1}^{1} x^2 dx = \tfrac{2}{3\sqrt{2}} \), so the \( e_1 \)-term is \( \tfrac{2}{3\sqrt 2} \cdot \tfrac{1}{\sqrt 2} = \tfrac13 \); and \( \langle x^2, e_2 \rangle = \sqrt{3/2} \int_{-1}^{1} x^3 dx = 0 \) by parity. B
4
\[ \lVert u_3 \rVert^2 = \int_{-1}^{1} \left( x^2 - \tfrac{1}{3} \right)^2 dx = \tfrac{2}{5} - \tfrac{2}{3} \cdot \tfrac{2}{3} + \tfrac{2}{9} = \tfrac{8}{45}, \qquad e_3 = \sqrt{\tfrac{45}{8}} \left( x^2 - \tfrac{1}{3} \right) = \sqrt{\tfrac{5}{8}} \left( 3x^2 - 1 \right). \]
Expand \( (x^2 - \tfrac13)^2 = x^4 - \tfrac{2}{3} x^2 + \tfrac19 \) and integrate term by term: \( \tfrac25 - \tfrac23 \cdot \tfrac23 + \tfrac29 = \tfrac{18 - 20 + 10}{45} = \tfrac{8}{45} \). Normalisation is Step 6 of the theorem. A
\[ e_1 = \tfrac{1}{\sqrt 2}, \qquad e_2 = \sqrt{\tfrac32}\, x, \qquad e_3 = \sqrt{\tfrac58}\, (3x^2 - 1). \]

Reading. These are the normalised Legendre polynomials \( \sqrt{\smash[b]{k + \tfrac12}}\, P_k(x) \) for \( k = 0, 1, 2 \): the classical special functions fall out of Gram–Schmidt applied to plain monomials.

Scope. Changing the interval or inserting a weight \( w(x) \gt 0 \) into the integral produces the other classical families (Chebyshev, Hermite, Laguerre) by the identical computation.

Problems
  1. Apply Gram–Schmidt to \( v_1 = (3, 4) \), \( v_2 = (1, 0) \) in \( \mathbb{R}^2 \) with the dot product, and verify the output is orthonormal.
    Solution \( \lVert v_1 \rVert = \sqrt{9 + 16} = 5 \), so \( e_1 = \left( \tfrac35, \tfrac45 \right) \). Then \( \langle v_2, e_1 \rangle = \tfrac35 \), so \[ u_2 = (1, 0) - \tfrac{3}{5} \left( \tfrac{3}{5}, \tfrac{4}{5} \right) = \left( \tfrac{16}{25}, -\tfrac{12}{25} \right), \qquad \lVert u_2 \rVert = \tfrac{4}{25}\sqrt{16 + 9} = \tfrac{4}{5}, \] giving \( e_2 = \left( \tfrac45, -\tfrac35 \right) \). Verification: \( \langle e_1, e_2 \rangle = \tfrac{12}{25} - \tfrac{12}{25} = 0 \) and \( \lVert e_1 \rVert = \lVert e_2 \rVert = 1 \) since \( 3^2 + 4^2 = 25 \).
  2. Orthonormalise \( v_1 = (1, i) \), \( v_2 = (1, 1) \) in \( \mathbb{C}^2 \) with \( \langle x, y \rangle = x_1 \overline{y_1} + x_2 \overline{y_2} \). Take care with the conjugation.
    Solution \( \lVert v_1 \rVert^2 = 1 + \lvert i \rvert^2 = 2 \), so \( e_1 = \tfrac{1}{\sqrt 2}(1, i) \). The coefficient is \[ \langle v_2, e_1 \rangle = \tfrac{1}{\sqrt 2}\left( 1 \cdot \overline{1} + 1 \cdot \overline{i} \right) = \tfrac{1 - i}{\sqrt 2}. \] Hence \[ u_2 = (1, 1) - \tfrac{1 - i}{\sqrt 2} \cdot \tfrac{1}{\sqrt 2}(1, i) = (1, 1) - \tfrac{1 - i}{2}(1, i) = \left( \tfrac{1 + i}{2}, \; 1 - \tfrac{i - i^2}{2} \right) = \left( \tfrac{1 + i}{2}, \tfrac{1 - i}{2} \right). \] Then \( \lVert u_2 \rVert^2 = \tfrac{\lvert 1 + i \rvert^2}{4} + \tfrac{\lvert 1 - i \rvert^2}{4} = \tfrac{2}{4} + \tfrac{2}{4} = 1 \), so \( e_2 = \left( \tfrac{1 + i}{2}, \tfrac{1 - i}{2} \right) \) already. Check: \[ \langle e_2, e_1 \rangle = \tfrac{1}{\sqrt 2}\left( \tfrac{1 + i}{2} \cdot \overline{1} + \tfrac{1 - i}{2} \cdot \overline{i} \right) = \tfrac{1}{2\sqrt 2}\left( (1 + i) + (1 - i)(-i) \right) = \tfrac{1}{2\sqrt 2}\left( 1 + i - i - 1 \right) = 0. \] The classic error here is to use \( \langle e_1, v_2 \rangle = \tfrac{1 + i}{\sqrt 2} \) instead: doing so leaves \( \langle u_2, e_1 \rangle = \tfrac{1-i}{\sqrt2} - \tfrac{1+i}{\sqrt2} \neq 0 \).
  3. Prove directly that every orthonormal list \( (e_1, \dots, e_n) \) is linearly independent, and deduce that an orthonormal list in an \( n \)-dimensional inner product space has length at most \( n \).
    Solution Suppose \( \sum_{j=1}^{n} a_j e_j = 0 \) with \( a_j \in \mathbb{F} \). Fix \( i \) and take the inner product with \( e_i \): by linearity in the first slot, \[ 0 = \Big\langle \sum_j a_j e_j, \, e_i \Big\rangle = \sum_j a_j \langle e_j, e_i \rangle = \sum_j a_j \delta_{ji} = a_i. \] Since \( i \) was arbitrary, all coefficients vanish, so the list is independent. In an \( n \)-dimensional space every linearly independent list has length at most \( n \) (any list longer than a spanning list is dependent — the exchange lemma), so orthonormal lists have length at most \( n \). Equality forces the list to be a basis, since an independent list of length \( \dim V \) spans.
  4. Find the first three orthonormal polynomials for the inner product \( \langle p, q \rangle = \int_{0}^{1} p(x) q(x)\, dx \) on \( \mathcal{P}_2(\mathbb{R}) \), starting from \( 1, x, x^2 \). (These are the shifted Legendre polynomials; parity no longer helps, so every projection must be computed.)
    Solution \( \lVert 1 \rVert^2 = \int_0^1 dx = 1 \), so \( e_1 = 1 \). Next, \( \langle x, e_1 \rangle = \int_0^1 x\,dx = \tfrac12 \), so \( u_2 = x - \tfrac12 \) and \[ \lVert u_2 \rVert^2 = \int_0^1 \left( x - \tfrac12 \right)^2 dx = \tfrac{1}{12}, \qquad e_2 = 2\sqrt{3}\left( x - \tfrac12 \right) = \sqrt{3}\,(2x - 1). \] For \( x^2 \): \( \langle x^2, e_1 \rangle = \tfrac13 \) and \[ \langle x^2, e_2 \rangle = 2\sqrt{3} \int_0^1 x^2 \left( x - \tfrac12 \right) dx = 2\sqrt{3}\left( \tfrac14 - \tfrac16 \right) = \tfrac{\sqrt 3}{6}. \] Hence \[ u_3 = x^2 - \tfrac13 - \tfrac{\sqrt 3}{6} \cdot 2\sqrt{3}\left( x - \tfrac12 \right) = x^2 - \tfrac13 - \left( x - \tfrac12 \right) = x^2 - x + \tfrac16. \] Then \[ \lVert u_3 \rVert^2 = \int_0^1 \left( x^4 - 2x^3 + \tfrac43 x^2 - \tfrac13 x + \tfrac{1}{36} \right) dx = \tfrac15 - \tfrac12 + \tfrac49 - \tfrac16 + \tfrac{1}{36} = \tfrac{36 - 90 + 80 - 30 + 5}{180} = \tfrac{1}{180}, \] so \( \lVert u_3 \rVert = \tfrac{1}{6\sqrt 5} \) and \( e_3 = 6\sqrt{5}\left( x^2 - x + \tfrac16 \right) = \sqrt{5}\,(6x^2 - 6x + 1) \).
  5. (\( QR \) decomposition.) Let \( A \in GL_n(\mathbb{R}) \). Prove that \( A = QR \) for some orthogonal matrix \( Q \) and upper triangular \( R \) with strictly positive diagonal entries, and prove this factorisation is unique.
    Solution Existence. The columns \( v_1, \dots, v_n \) of \( A \) are linearly independent since \( A \) is invertible. Run Gram–Schmidt to obtain an orthonormal basis \( e_1, \dots, e_n \) of \( \mathbb{R}^n \) with \( \operatorname{span}(e_1, \dots, e_k) = \operatorname{span}(v_1, \dots, v_k) \) for all \( k \). By that span condition, each \( v_k \) is a combination of \( e_1, \dots, e_k \) only: \[ v_k = \sum_{j=1}^{k} r_{jk} e_j, \qquad r_{jk} = \langle v_k, e_j \rangle \ (j \lt k), \qquad r_{kk} = \lVert u_k \rVert \gt 0, \] reading off Step 7 of the theorem. Let \( Q \) have columns \( e_1, \dots, e_n \) (orthogonal because its columns are orthonormal) and let \( R = (r_{jk}) \), upper triangular with \( r_{kk} \gt 0 \). Column by column, \( QR \) has \( k \)-th column \( \sum_j r_{jk} e_j = v_k \), so \( A = QR \). Uniqueness. Suppose \( Q_1 R_1 = Q_2 R_2 \) with both factorisations of the stated form. Then \[ Q_2^{\top} Q_1 = R_2 R_1^{-1} =: S. \] The left side is orthogonal (product of orthogonals); the right side is upper triangular with positive diagonal (inverses and products of such matrices are such: the diagonal of \( R_2 R_1^{-1} \) is \( \big( (r_2)_{kk} / (r_1)_{kk} \big)_k \gt 0 \)). So \( S \) is an orthogonal, upper triangular matrix with positive diagonal. Then \( S^{-1} = S^{\top} \) is simultaneously upper triangular (inverse of upper triangular) and lower triangular (transpose of upper triangular), hence diagonal; so \( S \) is diagonal with \( S^{\top} S = I \), forcing \( s_{kk}^2 = 1 \), and positivity gives \( s_{kk} = 1 \). Thus \( S = I \), i.e. \( Q_1 = Q_2 \) and \( R_1 = R_2 \). (This mirrors the unimodular-uniqueness clause of the theorem: positive diagonal is exactly the normalisation \( \langle v_k, e_k \rangle \gt 0 \).)