Skip to content
The Lumenary
First-year graduateGraduate 150 min

Measure theory and integration

Lebesgue's idea — slice the range, not the domain — gives an integral that commutes with limits, a notion of size for wild sets, and the complete function spaces on which modern analysis and probability are built.

Formally verified · 12 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

Why the Riemann integral is not enough

The Riemann integral is built for continuous functions on intervals, and it behaves badly under limits. Enumerate the rationals of [0,1][0, 1] as q1,q2,…q_1, q_2, \dots and let fnf_n be the indicator of {q1,…,qn}\{q_1, \dots, q_n\}. Each fnf_n is Riemann integrable with integral 00, the sequence increases, and its pointwise limit is the Dirichlet function 1Q∩[0,1]\mathbf 1_{\Q \cap [0, 1]}, whose upper Riemann sums are all 11 and lower sums all 00. A monotone limit of integrable functions with integrals 00 has no Riemann integral.

This is not a curiosity. Fourier series, solutions of differential equations and probability all produce functions as limits, and analysis needs a space of integrable functions that is complete: Cauchy sequences should converge to something integrable. Henri Lebesgue's thesis (1902) supplied it. His idea, in his own later image, is the shopkeeper's: to count the takings, do not add coins in the order they arrived (the Riemann sum over the domain); sort them by value and multiply each value by how many coins have it. For a function, that means slicing the range and asking for the size of each set {x:f(x)>t}\{x : f(x) > t\}. That requires a notion of size — a measure — for sets far wilder than intervals.

IntuitionH

Slicing the range

Left: Riemann partitions the domain into vertical strips. Right: Lebesgue partitions the range into horizontal layers; the layer at height $t$ has width $\lambda(\{f > t\})$, which may be a complicated set. Integrating the widths over $t$ gives the layer-cake formula $\int f \, d\mu = \int_0^\infty \mu(\{f > t\}) \, dt$ for $f \ge 0$.

For a hump-shaped function the two pictures give the same number. They part ways for wild functions. For the Dirichlet function, the vertical strips never settle down, but the horizontal picture is easy: the set where 1Q>t\mathbf 1_\Q > t is Q∩[0,1]\Q \cap [0, 1] for 0≤t<10 \le t < 1, a countable set, and a countable set ought to have size 00. So the Lebesgue integral of the Dirichlet function is 00.

Three questions organise the subject. Which sets get a size? Not all of them: Vitali's construction below produces a subset of R\R that cannot be given any translation-invariant, countably additive length. How do we build the size function? By approximating from outside with countably many intervals (outer measure) and keeping the sets that split every other set additively (Carathéodory). What do we gain? Countable additivity of the measure becomes, for integrals, the convergence theorems: under monotonicity or domination, lim⁡∫fn=∫lim⁡fn\lim \int f_n = \int \lim f_n.

DefinitionsH

σ-algebras, measures and the integral

Definition— σ-algebra and measure

A σ-algebra on a set XX is a collection M\mathcal M of subsets of XX containing XX and closed under complements and countable unions (hence also countable intersections). A measure on (X,M)(X, \mathcal M) is a function μ:M→[0,∞]\mu : \mathcal M \to [0, \infty] with μ(∅)=0\mu(\varnothing) = 0 that is countably additive: μ(⋃jEj)=∑jμ(Ej)\mu\big(\bigcup_j E_j\big) = \sum_j \mu(E_j) for pairwise disjoint Ej∈ME_j \in \mathcal M. The triple (X,M,μ)(X, \mathcal M, \mu) is a measure space; it is finite if μ(X)<∞\mu(X) < \infty, a probability space if μ(X)=1\mu(X) = 1, and σ-finite if XX is a countable union of sets of finite measure.

From countable additivity: μ\mu is monotone, countably subadditive (μ(⋃Ej)≤∑μ(Ej)\mu(\bigcup E_j) \le \sum \mu(E_j) for any EjE_j), continuous from below (E1⊆E2⊆⋯E_1 \subseteq E_2 \subseteq \cdots implies μ(⋃En)=lim⁡μ(En)\mu(\bigcup E_n) = \lim \mu(E_n)), and continuous from above when μ(E1)<∞\mu(E_1) < \infty. The Borel σ-algebra B(X)\mathcal B(X) of a topological space is the smallest σ-algebra containing the open sets. A property holds almost everywhere (a.e.) if it fails only on a set of measure 00, a null set.

Definition— outer measure and Carathéodory measurability

An outer measure on XX is a function μ∗:P(X)→[0,∞]\mu^* : \mathcal P(X) \to [0, \infty] with μ∗(∅)=0\mu^*(\varnothing) = 0, monotone, and countably subadditive. A set E⊆XE \subseteq X is μ∗\mu^*-measurable if it splits every set additively:

μ∗(A)=μ∗(A∩E)+μ∗(A∖E)for every A⊆X.\mu^*(A) = \mu^*(A \cap E) + \mu^*(A \setminus E) \quad \text{for every } A \subseteq X.

Lebesgue outer measure on R\R is λ∗(A)=inf⁡{∑j(bj−aj):A⊆⋃j≥1(aj,bj)}\lambda^*(A) = \inf\left\{ \sum_j (b_j - a_j) : A \subseteq \bigcup_{j \ge 1} (a_j, b_j) \right\}, the infimum over countable covers by open intervals.

Definition— measurable function and the integral

A function f:X→[−∞,∞]f : X \to [-\infty, \infty] is measurable if {x:f(x)>t}∈M\{x : f(x) > t\} \in \mathcal M for every t∈Rt \in \R. A simple function is a finite combination φ=∑i=1kci1Ei\varphi = \sum_{i=1}^k c_i \mathbf 1_{E_i} with Ei∈ME_i \in \mathcal M; for φ≥0\varphi \ge 0 (with the EiE_i disjoint), ∫φ dμ=∑ici μ(Ei)\int \varphi \, d\mu = \sum_i c_i \, \mu(E_i), with 0⋅∞=00 \cdot \infty = 0. For measurable f≥0f \ge 0,

∫f dμ=sup⁡{∫φ dμ:0≤φ≤f, φ simple}∈[0,∞].\int f \, d\mu = \sup \left\{ \int \varphi \, d\mu : 0 \le \varphi \le f, \ \varphi \text{ simple} \right\} \in [0, \infty].

A real measurable ff is integrable, f∈L1(μ)f \in \mathcal L^1(\mu), if ∫∣f∣ dμ<∞\int |f| \, d\mu < \infty, and then ∫f=∫f+−∫f−\int f = \int f^+ - \int f^- where f±=max⁡(±f,0)f^\pm = \max(\pm f, 0).

Every measurable f≥0f \ge 0 is the increasing limit of the simple functions

φn=∑k=0n2n−1k2n 1{k2−n≤f<(k+1)2−n}+n 1{f≥n},\varphi_n = \sum_{k=0}^{n 2^n - 1} \frac{k}{2^n} \, \mathbf 1_{\{k 2^{-n} \le f < (k+1) 2^{-n}\}} + n \, \mathbf 1_{\{f \ge n\}},

which round ff down to the dyadic grid of mesh 2−n2^{-n} and cap it at nn. This is the "slice the range" picture made precise.

Definition— Lᵖ spaces

For 1≤p<∞1 \le p < \infty let ∥f∥p=(∫∣f∣p dμ)1/p\|f\|_p = \left( \int |f|^p \, d\mu \right)^{1/p}, and let ∥f∥∞=inf⁡{M:∣f∣≤M a.e.}\|f\|_\infty = \inf\{ M : |f| \le M \text{ a.e.}\} (the essential supremum). Then Lp(μ)L^p(\mu) is the space of measurable ff with ∥f∥p<∞\|f\|_p < \infty, with functions equal almost everywhere identified. Without the identification, ∥⋅∥p\|\cdot\|_p is only a seminorm: ∥1Q∥p=0\|\mathbf 1_\Q\|_p = 0.

Hölder's inequality ∫∣fg∣≤∥f∥p∥g∥q\int |fg| \le \|f\|_p \|g\|_q for 1/p+1/q=11/p + 1/q = 1, and Minkowski's inequality ∥f+g∥p≤∥f∥p+∥g∥p\|f + g\|_p \le \|f\|_p + \|g\|_p, follow from Young's inequality ab≤ap/p+bq/qab \le a^p/p + b^q/q (Folland, §6.1); Minkowski makes ∥⋅∥p\|\cdot\|_p a norm on LpL^p.

ProofH

Constructing Lebesgue measure

Theorem— Carathéodory's theorem

Let μ∗\mu^* be an outer measure on XX. The μ∗\mu^*-measurable sets form a σ-algebra M\mathcal M, and the restriction of μ∗\mu^* to M\mathcal M is a measure. Moreover every set with μ∗(E)=0\mu^*(E) = 0 is in M\mathcal M (the measure is complete).

