Tutorials › Measure Theory › Density of Compactly Supported Continuous Functions in Lp(Rn)

Completeness and Density in L^p · Tutorial 549 of 798

Density of Compactly Supported Continuous Functions in Lp(Rn)

Learn how to approximate finite-measure indicators by continuous compactly supported functions and extend that approximation to every function in \(L^p(\mathbb{R}^n)\).

Advanced 12 min read

What You'll Learn

  • State the density theorem with its measure-space and exponent hypotheses.
  • Reduce approximation in \(L^p\) to approximating indicators of finite-measure sets.
  • Use inner and outer regularity to control the region where a cutoff can differ from an indicator.
  • Construct compactly supported continuous cutoffs around compact sets.
  • Combine indicator approximations for finite-valued simple functions.
  • Identify why controlling only the outer approximation error is insufficient.

From Measurable Functions to Continuous Approximations

Continuous functions are easier to visualize and manipulate than arbitrary measurable functions, but an \(L^p\) function need not be continuous or even bounded. The useful question is therefore not whether every \(L^p\) function has a continuous representative, but whether it can be approximated in norm by continuous functions. On Euclidean space, the answer is affirmative for every finite exponent \(p\): the approximants can also be chosen to have compact support.

Throughout, the measure space is \((\mathbb{R}^n,\mathcal{L},m)\), where \(\mathcal{L}\) is the Lebesgue sigma-algebra and \(m\) is Lebesgue measure. This measure space is complete and sigma-finite, but not finite. Functions may be real-valued or complex-valued, and \(L^p(\mathbb{R}^n)\) identifies functions equal \(m\)-a.e. For \(1\le p<\infty\), its norm is \(\|f\|_p=(\int_{\mathbb{R}^n}|f|^p\,dm)^{1/p}\). The notation \(C_c(\mathbb{R}^n)\) denotes continuous real- or complex-valued functions on \(\mathbb{R}^n\) whose support—the closure of the set where they are nonzero—is compact.

Two earlier results supply the reduction. First, simple functions supported on sets of finite Lebesgue measure are dense in \(L^p(\mathbb{R}^n)\) for \(1\le p<\infty\). Precisely, for every \(f\in L^p\) and every \(\varepsilon>0\), there is a finite-valued measurable function \(s=\sum_{j=1}^N c_j\chi_{E_j}\), with disjoint \(E_j\in\mathcal{L}\) of finite measure, such that \(\|f-s\|_p<\varepsilon\). Second, Lebesgue measure is regular: for every \(E\in\mathcal{L}\) with \(m(E)<\infty\) and every \(\delta>0\), there are a compact set \(K\) and an open set \(U\) satisfying \(K\subseteq E\subseteq U\), \(m(E\setminus K)<\delta\), and \(m(U\setminus E)<\delta\).

Cutoffs for Compact Sets

Lemma: If \(K\subset U\subset\mathbb{R}^n\), where \(K\) is compact and \(U\) is open, there is a continuous function \(\phi:\mathbb{R}^n\to[0,1]\) with compact support, equal to \(1\) on \(K\), and equal to \(0\) on \(U^c\).

Proof. If \(K=\varnothing\), take \(\phi=0\). Suppose \(K\ne\varnothing\). If \(U^c\ne\varnothing\), the distance \(d=\inf\{|x-y|:x\in K,\ y\in U^c\}\) is positive: each point of \(K\) has an open ball contained in \(U\), and compactness gives a finite subcover and hence a positive uniform radius. Choose \(r\) with \(0<r<d\). If \(U^c=\varnothing\), choose any \(r>0\). Define \(\phi(x)=\max\{0,1-\operatorname{dist}(x,K)/r\}\). The distance to a nonempty closed set is continuous, so \(\phi\) is continuous; it equals \(1\) on \(K\), and it vanishes when \(\operatorname{dist}(x,K)\ge r\). Its support is contained in the closed \(r\)-neighborhood of \(K\), which is bounded because \(K\) is compact, and is closed, hence compact. When \(U^c\ne\varnothing\), \(r<d\) also ensures this neighborhood lies in \(U\); when \(U^c=\varnothing\), the required vanishing on \(U^c\) is vacuous. Thus \(\phi\) has all the stated properties. \(\square\)

The lemma gives a controlled approximation to an indicator. Apply regularity to a finite-measure \(E\), and choose \(K,U\) as above. Let \(\phi\) be the cutoff. On \(K\), \(\chi_E=\phi=1\); outside \(U\), both are zero. On the remaining set their values lie in \([0,1]\), so \(|\chi_E-\phi|\le1\), and any nonzero discrepancy is confined to \((E\setminus K)\cup(U\setminus E)\). Consequently,

