Tutorials › Measure Theory › Orthogonal Projections Onto Closed Subspaces

Hilbert Space L^2 · Tutorial 588 of 798

Orthogonal Projections Onto Closed Subspaces

Learn why the closest point in a closed Hilbert subspace is characterized by an orthogonal residual, and use that characterization to calculate best L2 approximations.

Advanced 11 min read

What You'll Learn

  • State and prove the projection theorem for a closed subspace of a Hilbert space.
  • Characterize the best approximation by orthogonality to the subspace.
  • Show that the projection is linear and does not increase norms.
  • Compute L2 projections onto constants and piecewise-constant functions.
  • Set up normal equations for projections onto a finite-dimensional subspace.
  • Recognize why averaging without normalizing can give the wrong projection.

Closest Points and Orthogonality

Approximating a function by a simpler one is often a minimization problem: among all candidates in a specified subspace, find the one with the smallest \(L^2\) error. The key fact is that in a Hilbert space this minimizer exists whenever the subspace is closed, and it is characterized by an orthogonality condition. This converts a global minimization problem into equations involving inner products.

Let \((X,\mathcal{M},\mu)\) be any measure space. We use \(L^2(\mu)\) for the Hilbert space of equivalence classes, modulo equality \(\mu\)-a.e., of complex-valued measurable functions \(f\) such that \(\int_X |f|^2\,d\mu<\infty\). Its inner product convention is \(\langle f,g\rangle=\int_X f\overline{g}\,d\mu\), linear in the first argument, and its norm is \(\|f\|_2=\langle f,f\rangle^{1/2}\). The theorem below applies more generally to any real or complex Hilbert space \(H\); the completeness of \(L^2(\mu)\) is the standard Hilbert-space result established earlier.

Definition: For a subspace \(M\) of a Hilbert space \(H\), a vector \(r\in H\) is orthogonal to \(M\), written \(r\perp M\), if \(\langle r,m\rangle=0\) for every \(m\in M\). The orthogonal complement is \(M^\perp=\{r\in H:r\perp M\}\). A best approximation to \(f\in H\) from \(M\) is a vector \(p\in M\) minimizing \(\|f-q\|\) over all \(q\in M\).

The projection theorem says that a closed subspace has exactly one best approximation to every vector. Its proof uses completeness and the parallelogram identity; it does not require the subspace to be finite-dimensional.

The Projection Theorem

Theorem (Orthogonal Projection): Let \(H\) be a real or complex Hilbert space and \(M\subseteq H\) a closed linear subspace. For each \(f\in H\), there is a unique \(p\in M\) such that \(\|f-p\|=\inf_{q\in M}\|f-q\|\). This vector is characterized by \(f-p\perp M\). In particular, the theorem applies to \(H=L^2(\mu)\) for any measure space \((X,\mathcal{M},\mu)\), with functions understood as equivalence classes modulo equality \(\mu\)-a.e.

Proof. Fix \(f\in H\) and let \(d=\inf_{q\in M}\|f-q\|\). This is a finite nonnegative real number because \(0\in M\), so \(0\le d\le\|f\|\). By the definition of infimum, choose \(p_n\in M\) with \(d\le\|f-p_n\|<d+1/n\). The parallelogram identity, applied to \(f-p_n\) and \(f-p_k\), gives \(\|p_n-p_k\|^2=2\|f-p_n\|^2+2\|f-p_k\|^2-4\|f-(p_n+p_k)/2\|^2\). Because \(M\) is a linear subspace, \((p_n+p_k)/2\in M\), so the last norm is at least \(d\). Consequently, \(\|p_n-p_k\|^2\le 2\|f-p_n\|^2+2\|f-p_k\|^2-4d^2\), which tends to zero as \(n,k\to\infty\). Thus \((p_n)\) is Cauchy. Completeness of \(H\) gives a limit \(p\in H\), and closedness of \(M\) gives \(p\in M\). Norm continuity yields \(\|f-p\|=d\), proving existence of a minimizer.

Set \(r=f-p\). For any \(m\in M\) and scalar \(z\), \(p+zm\in M\). Minimality of \(p\) therefore gives \(\|r-zm\|^2\ge\|r\|^2\). If \(H\) is real, expanding this inequality for both positive and negative real \(z\) forces \(\langle r,m\rangle=0\). If \(H\) is complex, the expansion is \(\|r-zm\|^2-\|r\|^2=|z|^2\|m\|^2-2\operatorname{Re}(z\langle m,r\rangle)\). Taking real \(z=t\) of either sign shows \(\operatorname{Re}\langle m,r\rangle=0\); taking \(z=it\) of either sign shows \(\operatorname{Im}\langle m,r\rangle=0\). Thus \(r\perp M\) in either case.