Proof

By subadditivity μ∗(A)≤μ∗(A∩E)+μ∗(A∖E)\mu^*(A) \le \mu^*(A \cap E) + \mu^*(A \setminus E) always, so EE is measurable as soon as μ∗(A)≥μ∗(A∩E)+μ∗(A∖E)\mu^*(A) \ge \mu^*(A \cap E) + \mu^*(A \setminus E) for all AA. The definition is symmetric in EE and EcE^c, so M\mathcal M is closed under complements. If μ∗(E)=0\mu^*(E) = 0 then μ∗(A∩E)=0\mu^*(A \cap E) = 0 and μ∗(A∖E)≤μ∗(A)\mu^*(A \setminus E) \le \mu^*(A), so E∈ME \in \mathcal M.

Finite unions. Let E,F∈ME, F \in \mathcal M and A⊆XA \subseteq X. Splitting AA by EE and then both pieces by FF,

μ∗(A)=μ∗(A∩E∩F)+μ∗(A∩E∩Fc)+μ∗(A∩Ec∩F)+μ∗(A∩Ec∩Fc).\mu^*(A) = \mu^*(A \cap E \cap F) + \mu^*(A \cap E \cap F^c) + \mu^*(A \cap E^c \cap F) + \mu^*(A \cap E^c \cap F^c).

The first three sets have union A∩(E∪F)A \cap (E \cup F), so by subadditivity their measures sum to at least μ∗(A∩(E∪F))\mu^*(A \cap (E \cup F)); the last set is A∖(E∪F)A \setminus (E \cup F). Hence E∪F∈ME \cup F \in \mathcal M, and M\mathcal M is an algebra.

Countable disjoint unions. Let E1,E2,…∈ME_1, E_2, \ldots \in \mathcal M be disjoint, Bn=⋃j≤nEjB_n = \bigcup_{j \le n} E_j and B=⋃jEjB = \bigcup_j E_j. Splitting A∩BnA \cap B_n by En∈ME_n \in \mathcal M gives μ∗(A∩Bn)=μ∗(A∩En)+μ∗(A∩Bn−1)\mu^*(A \cap B_n) = \mu^*(A \cap E_n) + \mu^*(A \cap B_{n-1}), so by induction μ∗(A∩Bn)=∑j≤nμ∗(A∩Ej)\mu^*(A \cap B_n) = \sum_{j \le n} \mu^*(A \cap E_j). Since Bn∈MB_n \in \mathcal M and A∖Bn⊇A∖BA \setminus B_n \supseteq A \setminus B,

μ∗(A)=μ∗(A∩Bn)+μ∗(A∖Bn)≥∑j≤nμ∗(A∩Ej)+μ∗(A∖B).\mu^*(A) = \mu^*(A \cap B_n) + \mu^*(A \setminus B_n) \ge \sum_{j \le n} \mu^*(A \cap E_j) + \mu^*(A \setminus B).

Let n→∞n \to \infty and use subadditivity once more:

μ∗(A)≥∑j=1∞μ∗(A∩Ej)+μ∗(A∖B)≥μ∗(A∩B)+μ∗(A∖B)≥μ∗(A).\mu^*(A) \ge \sum_{j=1}^\infty \mu^*(A \cap E_j) + \mu^*(A \setminus B) \ge \mu^*(A \cap B) + \mu^*(A \setminus B) \ge \mu^*(A).

All are equalities. So B∈MB \in \mathcal M, and taking A=BA = B gives μ∗(B)=∑jμ∗(Ej)\mu^*(B) = \sum_j \mu^*(E_j): countable additivity. An arbitrary countable union ⋃Fj\bigcup F_j in M\mathcal M equals the disjoint union of Fj∖(F1∪⋯∪Fj−1)F_j \setminus (F_1 \cup \dots \cup F_{j-1}), which lie in the algebra M\mathcal M; so M\mathcal M is a σ-algebra.

∎

Theorem— Theorem (outer measure of an interval)

λ∗([a,b])=b−a\lambda^*([a, b]) = b - a for all a≤ba \le b. Consequently λ∗(I)\lambda^*(I) is the length of every bounded interval II.

Proof

The cover by the single interval (a−ε,b+ε)(a - \varepsilon, b + \varepsilon) gives λ∗([a,b])≤b−a+2ε\lambda^*([a, b]) \le b - a + 2\varepsilon for every ε>0\varepsilon > 0. Conversely let [a,b]⊆⋃j(aj,bj)[a, b] \subseteq \bigcup_j (a_j, b_j). By the Heine–Borel theorem finitely many of these intervals already cover [a,b][a, b]. Choose one, (c1,d1)(c_1, d_1), containing aa. If d1≤bd_1 \le b, then d1∈[a,b]d_1 \in [a, b] lies in another chosen interval (c2,d2)(c_2, d_2), with c2<d1<d2c_2 < d_1 < d_2. Continue. The right endpoints d1<d2<⋯d_1 < d_2 < \cdots strictly increase, so the chosen intervals are distinct members of the finite subcover, and after some kk steps dk>bd_k > b. Then

∑j(bj−aj)≥∑i=1k(di−ci)=dk−∑i=1k−1(ci+1−di)−c1≥dk−c1>b−a,\sum_j (b_j - a_j) \ge \sum_{i=1}^k (d_i - c_i) = d_k - \sum_{i=1}^{k-1} (c_{i+1} - d_i) - c_1 \ge d_k - c_1 > b - a,

because each ci+1−di<0c_{i+1} - d_i < 0. Taking the infimum over covers, λ∗([a,b])≥b−a\lambda^*([a, b]) \ge b - a. A bounded interval with endpoints a<ba < b lies between [a+ε,b−ε][a + \varepsilon, b - \varepsilon] and [a,b][a, b], so by monotonicity its outer measure is its length.

∎

Theorem— Theorem (Borel sets are Lebesgue measurable)

Every half-line H=(−∞,c]H = (-\infty, c] is λ∗\lambda^*-measurable. Hence every Borel set is, and Lebesgue measure λ\lambda, the restriction of λ∗\lambda^* to the Carathéodory σ-algebra L\mathcal L, satisfies λ(I)=length⁡(I)\lambda(I) = \operatorname{length}(I) for every interval.

Proof

Let A⊆RA \subseteq \R with λ∗(A)<∞\lambda^*(A) < \infty and ε>0\varepsilon > 0, and cover AA by open intervals IjI_j with ∑j∣Ij∣≤λ∗(A)+ε\sum_j |I_j| \le \lambda^*(A) + \varepsilon. Each IjI_j splits into the intervals Ij∩HI_j \cap H and Ij∖HI_j \setminus H, whose lengths add up to ∣Ij∣|I_j| and which equal their outer measures by the previous theorem. By monotonicity and subadditivity,

λ∗(A∩H)+λ∗(A∖H)≤∑j(λ∗(Ij∩H)+λ∗(Ij∖H))=∑j∣Ij∣≤λ∗(A)+ε.\lambda^*(A \cap H) + \lambda^*(A \setminus H) \le \sum_j \big(\lambda^*(I_j \cap H) + \lambda^*(I_j \setminus H)\big) = \sum_j |I_j| \le \lambda^*(A) + \varepsilon.

So HH is measurable. The half-lines generate B(R)\mathcal B(\R): writing Hc=(−∞,c]H_c = (-\infty, c], an open interval is the countable union (a,b)=⋃n(Hb−1/n∖Ha)(a, b) = \bigcup_n \big(H_{b - 1/n} \setminus H_a\big), and every open set is a countable union of open intervals. Since L\mathcal L is a σ-algebra containing the half-lines, B(R)⊆L\mathcal B(\R) \subseteq \mathcal L.

∎

The same recipe — a premeasure on an algebra of simple sets, extended by outer measure and Carathéodory — builds Lebesgue measure on Rn\R^n (from boxes), Lebesgue–Stieltjes measures μ((a,b])=F(b)−F(a)\mu((a, b]) = F(b) - F(a) for increasing right-continuous FF (the distributions of probability), product measures, and Hausdorff measures. Lebesgue measure is translation invariant, and up to a constant factor it is the only translation-invariant measure on B(R)\mathcal B(\R) that is finite on bounded sets.

Worked examplesH

Null sets, a non-measurable set, and escaping mass

Example— Countable sets are null; so is the Cantor set

A singleton {x}\{x\} lies in [x,x][x, x], so λ({x})=0\lambda(\{x\}) = 0, and by countable subadditivity every countable set is null. In particular λ(Q)=0\lambda(\Q) = 0, so ∫1Q dλ=1⋅λ(Q∩[0,1])=0\int \mathbf 1_\Q \, d\lambda = 1 \cdot \lambda(\Q \cap [0, 1]) = 0.