$$ \|\chi_E-\phi\|_p^p =\int_{\mathbb{R}^n}|\chi_E-\phi|^p\,dm \le m(E\setminus K)+m(U\setminus E)<2\delta. $$

This estimate is valid for every finite \(p\ge1\): because the pointwise discrepancy is at most \(1\), its \(p\)-th power is also at most \(1\). The estimate does not require \(m(\mathbb{R}^n)<\infty\); only the two error regions need finite measure.

Density Theorem

Theorem: For \((\mathbb{R}^n,\mathcal{L},m)\) and \(1\le p<\infty\), \(C_c(\mathbb{R}^n)\) is dense in \(L^p(\mathbb{R}^n)\). That is, for every real- or complex-valued \(f\in L^p(\mathbb{R}^n)\) and every \(\varepsilon>0\), there is a real- or complex-valued \(g\in C_c(\mathbb{R}^n)\) such that \(\|f-g\|_p<\varepsilon\).

Proof. Fix \(f\in L^p(\mathbb{R}^n)\) and \(\varepsilon>0\). By density of finite-valued simple functions supported on finite-measure sets, choose \(s=\sum_{j=1}^N c_j\chi_{E_j}\) with disjoint measurable \(E_j\) of finite measure and \(\|f-s\|_p<\varepsilon/2\). If every \(c_j=0\), set \(g=0\); then \(\|f-g\|_p<\varepsilon/2\). Otherwise let \(S=\sum_{j=1}^N|c_j|>0\), and set \(\eta=\varepsilon/(2S)\).

For each \(j\), regularity and the cutoff estimate give \(\phi_j\in C_c(\mathbb{R}^n)\) with \(\|\chi_{E_j}-\phi_j\|_p<\eta\). Indeed, choose \(\delta>0\) so that \((2\delta)^{1/p}<\eta\), then use the compact and open sets supplied by regularity. Define \(g=\sum_{j=1}^N c_j\phi_j\). This is continuous, and its support is contained in the finite union of the compact supports of the \(\phi_j\), so \(g\in C_c(\mathbb{R}^n)\). By the triangle inequality in \(L^p\), which applies because \(p\ge1\),

$$ \|s-g\|_p =\left\|\sum_{j=1}^N c_j(\chi_{E_j}-\phi_j)\right\|_p \le\sum_{j=1}^N|c_j|\,\|\chi_{E_j}-\phi_j\|_p <\eta\sum_{j=1}^N|c_j| =\frac{\varepsilon}{2}. $$

A second application of the triangle inequality yields \(\|f-g\|_p\le\|f-s\|_p+\|s-g\|_p<\varepsilon\). This proves the assertion for real or complex coefficients, and hence for both classes of functions. \(\square\)

Worked Approximations

Worked Example: A Cutoff for an Interval

On \((\mathbb{R},\mathcal{L},m)\), approximate \(\chi_{[0,1]}\) by a compactly supported continuous function in \(L^2\). Fix \(\delta=1/4\) and define \(\phi(x)=0\) outside \([0,1]\); on \([0,1]\), let \(\phi(x)=\min\{4x,1,4(1-x)\}\). This function is continuous, equals \(0\) at the endpoints, equals \(1\) on \([1/4,3/4]\), and has compact support \([0,1]\).

The discrepancy is zero on \([1/4,3/4]\) and outside \([0,1]\). On \([0,1/4]\), it is \(1-4x\); on \([3/4,1]\), it is \(1-4(1-x)\). Thus the two equal contributions give

$$ \|\chi_{[0,1]}-\phi\|_2^2 =2\int_0^{1/4}(1-4x)^2\,dx =2\left[\frac{(1-4x)^3}{-12}\right]_{0}^{1/4} =2\cdot\frac{1}{12} =\frac16. $$

Therefore \(\|\chi_{[0,1]}-\phi\|_2=1/\sqrt{6}\). Check: each ramp contributes \(1/12\), so their sum is \(1/12+1/12=1/6\), as computed. The endpoint values do not affect the integral, but choosing \(\phi(0)=\phi(1)=0\) ensures continuity with the zero values outside the interval.

Worked Example: Two Separated Intervals

Let \(E=(0,1)\cup(2,3)\) in \(\mathbb{R}\), and approximate \(\chi_E\) in \(L^1\). With \(\delta=1/8\), define a continuous tent-with-plateau on each interval: for \(a=0\) and \(a=2\), set \(\phi_a=0\) outside \([a,a+1]\), set \(\phi_a(x)=8(x-a)\) on \([a,a+1/8]\), set \(\phi_a(x)=1\) on \([a+1/8,a+7/8]\), and set \(\phi_a(x)=8(a+1-x)\) on \([a+7/8,a+1]\). Let \(\phi=\phi_0+\phi_2\). The supports are disjoint compact intervals, so \(\phi\in C_c(\mathbb{R})\).

