The Lebesgue Integral

Part 12, Chapter 12: Measure Theory and the Lebesgue Integral

Learning objectives

  • Define measurable functions and simple functions
  • Construct the Lebesgue integral in three stages: simple, non-negative, general
  • Compute integrals of step functions and the Dirichlet function
  • Contrast Lebesgue integration with Riemann integration on the same examples

The Lebesgue integral is the Riemann integral, but with the partitioning happening on the yy-axis instead of the xx-axis. Riemann chops the domain into vertical slivers and adds up rectangle areas. Lebesgue chops the range into horizontal strips and asks: how much of the domain is mapped into this strip? The reorganisation looks cosmetic but is conceptually decisive: it cleanly separates "what values does the function take?" from "how often does it take each value?", which makes integration robust under limits and extends to a vastly larger class of functions. Every modern theorem about expectations, Fourier transforms, and PDE solutions is a Lebesgue integral.

This section is computational and prose-heavy; the integration construction does not lend itself to a single small widget in lang-core. We make the construction concrete with explicit step-function calculations.

Measurable functions

A function f:(X,mathcalA)tomathbbRf : (X, \mathcal{A}) \to \mathbb{R} is measurable if f1((a,infty))inmathcalAf^{-1}((a, \infty)) \in \mathcal{A} for every ainmathbbRa \in \mathbb{R}, equivalently, the preimage of every Borel set lies in mathcalA\mathcal{A}. On mathbbR\mathbb{R} with the Lebesgue sigma\sigma-algebra, every continuous function is measurable, every monotone function is measurable, every limit of measurable functions is measurable, and the indicator chiA\chi_AA of any measurable set AA is measurable. Non-measurable functions exist but are even harder to construct than non-measurable sets, in practice, "measurable" is automatic.

Simple functions: the building blocks

A simple function is a measurable function taking only finitely many values:

phi=sumk=1nck,chiAk\phi = \sum_{k=1}^n c_k\, \chi_{A_k},chiAk

where ckinmathbbRc_k \in \mathbb{R}kinmathbbR and the AkA_kk are pairwise disjoint measurable sets. The integral of a non-negative simple function is defined directly:

intphi,dmu=sumk=1nck,mu(Ak)\int \phi\, d\mu = \sum_{k=1}^n c_k \,\mu(A_k)k=1nck,mu(Ak)

, the same rectangle-area sum as Riemann, but with mu(Ak)\mu(A_k)k) in place of the width of an interval. The crucial feature: AkA_kk does not have to be an interval.

Three-stage construction

Stage 1. Non-negative simple functions: integral as above.

Stage 2. Non-negative measurable functions fgeq0f \geq 0: define

intf,dmu=supBigintphi,dmu:0leqphileqf,;phi;textsimpleBig\int f\, d\mu = \sup\Big\{ \int \phi\, d\mu : 0 \leq \phi \leq f, \;\phi\;\text{simple} \Big\}

, the supremum of integrals of simple functions below ff. This can be +infty+\infty; we say ff is integrable if the supremum is finite.

Stage 3. General measurable f:XtomathbbRf : X \to \mathbb{R}: split f=f+ff = f^+ - f^- where f+=max(f,0)f^+ = \max(f, 0) and f=max(f,0)f^- = \max(-f, 0) are non-negative. Define

intf,dmu=intf+,dmuintf,dmu\int f\, d\mu = \int f^+\, d\mu - \int f^-\, d\mu

provided at least one of the two integrals is finite (otherwise the difference inftyinfty\infty - \infty is undefined). The function ff is integrable if both intf+,dmu\int f^+\, d\mu and intf,dmu\int f^-\, d\mu are finite, equivalently intf,dmu<infty\int |f|\, d\mu < \infty.

Lebesgue versus Riemann: the Dirichlet function

Let D : [0, 1] \to \mathbb{R} be the Dirichlet function: D(x)=1D(x) = 1 if xinmathbbQx \in \mathbb{Q}, else D(x)=0D(x) = 0. The function takes value 11 on a dense set of rationals and value 00 on the dense set of irrationals.

Riemann sees: every upper Darboux sum is 11 (rationals are dense, so every interval contains a point where D=1D = 1). Every lower Darboux sum is 00 (irrationals are dense, so every interval contains a point where D=0D = 0). The upper integral is 11; the lower integral is 00. They do not agree, so DD is not Riemann integrable.

Lebesgue sees: D = \chi_{\mathbb{Q} \cap [0, 1]} is a simple function (it has only two values). Its integral is

\int_0^1 D\, d\lambda = 1 \cdot \lambda(\mathbb{Q} \cap [0, 1]) + 0 \cdot \lambda([0, 1] \setminus \mathbb{Q}) = 1 \cdot 0 + 0 \cdot 1 = 0.