The converse fails. The Cantor set C=⋂nCnC = \bigcap_n C_n, where CnC_n is obtained from [0,1][0, 1] by removing open middle thirds nn times, is a union of 2n2^n intervals of length 3−n3^{-n} at stage nn; so λ(C)≤(2/3)n\lambda(C) \le (2/3)^n for every nn, and λ(C)=0\lambda(C) = 0. Yet CC consists of the numbers with a ternary expansion using only the digits 00 and 22, and the map (bi)↦∑i2bi3−i(b_i) \mapsto \sum_i 2 b_i 3^{-i} from {0,1}N\{0, 1\}^\N to CC is injective, so ∣C∣=2ℵ0|C| = 2^{\aleph_0}. Since every subset of CC is null, hence Lebesgue measurable, L\mathcal L has 22ℵ02^{2^{\aleph_0}} elements while B(R)\mathcal B(\R) has only 2ℵ02^{\aleph_0}: there are Lebesgue measurable sets that are not Borel.

Example— Small open dense sets

Enumerate Q={q1,q2,…}\Q = \{q_1, q_2, \ldots\} and let U=⋃n(qn−ε2−n,qn+ε2−n)U = \bigcup_n (q_n - \varepsilon 2^{-n}, q_n + \varepsilon 2^{-n}). Then UU is open and dense, and λ(U)≤∑n2ε2−n=2ε\lambda(U) \le \sum_n 2\varepsilon 2^{-n} = 2\varepsilon. Topologically UU is "large" (its complement is nowhere dense), measure-theoretically it is small. Intersecting such sets for ε=1/k\varepsilon = 1/k gives a dense GδG_\delta set of measure zero: R\R is the union of a meagre set and a null set.

Example— Vitali's non-measurable set (uses the axiom of choice)

Call x,y∈[0,1)x, y \in [0, 1) equivalent if x−y∈Qx - y \in \Q. Using the axiom of choice, pick one point from each equivalence class to form VV. For rationals r∈[0,1)r \in [0, 1) the translates Vr={v+r mod 1:v∈V}V_r = \{v + r \bmod 1 : v \in V\} are pairwise disjoint and cover [0,1)[0, 1). If VV were measurable, each VrV_r would be measurable with λ(Vr)=λ(V)\lambda(V_r) = \lambda(V) (translation invariance, applied piecewise), and countable additivity would give 1=∑rλ(V)1 = \sum_{r} \lambda(V), which is 00 or ∞\infty. Contradiction. So no measure on all of P(R)\mathcal P(\R) can be translation invariant, countably additive and give [0,1)[0, 1) measure 11: σ-algebras are a necessity, not a fussiness.

Example— Mass that escapes

Three sequences on R\R with Lebesgue measure, each converging to 00 at every point:

  • fn=n1(0,1/n)f_n = n \mathbf 1_{(0, 1/n)} (mass escapes upwards): ∫fn=1\int f_n = 1 for all nn;
  • gn=1[n,n+1]g_n = \mathbf 1_{[n, n+1]} (mass escapes to infinity): ∫gn=1\int g_n = 1;
  • hn=1n1[0,n]h_n = \frac1n \mathbf 1_{[0, n]} (mass spreads out): ∫hn=1\int h_n = 1, even though hn→0h_n \to 0 uniformly.

In each case lim⁡∫=1≠0=∫lim⁡\lim \int = 1 \ne 0 = \int \lim. None is monotone, and none has an integrable dominating function: sup⁡nfn(x)≈1/x\sup_n f_n(x) \approx 1/x near 00, sup⁡ngn=1[0,∞)\sup_n g_n = \mathbf 1_{[0, \infty)} and sup⁡nhn(x)≈1/x\sup_n h_n(x) \approx 1/x for large xx are not integrable. Fatou's lemma, proved below, says that the inequality ∫lim⁡≤lim⁡∫\int \lim \le \lim \int is all that survives in general: mass can be lost in the limit, never created.

ProofH

The convergence theorems

Throughout, (X,M,μ)(X, \mathcal M, \mu) is a measure space. Two facts follow at once from the definitions: the integral is monotone (0≤f≤g0 \le f \le g implies ∫f≤∫g\int f \le \int g), and for a simple φ≥0\varphi \ge 0 the map A↦∫Aφ dμ=∑iciμ(A∩Ei)A \mapsto \int_A \varphi \, d\mu = \sum_i c_i \mu(A \cap E_i) is a measure on M\mathcal M, hence continuous from below.

Theorem— Monotone convergence theorem (Beppo Levi, 1906)

If fn:X→[0,∞]f_n : X \to [0, \infty] are measurable and f1≤f2≤⋯f_1 \le f_2 \le \cdots pointwise, with f=lim⁡fnf = \lim f_n, then ∫f dμ=lim⁡n→∞∫fn dμ\int f \, d\mu = \lim_{n \to \infty} \int f_n \, d\mu.

Proof

The limit f=sup⁡nfnf = \sup_n f_n is measurable, since {f>t}=⋃n{fn>t}\{f > t\} = \bigcup_n \{f_n > t\}. By monotonicity ∫fn\int f_n increases to some L≤∫fL \le \int f. For the reverse inequality, fix a simple 0≤φ≤f0 \le \varphi \le f and α∈(0,1)\alpha \in (0, 1), and let En={x:fn(x)≥αφ(x)}E_n = \{x : f_n(x) \ge \alpha \varphi(x)\}. These sets are measurable and increasing, and their union is XX: if φ(x)=0\varphi(x) = 0 then x∈E1x \in E_1, and if φ(x)>0\varphi(x) > 0 then αφ(x)<φ(x)≤f(x)\alpha\varphi(x) < \varphi(x) \le f(x), so fn(x)≥αφ(x)f_n(x) \ge \alpha \varphi(x) for large nn. Hence

∫fn dμ≥∫Enfn dμ≥α∫Enφ dμ→n→∞α∫φ dμ,\int f_n \, d\mu \ge \int_{E_n} f_n \, d\mu \ge \alpha \int_{E_n} \varphi \, d\mu \xrightarrow[n \to \infty]{} \alpha \int \varphi \, d\mu,

by continuity from below of A↦∫AφA \mapsto \int_A \varphi. So L≥α∫φL \ge \alpha \int \varphi. Let α→1\alpha \to 1 and take the supremum over φ\varphi: L≥∫fL \ge \int f.

∎

Applied to the partial sums, monotone convergence gives ∫∑ngn=∑n∫gn\int \sum_n g_n = \sum_n \int g_n for measurable gn≥0g_n \ge 0 — termwise integration of non-negative series with no further hypothesis. With the dyadic approximations φn↑f\varphi_n \uparrow f it also shows that the integral is additive, ∫(f+g)=∫f+∫g\int (f + g) = \int f + \int g, because it is additive on simple functions.

Theorem— Fatou's lemma (1906)

For measurable fn:X→[0,∞]f_n : X \to [0, \infty], ∫lim inf⁡n→∞fn dμ≤lim inf⁡n→∞∫fn dμ\displaystyle \int \liminf_{n \to \infty} f_n \, d\mu \le \liminf_{n \to \infty} \int f_n \, d\mu.

Proof

Let gk=inf⁡n≥kfng_k = \inf_{n \ge k} f_n. Then gkg_k is measurable, g1≤g2≤⋯g_1 \le g_2 \le \cdots, and lim⁡kgk=lim inf⁡nfn\lim_k g_k = \liminf_n f_n. Since gk≤fng_k \le f_n for every n≥kn \ge k, we have ∫gk≤inf⁡n≥k∫fn\int g_k \le \inf_{n \ge k} \int f_n. By monotone convergence, ∫lim inf⁡fn=lim⁡k∫gk≤lim⁡kinf⁡n≥k∫fn=lim inf⁡∫fn\int \liminf f_n = \lim_k \int g_k \le \lim_k \inf_{n \ge k} \int f_n = \liminf \int f_n.

∎

Theorem— Dominated convergence theorem (Lebesgue)

Let fnf_n be real measurable functions with fn→ff_n \to f almost everywhere, and suppose there is g∈L1(μ)g \in \mathcal L^1(\mu) with ∣fn∣≤g|f_n| \le g a.e. for all nn. Then f∈L1(μ)f \in \mathcal L^1(\mu) and ∫fn dμ→∫f dμ\int f_n \, d\mu \to \int f \, d\mu; in fact ∫∣fn−f∣ dμ→0\int |f_n - f| \, d\mu \to 0.

Proof