For one interval, the error consists of two triangles, each with base \(1/8\) and height \(1\). Their total area is \(2\cdot(1/2)(1/8)(1)=1/8\). The two intervals contribute equally and have disjoint error regions, so

$$ \|\chi_E-\phi\|_1 =\int_{\mathbb{R}}|\chi_E-\phi|\,dm =2\cdot\frac18 =\frac14. $$

Check: each interval has two ramps of area \((1/2)(1/8)(1)=1/16\), hence error \(1/16+1/16=1/8\); adding the two intervals gives \(1/8+1/8=1/4\). The open endpoints of \(E\) differ from the tent supports only at finitely many points, which have Lebesgue measure zero.

Worked Example: A Simple Function with Signed Values

Consider \(f=2\chi_{[0,1]}-\chi_{[2,3]}\) on \(\mathbb{R}\), and construct an explicit compactly supported continuous approximation in \(L^2\). Use the same interval cutoff as in the first example with \(\delta=1/16\): on \([a,a+1]\) it rises linearly from \(0\) to \(1\) over length \(1/16\), is \(1\) up to \(a+15/16\), then decreases linearly to \(0\); it is zero outside \([a,a+1]\). Call these cutoffs \(\phi_0,\phi_2\), and set \(g=2\phi_0-\phi_2\). The two supports are disjoint, and \(g\in C_c(\mathbb{R})\).

For one interval, each ramp discrepancy is a linear decline from \(1\) to \(0\) over length \(\delta\), so its squared integral is \(\int_0^\delta(1-x/\delta)^2\,dx=\delta/3\). The two ramps therefore give \(2\delta/3=2(1/16)/3=1/24\). The coefficient \(2\) on the first interval multiplies its squared error by \(2^2=4\); the coefficient \(-1\) on the second multiplies its squared error by \((-1)^2=1\). As the supports do not overlap,

$$ \|f-g\|_2^2 =4\cdot\frac1{24}+1\cdot\frac1{24} =\frac5{24}, \qquad \|f-g\|_2=\sqrt{\frac5{24}}. $$

Check: the first interval contributes \(4/24=1/6\), the second contributes \(1/24\), and \(1/6+1/24=4/24+1/24=5/24\). The sign of the second coefficient does not change its squared contribution.

Why Both Sides of Regularity Matter

A common error is to control only the outer error \(m(U\setminus E)\) and then assert that the cutoff is close to \(\chi_E\). The cutoff is designed to be \(1\) on a compact subset \(K\), not on all of \(E\); the inner error \(E\setminus K\) must also be controlled. For a concrete check, take \(E=(0,1)\), \(K=[1/10,9/10]\), and \(U=(-1/10,11/10)\). Then \(m(U\setminus E)=1/5\) and \(m(E\setminus K)=1/5\). A cutoff supported in \(U\) and equal to \(1\) on \(K\) may differ from \(\chi_E\) on both regions, whose combined measure is \(2/5\). Thus an estimate based only on the outer error would miss a region of measure \(1/5\).

The density theorem does not claim that every \(L^p\) function is itself continuous, or that its approximants converge pointwise or uniformly. Its conclusion is convergence in the \(L^p\) norm: for every \(\varepsilon>0\), some \(g\in C_c(\mathbb{R}^n)\) satisfies \(\|f-g\|_p<\varepsilon\). The restriction \(p<\infty\) matters in the reduction: the norm is controlled by integrating a \(p\)-th power over the small discrepancy region. Compact support is also substantive on the infinite-measure space \(\mathbb{R}^n\); it is obtained by the compact cutoff construction, rather than by assuming the original function vanishes outside a bounded set.

Check Your Understanding

Use the regularity estimate and the density proof to organize your answers.

  1. Why does a cutoff equal to \(1\) on \(K\) and supported in \(U\) have discrepancy from \(\chi_E\) only in \((E\setminus K)\cup(U\setminus E)\)?
  2. For a finite-measure \(E\), how small should \(\delta\) be chosen to ensure the cutoff error in \(L^p\) is less than a prescribed \(\eta>0\)?
  3. Explain why the finite union of the supports of finitely many cutoff functions is compact.
  4. In the simple-function step, why does multiplying an indicator approximation error by a coefficient \(c_j\) multiply its \(L^p\) norm by \(|c_j|\)?
  5. What part of the proof would fail if one tried to conclude uniform approximation of an indicator of an interval by continuous functions?