Conversely, suppose \(p\in M\) and \(f-p\perp M\). For any \(q\in M\), \(p-q\in M\), so \(f-p\perp p-q\). Expanding the squared norm, with the cross terms zero, gives \(\|f-q\|^2=\|(f-p)+(p-q)\|^2=\|f-p\|^2+\|p-q\|^2\ge\|f-p\|^2\). Hence \(p\) is a best approximation. If \(p_1,p_2\in M\) are both best approximations, the characterization gives \(f-p_1\perp M\) and \(f-p_2\perp M\). Their difference \(p_1-p_2\) belongs to \(M\) and is orthogonal to \(M\), so \(\|p_1-p_2\|^2=0\), and \(p_1=p_2\). This proves existence, the characterization, and uniqueness. \(\square\)

Corollary (Projection operator): For a closed subspace \(M\) of a Hilbert space \(H\), define \(P_M f\) to be the unique best approximation to \(f\) in \(M\). Then \(P_M\) is linear, \(P_M p=p\) for \(p\in M\), and \(\|P_M f\|\le\|f\|\) for every \(f\in H\).

Proof. The theorem gives \(f-P_M f\perp M\). For \(f,g\in H\), the vector \(P_M f+P_M g\) lies in \(M\), and \((f+g)-(P_M f+P_M g)\) is orthogonal to \(M\). By the theorem's uniqueness characterization, \(P_M(f+g)=P_Mf+P_Mg\). For a scalar \(c\), \(cP_Mf\in M\) and \(cf-cP_Mf\perp M\), so \(P_M(cf)=cP_Mf\); this also holds for \(c=0\). If \(p\in M\), its residual \(p-p=0\) is orthogonal to \(M\), giving \(P_Mp=p\). Finally, \(P_Mf\) and \(f-P_Mf\) are orthogonal, so \(\|f\|^2=\|P_Mf\|^2+\|f-P_Mf\|^2\), which implies \(\|P_Mf\|\le\|f\|\). \(\square\)

Computing Projections in Finite Dimensions

Suppose \(M\) is spanned by a finite linearly independent list \(v_1,\dots,v_N\) in a Hilbert space. To find the best approximation \(p=\sum_{j=1}^N c_jv_j\) to \(f\), require \(f-p\perp v_k\) for each \(k\). With the convention that the inner product is linear in the first argument, these conditions are the normal equations \(\sum_{j=1}^N c_j\langle v_j,v_k\rangle=\langle f,v_k\rangle\), for \(k=1,\dots,N\). The matrix of this system is invertible: if coefficients \(c_j\) solve the homogeneous system, then \(w=\sum_jc_jv_j\) is orthogonal to every \(v_k\), hence to \(w\), so \(\|w\|^2=0\). Linear independence then gives \(c_j=0\) for every \(j\). Thus the system has a unique solution, and its residual is orthogonal to \(M\), so the projection theorem's characterization proves it is the best approximation.

When the spanning vectors are already orthogonal and nonzero, the equations separate. The coefficient of \(v_j\) is \(\langle f,v_j\rangle/\|v_j\|^2\). Orthogonality is essential to this simple coefficient-by-coefficient formula; for a nonorthogonal list, the coupled normal equations must be solved.

Worked Example: Approximating x² by a Constant

In \(L^2([0,1],\mathcal{L},m)\), project the real-valued function \(f(x)=x^2\) onto the subspace of constant functions. A constant \(c\) is the best approximation exactly when \(x^2-c\) is orthogonal to the constant function \(1\). Thus \(\int_0^1(x^2-c)\,dx=0\), or \(1/3-c=0\), so \(c=1/3\).

The squared error is \(\int_0^1(x^2-1/3)^2\,dx=\int_0^1(x^4-\tfrac23x^2+\tfrac19)\,dx=\tfrac15-\tfrac29+\tfrac19=\tfrac4{45}\). Therefore the best approximation is \(P_Mf=1/3\), and the distance is \(2/\sqrt{45}\). Check: its residual has integral \(1/3-1/3=0\), which verifies orthogonality to every constant \(a\), since \(\int_0^1 a(x^2-1/3)\,dx=a(0)=0\). The squared error \(4/45\) is also positive, as expected because \(x^2\) is not a.e. constant.

Worked Example: Piecewise-Constant Approximation