Changing the functions on a null set changes no integral, so we may assume fn→ff_n \to f and ∣fn∣≤g|f_n| \le g everywhere. Then ∣f∣≤g|f| \le g, so ff is integrable. The functions g+fng + f_n and g−fng - f_n are non-negative, so Fatou's lemma gives

∫g+∫f≤lim inf⁡n∫(g+fn)=∫g+lim inf⁡n∫fn,∫g−∫f≤∫g−lim sup⁡n∫fn.\int g + \int f \le \liminf_n \int (g + f_n) = \int g + \liminf_n \int f_n, \qquad \int g - \int f \le \int g - \limsup_n \int f_n.

Since ∫g<∞\int g < \infty we may cancel it: lim sup⁡∫fn≤∫f≤lim inf⁡∫fn\limsup \int f_n \le \int f \le \liminf \int f_n. For the stronger statement apply what was just proved to ∣fn−f∣→0|f_n - f| \to 0, which is dominated by 2g2g.

∎

In the examples above no integrable gg dominates, and the conclusion fails. Dominated convergence also justifies differentiation under the integral sign: if ∂tF(x,t)\partial_t F(x, t) exists and ∣∂tF(x,t)∣≤g(x)|\partial_t F(x, t)| \le g(x) with gg integrable, then ddt∫F(x,t) dx=∫∂tF(x,t) dx\frac{d}{dt} \int F(x, t) \, dx = \int \partial_t F(x, t) \, dx (apply dominated convergence to difference quotients, bounded by gg via the mean value theorem).

ProofH

Products, Lᵖ and the Riemann integral

Theorem— Fubini–Tonelli theorem (Fubini 1907, Tonelli 1909)

Let (X,M,μ)(X, \mathcal M, \mu) and (Y,N,ν)(Y, \mathcal N, \nu) be σ-finite and μ×ν\mu \times \nu the product measure on M⊗N\mathcal M \otimes \mathcal N, determined by (μ×ν)(A×B)=μ(A)ν(B)(\mu \times \nu)(A \times B) = \mu(A) \nu(B).

  1. (Tonelli) If f:X×Y→[0,∞]f : X \times Y \to [0, \infty] is M⊗N\mathcal M \otimes \mathcal N-measurable, then x↦∫f(x,y) dν(y)x \mapsto \int f(x, y) \, d\nu(y) and y↦∫f(x,y) dμ(x)y \mapsto \int f(x, y) \, d\mu(x) are measurable and
∫X×Yf d(μ×ν)=∫X∫Yf(x,y) dν(y) dμ(x)=∫Y∫Xf(x,y) dμ(x) dν(y).\int_{X \times Y} f \, d(\mu \times \nu) = \int_X \int_Y f(x, y) \, d\nu(y) \, d\mu(x) = \int_Y \int_X f(x, y) \, d\mu(x) \, d\nu(y).
  1. (Fubini) If f∈L1(μ×ν)f \in \mathcal L^1(\mu \times \nu), then f(x,⋅)∈L1(ν)f(x, \cdot) \in \mathcal L^1(\nu) for a.e. xx, f(⋅,y)∈L1(μ)f(\cdot, y) \in \mathcal L^1(\mu) for a.e. yy, the a.e.-defined iterated integrals are integrable, and the same equalities hold.

About the proof. The product measure comes from the premeasure on finite unions of rectangles via Carathéodory. One proves the formula for indicators of rectangles, extends it to all of M⊗N\mathcal M \otimes \mathcal N with the monotone class lemma (this is where σ-finiteness enters, through continuity from above), then to simple functions by linearity, to non-negative functions by monotone convergence, and to integrable functions by splitting f=f+−f−f = f^+ - f^-. Details: Folland, §2.5, or Stein–Shakarchi, Ch. 2 §3. In practice one uses Tonelli on ∣f∣|f| to check integrability and then Fubini to compute.

Both hypotheses are needed:

  • Integrability. On N×N\N \times \N with counting measure let am,n=1a_{m,n} = 1 if m=nm = n, am,n=−1a_{m,n} = -1 if m=n+1m = n + 1, and 00 otherwise. Every column sums to 00 and every row except the first sums to 00, so ∑n∑mam,n=0\sum_n \sum_m a_{m,n} = 0 while ∑m∑nam,n=1\sum_m \sum_n a_{m,n} = 1. Here ∑∣am,n∣=∞\sum |a_{m,n}| = \infty. (A continuous version: (x2−y2)/(x2+y2)2(x^2 - y^2)/(x^2 + y^2)^2 on (0,1)2(0, 1)^2 has iterated integrals ±π/4\pm \pi/4.)
  • σ-finiteness. Let μ\mu be Lebesgue measure and ν\nu counting measure on [0,1][0, 1], and f=1{x=y}f = \mathbf 1_{\{x = y\}}. Then ∫ ⁣ ⁣∫f dν dμ=∫1 dμ=1\int \!\! \int f \, d\nu \, d\mu = \int 1 \, d\mu = 1 but ∫ ⁣ ⁣∫f dμ dν=∫0 dν=0\int \!\! \int f \, d\mu \, d\nu = \int 0 \, d\nu = 0.

Theorem— Riesz–Fischer theorem (1907)

For 1≤p≤∞1 \le p \le \infty, Lp(μ)L^p(\mu) is a Banach space. Moreover every sequence converging in LpL^p has a subsequence converging almost everywhere.

Proof

Step 1: a criterion. A normed space is complete if every absolutely convergent series ∑∥uk∥<∞\sum \|u_k\| < \infty converges. Indeed, given a Cauchy sequence (fn)(f_n) choose n1<n2<⋯n_1 < n_2 < \cdots with ∥fm−fn∥<2−j\|f_m - f_n\| < 2^{-j} for m,n≥njm, n \ge n_j. The series fn1+∑j(fnj+1−fnj)f_{n_1} + \sum_j (f_{n_{j+1}} - f_{n_j}) is absolutely convergent, so its partial sums fnkf_{n_k} converge; and a Cauchy sequence with a convergent subsequence converges.

Step 2: 1≤p<∞1 \le p < \infty. Let ∑k∥uk∥p=B<∞\sum_k \|u_k\|_p = B < \infty. Put Gn=∑k≤n∣uk∣G_n = \sum_{k \le n} |u_k| and G=∑k∣uk∣∈[0,∞]G = \sum_k |u_k| \in [0, \infty]. By Minkowski ∥Gn∥p≤B\|G_n\|_p \le B, and by monotone convergence ∫Gp=lim⁡∫Gnp≤Bp\int G^p = \lim \int G_n^p \le B^p. So G<∞G < \infty a.e., and on that set ∑kuk(x)\sum_k u_k(x) converges absolutely to some F(x)F(x) (set F=0F = 0 elsewhere). Then ∣F∣≤G|F| \le G, so F∈LpF \in L^p, and ∣F−∑k≤nuk∣p≤(2G)p∈L1|F - \sum_{k \le n} u_k|^p \le (2G)^p \in L^1. By dominated convergence ∥F−∑k≤nuk∥p→0\|F - \sum_{k \le n} u_k\|_p \to 0. The same argument applied to the series of Step 1 shows that the subsequence fnkf_{n_k} converges a.e.

Step 3: p=∞p = \infty. If (fn)(f_n) is Cauchy in L∞L^\infty, the sets {∣fm−fn∣>∥fm−fn∥∞}\{|f_m - f_n| > \|f_m - f_n\|_\infty\} are null; off their (countable, hence null) union, (fn)(f_n) is uniformly Cauchy and converges uniformly to a bounded ff, and ∥fn−f∥∞→0\|f_n - f\|_\infty \to 0.

∎

The subsequence cannot be avoided. The typewriter sequence — indicators of [0,1][0, 1], then [0,12],[12,1][0, \tfrac12], [\tfrac12, 1], then the four quarters, and so on — tends to 00 in L1L^1 (the integrals are the interval lengths), but at every x∈[0,1]x \in [0, 1] it takes the value 11 infinitely often. When p=2p = 2, L2(μ)L^2(\mu) is a Hilbert space with ⟨f,g⟩=∫fgˉ dμ\langle f, g \rangle = \int f \bar g \, d\mu; it is the stage for Fourier analysis and quantum mechanics.

Theorem— Theorem (Riemann integrable functions are Lebesgue integrable)

If f:[a,b]→Rf : [a, b] \to \R is Riemann integrable, then ff is Lebesgue measurable and integrable, and its Lebesgue integral equals its Riemann integral.

Proof