Lebesgue assigns DD the integral 00. The function is integrable in the Lebesgue sense, and the answer matches the intuition "DD is 11 on a measure-zero set, so its integral is 00."

Where this shows up
  • Probability and expectation: The expected value of a random variable is a Lebesgue integral E[X] = \int X\, dP. Discrete and continuous random variables become a single unified theory because the Lebesgue integral handles both step functions and densities natively.
  • Fourier analysis: The Fourier transform hatf(xi)=intf(x)e2piixxi,dx\hat{f}(\xi) = \int f(x) e^{-2\pi i x \xi}\, dx is a Lebesgue integral on L1(mathbbR)L^1(\mathbb{R}). Plancherel's theorem, the inversion theorem, and the entire LpL^p machinery rest on Lebesgue.
  • Quantum mechanics: Inner products in the Hilbert space L2(mathbbR)L^2(\mathbb{R}) are Lebesgue integrals langlepsi,phirangle=intoverlinepsi(x)phi(x),dx\langle \psi, \phi \rangle = \int \overline{\psi(x)} \phi(x)\, dx. Wave functions are Lebesgue-square-integrable; the Riemann integral would not support the limit operations needed.
  • Machine learning: Cross-entropy loss, KL divergence, and the Radon-Nikodym likelihood ratio are all Lebesgue integrals against a base measure (Lebesgue, counting, or a model density). PyTorch and TensorFlow implement them using Lebesgue-style decomposition into discrete and continuous parts.

Pause and think: Compute int04phi,dlambda\int_0^4 \phi\, d\lambda04phi,dlambda for the step function \phi = 2\chi_{[0, 1)} + 5\chi_{[1, 3]} + 1\chi_{(3, 4]}. (Walk through: each rectangle's area is value times length of the base set, all summed.)

Try it

  • Predict first: what is \int_0^1 \chi_{[0, 1/3]}\, d\lambda? Then compute \int_0^1 (\chi_{[0, 1/3]} + 2\chi_{[1/3, 2/3]} + 3\chi_{[2/3, 1]})\, d\lambda.
  • Show that if f=gf = g almost everywhere (the set where fneqgf \neq g has measure zero), then intf,dlambda=intg,dlambda\int f\, d\lambda = \int g\, d\lambda. (Hint: the difference fgf - g is zero almost everywhere, so its integral is 00.)
  • True or false: every Lebesgue-integrable function is Riemann-integrable. (Hint: think about the Dirichlet function and remember which direction the inclusion runs.)
  • Compute int01f+,dlambda\int_0^1 f^+\, d\lambda01f+,dlambda and int01f,dlambda\int_0^1 f^-\, d\lambda01f,dlambda for f(x)=2x1f(x) = 2x - 1. Then compute int01f,dlambda\int_0^1 f\, d\lambda01f,dlambda using the difference formula. (Hint: f+f^+ lives on [1/2, 1]; ff^- lives on [0, 1/2].)
  • Find a sequence of simple functions phinnearrowf\phi_n \nearrow fnnearrowf approximating f(x)=xf(x) = x on [0, 1] from below, with phin\phi_nn taking 2n2^n values. Use them to recover int01x,dx=1/2\int_0^1 x\, dx = 1/201x,dx=1/2 in the Lebesgue framework.

    A trap to watch for

    A common misconception is that Lebesgue integration replaces Riemann integration entirely. It does not. For any function that is Riemann integrable on [a, b] (which includes every continuous function and every function with countably many discontinuities), the Riemann integral and the Lebesgue integral give the same number. The Lebesgue framework extends the Riemann framework to a wider class, the Dirichlet function is the canonical extension, but on the overlap they agree exactly. So no result you proved with Riemann integrals in calculus needs to be reproved. The only thing changing is the toolkit available for taking limits, which is decisively bigger.

    What you now know

    You can recognise measurable and simple functions, build up the integral in three stages, compute integrals of step functions, and explain why the Dirichlet function is Lebesgue-integrable but not Riemann-integrable. The next and final section showcases the real payoff of this construction: convergence theorems that let you swap lim\lim and int\int under conditions Riemann could never tolerate.

    Mark section complete →

    References

    • Garrity, T. (2002). All the Mathematics You Missed: But Need to Know for Graduate School. Cambridge University Press, ch. 12.
    • Royden, H. L., Fitzpatrick, P. M. (2010). Real Analysis (4th ed.). Pearson, ch. 3-4.
    • Folland, G. B. (1999). Real Analysis: Modern Techniques and Their Applications (2nd ed.). Wiley, ch. 2.
    • Rudin, W. (1987). Real and Complex Analysis (3rd ed.). McGraw-Hill, ch. 1.
    • Stein, E. M., Shakarchi, R. (2005). Real Analysis. Princeton UP, ch. 2.

    This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.