In \(L^2([0,1],\mathcal{L},m)\), let \(M\) consist of functions constant on each of \(I_1=[0,1/2)\) and \(I_2=[1/2,1]\), up to equality \(m\)-a.e. Project \(f(x)=x\) onto \(M\). Write a candidate as \(a\chi_{I_1}+b\chi_{I_2}\). Orthogonality of the residual to each indicator requires \(\int_{I_1}(x-a)\,dx=0\) and \(\int_{I_2}(x-b)\,dx=0\). The first equation is \(1/8-a/2=0\), giving \(a=1/4\). The second is \(3/8-b/2=0\), giving \(b=3/4\). Hence \(P_Mf=(1/4)\chi_{I_1}+(3/4)\chi_{I_2}\).

For the squared error, direct integration gives \(\int_0^{1/2}(x-1/4)^2\,dx=1/96\) and \(\int_{1/2}^{1}(x-3/4)^2\,dx=1/96\). Thus \(\|f-P_Mf\|_2^2=1/48\). Check: the residual integrates to \(1/8-(1/4)(1/2)=0\) on \(I_1\), and to \(3/8-(3/4)(1/2)=0\) on \(I_2\). Every member of \(M\) is a linear combination of these two indicators, so the residual is orthogonal to all of \(M\); the theorem verifies that this is the minimizer.

Worked Example: A Nonorthogonal Two-Dimensional Subspace

In \(L^2([0,1],\mathcal{L},m)\), project \(f(x)=x^2\) onto \(M=\operatorname{span}\{1,x\}\). Write \(p(x)=a+bx\). Orthogonality to \(1\) and \(x\) gives \(a+b/2=1/3\) and \(a/2+b/3=1/4\), respectively. From the first equation \(a=1/3-b/2\); substitution into the second gives \(1/6-b/4+b/3=1/4\), hence \(b/12=1/12\), \(b=1\), and \(a=-1/6\). Thus \(p(x)=x-1/6\).

The residual is \(r(x)=x^2-x+1/6\). Its inner products with the spanning vectors are \(\int_0^1r(x)\,dx=1/3-1/2+1/6=0\) and \(\int_0^1xr(x)\,dx=1/4-1/3+1/12=0\). The squared error is \(\int_0^1r(x)^2\,dx=\int_0^1(x^4-2x^3+\tfrac43x^2-\tfrac13x+\tfrac1{36})\,dx =\tfrac15-\tfrac12+\tfrac49-\tfrac16+\tfrac1{36}=\tfrac1{180}\). Therefore the distance is \(1/\sqrt{180}\). Check: both required residual inner products vanish, so \(r\perp M\); the projection theorem establishes optimality, not merely stationarity.

Why Normalization Matters

A common mistake is to project onto the constant functions by integrating \(f\) and using that integral directly as the constant. The coefficient must account for the inner product of the constant basis vector with itself. On \([0,2]\) with Lebesgue measure, the constant projection of \(f(x)=x\) is \(c=\langle x,1\rangle/\|1\|_2^2\), not just \(\langle x,1\rangle\). Here \(\langle x,1\rangle=\int_0^2x\,dx=2\), while \(\|1\|_2^2=\int_0^2 1\,dx=2\); hence \(c=2/2=1\). The incorrect choice \(c=2\) has residual integral \(\int_0^2(x-2)\,dx=2-4=-2\ne0\), so it is not orthogonal to constants. The correct choice has residual integral \(\int_0^2(x-1)\,dx=2-2=0\).

For a finite-dimensional approximation, the orthogonality equations provide both a practical computation and a decisive check: after finding the coefficients, verify the residual against each spanning vector. Once that condition holds, the Pythagorean identity shows that every other candidate has squared error equal to the projection's squared error plus a nonnegative squared distance within the subspace. No candidate can do better.

Check Your Understanding

Use orthogonality to justify each answer, and distinguish the best approximation from an arbitrary candidate in the subspace.

  1. In \(L^2([0,1],\mathcal{L},m)\), find the best constant approximation to \(f(x)=1+x\), and verify the residual has integral zero.
  2. Explain why the projection onto a closed subspace is unique, even if there are several different minimizing sequences.
  3. For a nonzero orthogonal pair \(v_1,v_2\) in a Hilbert space, write the coefficients of the projection of \(f\) onto their span.
  4. In \(L^2([0,1],\mathcal{L},m)\), set up the two normal equations for projecting \(x^3\) onto \(\operatorname{span}\{1,x\}\).
  5. On \([0,3]\) with Lebesgue measure, find the projection of \(f(x)=x\) onto the constant functions and explain why dividing by the interval's measure is necessary.