Take partitions P1⊆P2⊆⋯P_1 \subseteq P_2 \subseteq \cdots, each refining the last, whose lower and upper Riemann sums Lk,UkL_k, U_k both converge to the Riemann integral RR. Let ℓk≤f≤uk\ell_k \le f \le u_k be the corresponding lower and upper step functions (on each subinterval, the infimum and supremum of ff), so ∫ℓk dλ=Lk\int \ell_k \, d\lambda = L_k and ∫uk dλ=Uk\int u_k \, d\lambda = U_k. Refinement makes ℓk\ell_k increase and uku_k decrease; their limits ℓ≤f≤u\ell \le f \le u are Borel measurable and bounded by sup⁡∣f∣\sup |f|. By dominated convergence ∫ℓ=lim⁡Lk=R=lim⁡Uk=∫u\int \ell = \lim L_k = R = \lim U_k = \int u, so ∫(u−ℓ)=0\int (u - \ell) = 0 with u−ℓ≥0u - \ell \ge 0, and therefore u=ℓu = \ell a.e. (Markov's inequality: λ({u−ℓ≥1/m})≤m∫(u−ℓ)=0\lambda(\{u - \ell \ge 1/m\}) \le m \int (u - \ell) = 0 for every mm). Thus f=ℓf = \ell except on a null set, so ff is measurable for the complete σ-algebra L\mathcal L, and ∫f dλ=∫ℓ dλ=R\int f \, d\lambda = \int \ell \, d\lambda = R.

∎

Lebesgue's criterion sharpens this: a bounded function on [a,b][a, b] is Riemann integrable exactly when its set of discontinuities is null. Improper Riemann integrals are another matter: ∫0∞sin⁡xx dx=π2\int_0^\infty \frac{\sin x}{x} \, dx = \frac\pi2 exists as an improper Riemann integral, but sin⁡xx∉L1(0,∞)\frac{\sin x}{x} \notin \mathcal L^1(0, \infty) because ∫0∞∣sin⁡x∣x dx=∞\int_0^\infty \frac{|\sin x|}{x} \, dx = \infty. The Lebesgue integral is an absolute integral.

Formal mathematicsF

Measure theory in Lean and Mathlib

Mathlib's measure theory is one of its largest and most used libraries: probability theory, the Fourier transform and the integration on manifolds are all built on it. Its volume on ℝ is Lebesgue measure, constructed from outer measure with Carathéodory's criterion via Stieltjes functions, exactly as above. It extends length:

volume_IccLean 4Applies a library theoremFormally verified
/-- Lebesgue measure extends length: `λ([a, b]) = b − a` (as an extended non-negative real;
`ENNReal.ofReal` sends negative numbers to `0`, so the formula also covers `b < a`). Mathlib
constructs `volume` on `ℝ` by Carathéodory's criterion and proves this as `Real.volume_Icc`. -/
theorem volume_Icc (a b : ℝ) : volume (Icc a b) = ENNReal.ofReal (b - a) :=
  Real.volume_Icc
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

The lesson's proof that Q\Q is null — a countable union of null singletons — and Mathlib's general statement for countable sets:

volume_rat_eq_zeroLean 4Proved here from basic factsFormally verified
/-- **The rationals form a Lebesgue-null set.** `ℚ ⊂ ℝ` is the countable union of the
singletons `{q}`, each of measure `0`; by countable subadditivity the union has measure `0`.
This is the lesson's proof, using Mathlib's `measure_iUnion_null` (a countable union of null
sets is null) and `Real.volume_singleton`. -/
theorem volume_rat_eq_zero : volume (range ((↑) : ℚ → ℝ)) = 0 := by
  rw [← iUnion_singleton_eq_range]
  exact measure_iUnion_null fun q => Real.volume_singleton
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
countable_nullLean 4Applies a library theoremFormally verified
/-- More generally, every countable subset of `ℝ` is Lebesgue-null (`Set.Countable.measure_zero`;
the hypothesis Mathlib needs is that singletons are null). The converse is false: the Cantor
set is uncountable and null. -/
theorem countable_null {s : Set ℝ} (hs : s.Countable) : volume s = 0 :=
  hs.measure_zero volume
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

Mathlib writes ∫⁻ x, f x ∂μ for the integral of a function into [0,∞][0, \infty] (the "lintegral", defined as the supremum over simple functions below ff) and ∫ x, f x ∂μ for the Bochner integral of integrable functions into a Banach space. Markov's inequality, proved here by comparing ff with the simple function ε1{f≥ε}\varepsilon \mathbf 1_{\{f \ge \varepsilon\}} (the step used in the Riemann–Lebesgue comparison above):

markovLean 4Proved here from basic factsFormally verified
/-- **Markov's inequality.** For a measurable `f : α → [0, ∞]` and `ε ∈ [0, ∞]`,
`ε · μ{f ≥ ε} ≤ ∫ f dμ`. Proof: the simple function `ε · 1_{f ≥ ε}` lies below `f`, and its
integral is `ε · μ{f ≥ ε}`; integrals are monotone. (Mathlib: `mul_meas_ge_le_lintegral`.) -/
theorem markov {α : Type*} [MeasurableSpace α] (μ : Measure α) {f : α → ℝ≥0∞}
    (hf : Measurable f) (ε : ℝ≥0∞) : ε * μ {x | ε ≤ f x} ≤ ∫⁻ x, f x ∂μ := by
  have hs : MeasurableSet {x | ε ≤ f x} := measurableSet_le measurable_const hf
  calc ε * μ {x | ε ≤ f x} = ∫⁻ x, {x | ε ≤ f x}.indicator (fun _ => ε) x ∂μ :=
        (lintegral_indicator_const hs ε).symm
    _ ≤ ∫⁻ x, f x ∂μ := by
        apply lintegral_mono
        intro x
        by_cases hx : ε ≤ f x
        · simpa [indicator_of_mem (show x ∈ {x | ε ≤ f x} from hx)] using hx
        · simp [indicator_of_notMem (show x ∉ {x | ε ≤ f x} from hx)]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

The convergence theorems are library theorems. Note the different hypotheses: monotone convergence needs no integrability, dominated convergence needs one integrable bound for all nn.

monotone_convergenceLean 4Applies a library theoremFormally verified
/-- **Monotone convergence theorem** (Beppo Levi). If `0 ≤ f₀ ≤ f₁ ≤ ⋯` are measurable, then
`∫ sup fₙ = sup ∫ fₙ`. No integrability hypothesis is needed for non-negative functions. This is
Mathlib's `lintegral_iSup`. -/
theorem monotone_convergence {α : Type*} [MeasurableSpace α] (μ : Measure α)
    {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, Measurable (f n)) (hmono : Monotone f) :
    ∫⁻ x, ⨆ n, f n x ∂μ = ⨆ n, ∫⁻ x, f n x ∂μ :=
  lintegral_iSup hf hmono
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
dominated_convergenceLean 4Applies a library theoremFormally verified
/-- **Dominated convergence theorem** (Lebesgue). If `Fₙ → f` almost everywhere and
`‖Fₙ‖ ≤ g` almost everywhere for one integrable `g`, then `∫ Fₙ → ∫ f`. This is Mathlib's
`tendsto_integral_of_dominated_convergence`. -/
theorem dominated_convergence {α : Type*} [MeasurableSpace α] (μ : Measure α)
    {F : ℕ → α → ℝ} {f g : α → ℝ} (hF : ∀ n, AEStronglyMeasurable (F n) μ)
    (hg : Integrable g μ) (hbound : ∀ n, ∀ᵐ x ∂μ, ‖F n x‖ ≤ g x)
    (hlim : ∀ᵐ x ∂μ, Tendsto (fun n => F n x) atTop (𝓝 (f x))) :
    Tendsto (fun n => ∫ x, F n x ∂μ) atTop (𝓝 (∫ x, f x ∂μ)) :=
  tendsto_integral_of_dominated_convergence g hF hg hbound hlim
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

The escaping-mass sequence fn=n1(0,1/n)f_n = n \mathbf 1_{(0, 1/n)}, formalised and analysed from scratch: every integral is 11, every pointwise limit is 00. Together these two theorems show formally that the hypotheses of the convergence theorems cannot simply be dropped.

escapingMassLean 4Formally verified
/-- The "escaping mass" sequence `fₙ = n · 1_(0, 1/n)`: a tower of height `n` over an interval
of length `1/n`. -/
noncomputable def escapingMass (n : ℕ) : ℝ → ℝ≥0∞ :=
  (Ioo (0 : ℝ) (1 / n)).indicator fun _ => (n : ℝ≥0∞)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
escapingMass_lintegralLean 4Proved here from basic factsFormally verified
/-- Every `fₙ` (with `n ≥ 1`) has integral exactly `1`: the integral of `c · 1_A` is
`c · λ(A)`, and here `n · (1/n) = 1`. -/
theorem escapingMass_lintegral {n : ℕ} (hn : 1 ≤ n) : ∫⁻ x, escapingMass n x = 1 := by
  have hn' : (n : ℝ) ≠ 0 := by positivity
  rw [escapingMass, lintegral_indicator_const measurableSet_Ioo, Real.volume_Ioo, sub_zero,
    ← ENNReal.ofReal_natCast, ← ENNReal.ofReal_mul (Nat.cast_nonneg n), mul_one_div_cancel hn',
    ENNReal.ofReal_one]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
escapingMass_tendsto_zeroLean 4Proved here from basic factsFormally verified
/-- …yet `fₙ(x) → 0` for **every** `x ∈ ℝ`: if `x ≤ 0` every term is `0`; if `x > 0`, then as
soon as `n > 1/x` we have `x ∉ (0, 1/n)`, so `fₙ(x) = 0`. Hence `∫ lim fₙ = 0 ≠ 1 = lim ∫ fₙ`:
there is no integrable dominating function and the sequence is not monotone. -/
theorem escapingMass_tendsto_zero (x : ℝ) :
    Tendsto (fun n => escapingMass n x) atTop (𝓝 0) := by
  -- It suffices that `fₙ(x) = 0` for all large `n`.
  apply tendsto_const_nhds.congr'
  rcases le_or_gt x 0 with hx | hx
  · -- `x ≤ 0`: `x` is never in `(0, 1/n)`.
    refine Eventually.of_forall fun n => ?_
    have hmem : x ∉ Ioo (0 : ℝ) (1 / n) := fun h => (not_lt.2 hx) h.1
    show (0 : ℝ≥0∞) = escapingMass n x
    rw [escapingMass, indicator_of_notMem hmem]
  · -- `x > 0`: choose `N > 1/x`; for `n ≥ N` we have `1/n ≤ x`.
    obtain ⟨N, hN⟩ := exists_nat_gt (1 / x)
    filter_upwards [eventually_ge_atTop N] with n hn
    have hNpos : (0 : ℝ) < N := lt_trans (by positivity) hN
    have hnpos : (0 : ℝ) < n := lt_of_lt_of_le hNpos (by exact_mod_cast hn)
    have hle : 1 / (n : ℝ) ≤ x := by
      rw [div_le_iff₀ hnpos]
      have h1 : 1 < N * x := by rwa [div_lt_iff₀ hx] at hN
      nlinarith [show (N : ℝ) ≤ n by exact_mod_cast hn]
    have hmem : x ∉ Ioo (0 : ℝ) (1 / n) := fun h => (not_lt.2 hle) h.2
    show (0 : ℝ≥0∞) = escapingMass n x
    rw [escapingMass, indicator_of_notMem hmem]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

Tonelli's theorem (Mathlib states it for s-finite measures, a class containing the σ-finite ones), the Riesz–Fischer theorem as a CompleteSpace instance on Mathlib's Lp (a type of a.e.-equivalence classes), and the first Borel–Cantelli lemma:

tonelliLean 4Applies a library theoremFormally verified
/-- **Tonelli's theorem.** For a measurable `f : α × β → [0, ∞]` and σ-finite (in Mathlib:
s-finite) measures, the integral over the product equals either iterated integral. This is
Mathlib's `lintegral_prod`. -/
theorem tonelli {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] (μ : Measure α)
    (ν : Measure β) [SFinite ν] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
    ∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
  lintegral_prod f hf
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
lp_completeLean 4Applies a library theoremFormally verified
/-- **Riesz–Fischer.** For `1 ≤ p ≤ ∞`, the space `Lᵖ(μ)` (functions modulo equality almost
everywhere) is complete, hence a Banach space. Mathlib provides the instance
`MeasureTheory.Lp.instCompleteSpace`. -/
theorem lp_complete {α : Type*} [MeasurableSpace α] (μ : Measure α) (p : ℝ≥0∞)
    [Fact (1 ≤ p)] : CompleteSpace (Lp ℝ p μ) :=
  inferInstance
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor
borel_cantelliLean 4Applies a library theoremFormally verified
/-- **First Borel–Cantelli lemma.** If `∑ μ(Aₙ) < ∞`, then almost every point lies in only
finitely many `Aₙ`: `μ(limsup Aₙ) = 0`. This is Mathlib's `measure_limsup_atTop_eq_zero`. -/
theorem borel_cantelli {α : Type*} [MeasurableSpace α] (μ : Measure α) {A : ℕ → Set α}
    (hA : ∑' n, μ (A n) ≠ ∞) : μ (limsup A atTop) = 0 :=
  measure_limsup_atTop_eq_zero hA
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/MeasureTheory.leanTry it in the Lean web editor

Not formalised here: the Carathéodory construction and the Heine–Borel argument for λ∗([a,b])\lambda^*([a, b]) (Mathlib has both, as MeasureTheory.OuterMeasure.caratheodory and StieltjesFunction.outer_Ioc), the proofs of the convergence theorems and of Riesz–Fischer (we cite Mathlib's), and the comparison with the Riemann integral (Mathlib relates intervalIntegral to antiderivatives through the fundamental theorem of calculus rather than through Riemann sums).

ComputationC

Computing with null sets and escaping mass

The first experiment builds the stages of the Cantor set with exact fractions. It confirms the lengths (2/3)n(2/3)^n, checks that 1/4=0.02‾31/4 = 0.\overline{02}_3 survives every stage computed without ever being an endpoint (so the Cantor set is more than its endpoints), and exhibits the injection from 0/10/1-strings that drives the uncountability proof.

The Cantor set: uncountable but of measure zeroPythonExact computationExhaustive finite checkComputationally tested
"""The Cantor set: uncountably many points, total length zero.

Builds the stages C_n of the middle-thirds Cantor set with exact rational
arithmetic: C_n is a union of 2^n closed intervals of total length (2/3)^n.
It then checks that 1/4 survives every stage computed although it is never an
endpoint, and shows the injection from 0/1-sequences into the Cantor set
(binary digit b -> ternary digit 2b) that makes it uncountable. Exact
arithmetic for finitely many stages; the limits are the lesson's proofs.
"""

from fractions import Fraction

def cantor_stage(n):
    """The 2^n closed intervals (a, b) of the n-th stage C_n, as Fractions."""
    if n < 0:
        raise ValueError("n must be non-negative")
    intervals = [(Fraction(0), Fraction(1))]
    for _ in range(n):
        new = []
        for a, b in intervals:
            third = (b - a) / 3
            new.append((a, a + third))
            new.append((b - third, b))
        intervals = new
    return intervals

def total_length(intervals):
    """Sum of the lengths of disjoint intervals."""
    return sum((b - a for a, b in intervals), Fraction(0))

def in_stage(x, n):
    """True if the rational x lies in C_n (checked by the ternary rule)."""
    x = Fraction(x)
    if not 0 <= x <= 1:
        return False
    for _ in range(n):
        if Fraction(1, 3) < x < Fraction(2, 3):
            return False
        x = 3 * x if x <= Fraction(1, 3) else 3 * x - 2
    return True

def ternary_digits(x, k):
    """The first k ternary digits of a rational x in [0, 1)."""
    x = Fraction(x)
    digits = []
    for _ in range(k):
        x *= 3
        d = int(x)
        digits.append(d)
        x -= d
    return digits

def endpoints(n):
    """All endpoints of the intervals of C_n."""
    return {e for interval in cantor_stage(n) for e in interval}

def bits_to_cantor_point(bits):
    """The point sum 2*b_i / 3^i of the Cantor set coded by the bits b_i."""
    return sum((Fraction(2 * b, 3 ** (i + 1)) for i, b in enumerate(bits)),
               Fraction(0))

def first_stage_below(threshold):
    """Least n with (2/3)^n < threshold."""
    n, length = 0, Fraction(1)
    while length >= threshold:
        n, length = n + 1, length * Fraction(2, 3)
    return n

def main():
    print("Stages of the Cantor set (exact arithmetic)")
    print(f"{'n':>3} {'intervals':>10} {'total length':>20} {'decimal':>10}")
    for n in [0, 1, 2, 3, 5, 10, 20]:
        stage = cantor_stage(n) if n <= 12 else None
        length = total_length(stage) if stage else Fraction(2, 3) ** n
        count = len(stage) if stage else 2 ** n
        print(f"{n:>3} {count:>10} {str(length):>20} {float(length):>10.6f}")
    print(f"Length below 1/1000 from stage n = {first_stage_below(Fraction(1, 1000))}.")
    print()
    quarter = Fraction(1, 4)
    print("Is 1/4 in the Cantor set?")
    print("  ternary digits of 1/4:", "".join(map(str, ternary_digits(quarter, 12))),
          "...")
    print(f"  in every stage C_n for n <= 40: {all(in_stage(quarter, n) for n in range(41))}")
    print(f"  an endpoint of some C_n, n <= 12: {quarter in endpoints(12)}")
    print("  (endpoints have denominators 3^n, and 4 is not a power of 3)")
    print()
    strings = [[(m >> i) & 1 for i in range(10)] for m in range(2 ** 10)]
    points = {bits_to_cantor_point(s) for s in strings}
    print("0/1 strings -> Cantor points by b -> ternary digit 2b:")
    print(f"  {len(strings)} strings of length 10 give {len(points)} distinct points,")
    print(f"  all in C_10: {all(in_stage(p, 10) for p in points)}")
    print()
    print("Epistemic status: exact rational arithmetic for finitely many stages")
    print("and strings. It shows that C is covered by intervals of total length")
    print("(2/3)^n for the n computed. That C is null (it lies in every C_n) and")
    print("that the injection on infinite sequences makes it uncountable are the")
    print("lesson's proofs, not consequences of this finite check.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The second computes, exactly, the integrals and point values of four sequences: escaping mass, a travelling bump, the dominated sequence xnx^n on [0,1][0, 1], and the typewriter sequence. Watch the value at x=1/3x = 1/3 return to 11 once in every dyadic block, although the integrals shrink to 00; along the subsequence k=2mk = 2^m it converges, as Riesz–Fischer predicts.

Limits and integrals: four sequences of functionsPythonExact computationCounterexampleComputationally tested
"""When may a limit pass through an integral? Four sequences, exactly.

For four classic sequences of functions we compute the integrals exactly
(fractions) and follow the values at a fixed point: escaping mass
n * 1_(0, 1/n), a travelling bump 1_[n, n+1], the dominated sequence x^n on
[0, 1], and the "typewriter" sequence of shrinking dyadic intervals. The first
two converge pointwise to 0 while their integrals stay 1; the third obeys the
dominated convergence theorem; the fourth converges in L^1 but at no point.
"""

from fractions import Fraction

def escaping(n, x):
    """f_n(x) = n on the open interval (0, 1/n), else 0."""
    x = Fraction(x)
    return n if 0 < x < Fraction(1, n) else 0

def escaping_integral(n):
    """The integral of f_n: height n times length 1/n."""
    return n * Fraction(1, n)

def bump(n, x):
    """g_n(x) = 1 on [n, n + 1], else 0."""
    return 1 if n <= Fraction(x) <= n + 1 else 0

def power_integral(n):
    """The integral of x^n over [0, 1]."""
    return Fraction(1, n + 1)

def typewriter_interval(k):
    """For k >= 1 write k = 2^m + j with 0 <= j < 2^m: the interval
    [j / 2^m, (j + 1) / 2^m]."""
    if k < 1:
        raise ValueError("k must be at least 1")
    m = k.bit_length() - 1
    j = k - 2 ** m
    return Fraction(j, 2 ** m), Fraction(j + 1, 2 ** m)

def typewriter(k, x):
    """T_k(x) = indicator of the k-th typewriter interval."""
    a, b = typewriter_interval(k)
    return 1 if a <= Fraction(x) <= b else 0

def typewriter_integral(k):
    """The integral of T_k is the length of its interval."""
    a, b = typewriter_interval(k)
    return b - a

def hits(k_max, x):
    """The k <= k_max with T_k(x) = 1."""
    return [k for k in range(1, k_max + 1) if typewriter(k, x) == 1]

def main():
    ns = [1, 2, 10, 100, 1000]
    print("integrals for n =", ns)
    print("  escaping mass n*1_(0,1/n):",
          [str(escaping_integral(n)) for n in ns])
    print("  x^n on [0, 1]            :", [str(power_integral(n)) for n in ns])
    print("values at x = 1/10 for n = 1..12 (escaping mass):")
    print("  ", [escaping(n, Fraction(1, 10)) for n in range(1, 13)])
    print("values at x = 5/2 for n = 0..6 (travelling bump, integral 1):")
    print("  ", [bump(n, Fraction(5, 2)) for n in range(7)])
    print()
    print("Typewriter T_k, k = 2^m + j: the indicator of [j/2^m, (j+1)/2^m]")
    for k in [1, 2, 3, 4, 7, 8, 100, 1000]:
        a, b = typewriter_interval(k)
        print(f"  k = {k:>4}: [{a}, {b}], integral {typewriter_integral(k)}")
    third = Fraction(1, 3)
    h = hits(1023, third)
    print(f"  T_k(1/3) = 1 for {len(h)} values of k <= 1023, one per block:")
    print("  ", h)
    print("  so T_k(1/3) is 1 infinitely often and 0 infinitely often,")
    print("  but along k = 2^m:", [typewriter(2 ** m, third) for m in range(8)])
    print()
    print("Epistemic status: exact arithmetic on finitely many terms. The")
    print("escaping mass and travelling bump are genuine counterexamples (each")
    print("integral is exactly 1, and each point value is eventually 0, as the")
    print("lesson proves). The typewriter output illustrates, but does not prove,")
    print("that L^1 convergence implies only a.e. convergence of a subsequence.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Both are finite computations: they display the phenomena and supply counterexamples, but the limiting statements are the theorems above.

Explore

Watch the mass escape

The shaded area is ∫fn=1\int f_n = 1 for every nn. Move the slider: the tower grows taller and thinner, and any fixed x>0x > 0 is eventually outside it. Where does the mass go, and why does no single integrable function lie above every tower?

Escaping mass: integral 1, pointwise limit 0

Move the sliders and trace along the curves to read off values.

  • f_n = n · 1_(0, 1/n)
  • Signed area: above the axis counts as positive, below (hatched) as negative
  • f_n = n · 1_(0, 1/n): y = 0
  • Signed area from −0.25 to 1.25 ≈ 1 (numerical integration)
Exercises

Exercises

1. Measure theory and integration

Warm-upHuman

Let A\mathcal A be the collection of subsets E⊆NE \subseteq \N such that EE is finite or N∖E\N \setminus E is finite. Which statement is true?

Choose one

2. Measure theory and integration

Warm-upHuman

Let f=5⋅1Q∩[0,1]+3⋅1[0,2]f = 5 \cdot \mathbf 1_{\Q \cap [0, 1]} + 3 \cdot \mathbf 1_{[0, 2]} on R\R. Compute the Lebesgue integral ∫f dλ\int f \, d\lambda.

3. Measure theory and integration

CoreHuman

Let gn=1[n,n+1]g_n = \mathbf 1_{[n, n+1]} on R\R with Lebesgue measure. Then gn→0g_n \to 0 pointwise, but ∫gn=1\int g_n = 1 for all nn. Which hypothesis of the dominated convergence theorem fails?

Choose one

4. Measure theory and integration

CoreHuman

The proof of Fatou's lemma sets gk=inf⁡n≥kfng_k = \inf_{n \ge k} f_n and concludes ∫lim inf⁡fn=lim⁡k∫gk\int \liminf f_n = \lim_k \int g_k. Which result justifies this equality?

Choose one

5. Measure theory and integration

CoreHuman

For m,n≥0m, n \ge 0 let am,n=1a_{m,n} = 1 if m=nm = n, am,n=−1a_{m,n} = -1 if m=n+1m = n + 1, and am,n=0a_{m,n} = 0 otherwise. Compute ∑m=0∞(∑n=0∞am,n)\displaystyle \sum_{m=0}^\infty \Big( \sum_{n=0}^\infty a_{m,n} \Big).

6. Measure theory and integration

CoreFormal

Which Lean statement correctly formalises Markov's inequality ε μ({f≥ε})≤∫f dμ\varepsilon\,\mu(\{f \ge \varepsilon\}) \le \int f \, d\mu for measurable f:α→[0,∞]f : \alpha \to [0, \infty]? (Here ℝ≥0∞ is [0,∞][0, \infty] and ∫⁻ is the integral of such functions.)

Choose one

7. Measure theory and integration

CoreHuman

Select all true statements.

Choose all that apply

8. Measure theory and integration

StretchHuman

In the proof that LpL^p is complete, given a Cauchy sequence (fn)(f_n) we choose n1<n2<⋯n_1 < n_2 < \cdots with ∥fnj+1−fnj∥p<2−j\|f_{n_{j+1}} - f_{n_j}\|_p < 2^{-j}. Why is this subsequence needed?

Choose one

9. Measure theory and integration

CoreComputational

Write union_length(intervals) that returns the Lebesgue measure of a finite union of closed intervals, given as a list of pairs (a, b) with a <= b. The intervals may overlap. (Countable subadditivity says the answer is at most the sum of the lengths; overlaps make it smaller.)

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"A set of measure zero must be countable." Countable sets are null, but the Cantor set is uncountable — it has the cardinality of R\R — and null. Null sets can be topologically large too: there are dense GδG_\delta null sets.

Misconception

"If fn→ff_n \to f pointwise, then ∫fn→∫f\int f_n \to \int f." Not without a hypothesis. Mass can escape upwards (n1(0,1/n)n \mathbf 1_{(0, 1/n)}), to infinity (1[n,n+1]\mathbf 1_{[n, n+1]}) or by spreading (1n1[0,n]\frac1n \mathbf 1_{[0, n]}, even with uniform convergence on an infinite measure space). Check monotonicity (MCT) or find one integrable dominating function (DCT); otherwise only Fatou's inequality survives.

Misconception

"Every subset of R\R is Lebesgue measurable." Vitali's set is not. Its construction uses the axiom of choice, and Solovay (1970) showed that some choice is necessary: in ZF with dependent choice it is consistent (relative to an inaccessible cardinal) that every set of reals is measurable. No explicitly definable Borel or even analytic set is non-measurable.

Misconception

"Lebesgue integrable is the same as improperly Riemann integrable." The Lebesgue integral is absolute: ff is integrable only if ∣f∣|f| is. So sin⁡xx\frac{\sin x}{x} has an improper Riemann integral on (0,∞)(0, \infty) but is not Lebesgue integrable there; conversely 1Q\mathbf 1_\Q is Lebesgue but not Riemann integrable on [0,1][0, 1].

Misconception

"Convergence in L1L^1 means convergence almost everywhere" (or the reverse). The typewriter sequence converges to 00 in L1L^1 and at no point; n1(0,1/n)n \mathbf 1_{(0, 1/n)} converges everywhere and not in L1L^1. What is true: LpL^p convergence gives an a.e.-convergent subsequence, and a.e. convergence plus domination gives L1L^1 convergence.

ViewpointsH

Many ways of seeing

Topology— Measures as functionals, and measure versus category

On a locally compact Hausdorff space XX, the Riesz–Markov–Kakutani theorem identifies the positive linear functionals II on Cc(X)C_c(X) with the Radon measures: I(f)=∫f dμI(f) = \int f \, d\mu for a unique regular Borel measure μ\mu. So a measure is determined by how it integrates continuous functions — a topological object. Regularity ties the two worlds together: for Lebesgue measure, λ(E)=inf⁡{λ(U):U⊇E open}=sup⁡{λ(K):K⊆E compact}\lambda(E) = \inf\{\lambda(U) : U \supseteq E \text{ open}\} = \sup\{\lambda(K) : K \subseteq E \text{ compact}\}, and Lusin's theorem says a measurable function is continuous once a set of arbitrarily small measure is removed.

Yet "small" means different things to the topologist and the measure theorist. The example of small open dense sets shows R=M∪N\R = M \cup N with MM meagre and NN null: the σ-ideals of meagre sets and of null sets are "orthogonal". Oxtoby's Measure and Category (1971) develops this duality, where many theorems have a twin with "null" replaced by "meagre" and the proofs differ.

Geometry— Invariance, Haar measure and Hausdorff dimension

Lebesgue measure on Rn\R^n is characterised geometrically: it is the unique translation-invariant Borel measure giving the unit cube measure 11, and it transforms under a linear map AA by λ(AE)=∣det⁡A∣ λ(E)\lambda(A E) = |\det A| \, \lambda(E) — the determinant is the volume scaling factor, and rotations preserve volume. Haar (1933) generalised this: every locally compact group carries a left-invariant Radon measure, unique up to scaling — the starting point of harmonic analysis on groups. In R3\R^3 the Banach–Tarski paradox (1924) decomposes a ball into finitely many pieces that can be rigidly reassembled into two balls; the pieces are non-measurable, which is why volume cannot be defined for all sets even with only finite additivity in dimension 33.

Hausdorff (1918) built measures Hs\mathcal H^s for every real s≥0s \ge 0 from covers by small sets of diameter ≤δ\le \delta, weighting each by diam⁡s\operatorname{diam}^s. Each set has a critical exponent, its Hausdorff dimension, where Hs\mathcal H^s jumps from ∞\infty to 00. The Cantor set has dimension log⁡2/log⁡3≈0.631\log 2 / \log 3 \approx 0.631: it is null for length but has positive finite Hlog⁡2/log⁡3\mathcal H^{\log 2/\log 3}-measure. Geometric measure theory measures curves, surfaces and fractals this way.

Probability— Kolmogorov's axioms

In 1933 Kolmogorov founded probability on measure theory: a probability space is a measure space of total mass 11, an event is a measurable set, a random variable is a measurable function, and expectation is the integral, E[X]=∫X dP\mathbb E[X] = \int X \, dP. The dictionary turns theorems into theorems: Markov's inequality is P(X≥ε)≤E[X]/εP(X \ge \varepsilon) \le \mathbb E[X]/\varepsilon; dominated convergence justifies exchanging limits and expectations; Fubini says E[XY]=E[X]E[Y]\mathbb E[XY] = \mathbb E[X] \mathbb E[Y] for independent integrable variables, because independence means the joint law is a product measure; the first Borel–Cantelli lemma (formalised above) says that if ∑P(An)<∞\sum P(A_n) < \infty, almost surely only finitely many AnA_n occur.

Infinite products of probability spaces — infinitely many coin tosses — exist by the Kolmogorov extension theorem, itself a Carathéodory argument. The flip of a fair coin infinitely often, read as binary digits, is Lebesgue measure on [0,1][0, 1]; the strong law of large numbers then becomes Borel's theorem (1909) that almost every real number is normal in base 22. See measure-theoretic probability.

Logic— How much choice does measure need?

Vitali's set uses the axiom of choice, and this is unavoidable. Solovay (1970) constructed, from a model of ZFC with an inaccessible cardinal, a model of ZF plus dependent choice (enough for all of classical analysis, including the convergence theorems) in which every subset of R\R is Lebesgue measurable; Shelah (1984) showed the inaccessible cannot be removed from that statement. Positively, sets that can be defined simply are measurable: analytic sets (projections of Borel sets) are universally measurable, a theorem of Lusin. So the non-measurable sets of analysis are those produced by choice, never those written down by a formula of low complexity — a theme of descriptive set theory.

History & global context

History and context

  • Bernhard Riemann defined his integral in his 1854 Habilitation (published 1868); Giuseppe Peano (1887) and Camille Jordan (1892) defined content using finite covers, which cannot measure Q∩[0,1]\Q \cap [0, 1].
  • Émile Borel (1898) introduced countably additive measure on the sets now called Borel sets. Henri Lebesgue's thesis Intégrale, longueur, aire (1902) defined the measure and the integral and proved the dominated convergence theorem for bounded functions; Giuseppe Vitali (1905) constructed a non-measurable set.
  • In 1906–1907 came Beppo Levi (monotone convergence), Pierre Fatou (his lemma, in a thesis on Fourier series and analytic functions), Frigyes Riesz and Ernst Fischer (completeness of L2L^2, in connection with Fourier series), and Guido Fubini (iterated integrals); Leonida Tonelli (1909) treated non-negative functions.
  • Johann Radon (1913) integrated with respect to general measures on Rn\R^n; Constantin Carathéodory (1914) introduced outer measure and his criterion; Maurice Fréchet (1915) defined integrals on abstract sets; Felix Hausdorff (1918) defined the measures and dimension named after him.
  • Andrey Kolmogorov's Grundbegriffe der Wahrscheinlichkeitsrechnung (1933) made measure theory the foundation of probability; Alfréd Haar (1933) proved the existence of invariant measures on separable locally compact groups, with John von Neumann (uniqueness) and André Weil (all locally compact groups) completing the theory. Frigyes Riesz (1909, for C[0,1]C[0, 1]), Andrey Markov Jr. (1938) and Shizuo Kakutani (1941) proved the representation theorem for functionals.
Further reading

Further reading

  • Gerald B. Folland, Real Analysis: Modern Techniques and Their Applications (2nd ed., 1999), Chapters 1–3 and 6 — the proofs above follow its route.
  • Elias M. Stein and Rami Shakarchi, Real Analysis: Measure Theory, Integration, and Hilbert Spaces (2005) — Lebesgue measure on Rn\R^n first, with many applications.
  • Terence Tao, An Introduction to Measure Theory (2011) — a careful, example-rich development, with the "escape of mass" taxonomy.
  • Walter Rudin, Real and Complex Analysis (3rd ed., 1987) — the Riesz representation theorem and LpL^p spaces, concisely.
  • John C. Oxtoby, Measure and Category (2nd ed., 1980) — the parallel between null and meagre sets.
  • Vladimir I. Bogachev, Measure Theory (2007), 2 volumes — comprehensive reference with extensive historical notes.