Foundations to Frontier
Tests
A. Mathematical Foundations › A4 Probability Theory › Theory

Measure-Theoretic Probability (Intuition): σ-algebras, Measures, the Lebesgue Integral

Why probability is built on measure theory, without the pain. A σ-algebra is the list of questions you can answer; a measure assigns sizes consistently; the Lebesgue integral slices the range instead of the domain, which is exactly what an expectation is. You will meet null sets, 'almost surely', the monotone and dominated convergence theorems, densities as Radon–Nikodym derivatives, and conditional expectation as the best guess given the information a sensor provides.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Two ways to count coins

You have a pile of coins to total up. One way: pick them up in the order they lie and add each one’s value. Another: first sort them by value (all the 1s, all the 5s, all the 10s), count how many are in each pile, and add up value × count. You get the same answer, but the second way doesn’t care how messily the coins were scattered.

That second way is the Lebesgue integral. Instead of slicing the x-axis, it slices the heights: “how much of the ground is at least this high?” All it needs is a way to measure the size of a set. Probability is exactly such a measure: the size of an event is its chance.

Two ways to add up area: slice the x-axis (Riemann) or the y-axis (Lebesgue)
Riemann (n = 6): 0.3310 · Lebesgue simple function (2^3 levels): 0.2794 · exact 0.3333
Σ (1/8) × measure{f ≥ level} : 0.65 + 0.50 + 0.39 + 0.29 + 0.21 + 0.13 + 0.06 + 0.00
Riemann asks "how high is f over each piece of x?". Lebesgue asks "how much of x has f above each height?" and only needs to measure sets, so it works for wild functions and abstract spaces, and it is what an expectation over any probability space means. The Lebesgue sum is a simple function below f, so it never overshoots and only increases as k grows (monotone convergence).
Why engineers care

Every expectation in robotics and AI (an expected cost, a loss averaged over data, a filter’s prediction) is a Lebesgue integral. The measure-theory vocabulary (“almost surely”, “measurable”, “density with respect to…”) appears in every paper on reinforcement learning, filtering and generative models. This page gives you the intuition to read it.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The Lebesgue integral slices…
  2. 2. In probability, the 'size' of an event is…
  3. 3. Totalling coins by value piles gives…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The three ingredients: (Ω, 𝓕, P)

  1. Sample space Ω\Omega: every possible outcome (A4.1-1).
  2. σ-algebra F\mathcal F: the collection of events you’re allowed to ask about. It must contain Ω\Omega, and be closed under complements and countable unions. Think of it as the list of yes/no questions you can answer.
  3. Probability measure PP: assigns each event in F\mathcal F a number in [0,1][0,1], with P(Ω)=1P(\Omega) = 1 and countable additivity: P(⋃Ai)=∑P(Ai)P(\bigcup A_i) = \sum P(A_i) for disjoint AiA_i.

Why not allow every subset?

On a finite Ω\Omega you can: take F\mathcal F = all subsets. On [0,1][0,1], there is no way to assign a length to every subset that is countably additive and unchanged by shifting. Vitali (1905) built a non-measurable set. So we restrict to the Borel σ-algebra generated by intervals. Every set you will ever meet in engineering is in it.

Random variables and “almost surely”

A random variable is a measurable function X:Ω→RX:\Omega\to\mathbb R, meaning {X≤x}∈F\{X\le x\}\in\mathcal F for every xx, so its CDF makes sense. A null set has probability 0. A property holds almost surely (a.s.) if it fails only on a null set. For example, a uniform point on [0,1][0,1] is irrational almost surely, even though rational outcomes exist.

📝 Quick check (Level 1)
0/3 answered
  1. 1. A σ-algebra must be closed under complements and…
  2. 2. P(a uniform point on [0,1] is rational) =
  3. 3. 'Almost surely' means…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

The Lebesgue integral in three steps

  1. Indicators. ∫1A dP=P(A)\int\mathbf 1_A\,dP = P(A).
  2. Simple functions φ=∑ici1Ai\varphi = \sum_ic_i\mathbf 1_{A_i}: ∫φ dP=∑iciP(Ai)\int\varphi\,dP = \sum_ic_iP(A_i). This is value × size of the level set.
  3. Non-negative ff: ∫f dP=sup⁡{∫φ:0≤φ≤f simple}\int f\,dP = \sup\{\int\varphi : 0\le\varphi\le f\text{ simple}\}. Concretely, use φn=min⁡(n,⌊2nf⌋/2n)\varphi_n = \min(n, \lfloor2^nf\rfloor/2^n), which increases to ff.

General f=f+−f−f = f^+ - f^-. Then the expectation is just EX=∫ΩX dP\mathbb E X = \int_\Omega X\,dP. One definition covers discrete, continuous and mixed variables.

A convenient consequence is the layer-cake formula: for X≥0X\ge0,

EX=∫0∞P(X>t) dt\mathbb E X = \int_0^\infty P(X > t)\,dt

Why it beats Riemann

The Dirichlet function 1Q\mathbf 1_{\mathbb Q} on [0,1][0,1] has no Riemann integral: every strip contains both rationals and irrationals. Its Lebesgue integral is simply 1⋅λ(Q∩[0,1])=01\cdot\lambda(\mathbb Q\cap[0,1]) = 0. More importantly, Lebesgue integrals commute with limits under mild conditions:

  • Monotone convergence (MCT): 0≤fn↑f⇒∫fn↑∫f0\le f_n\uparrow f\Rightarrow\int f_n\uparrow\int f.
  • Dominated convergence (DCT): fn→ff_n\to f a.e. and ∣fn∣≤g\lvert f_n\rvert\le g with ∫g<∞⇒∫fn→∫f\int g<\infty\Rightarrow\int f_n\to\int f.

These are what justify swapping derivatives and expectations, ∇θE[ℓ]=E[∇θℓ]\nabla_\theta\mathbb E[\ell] = \mathbb E[\nabla_\theta\ell], in every gradient-based learning algorithm.

Densities are Radon–Nikodym derivatives

If P(A)=0P(A) = 0 whenever Q(A)=0Q(A) = 0 (written P≪QP\ll Q), there is a density dPdQ\frac{dP}{dQ} with P(A)=∫AdPdQ dQP(A) = \int_A\frac{dP}{dQ}\,dQ (Radon–Nikodym). An ordinary pdf is dP/dλdP/d\lambda with respect to length. A PMF is the density with respect to counting measure. Importance sampling reweights by dP/dQdP/dQ (Practice Code 5).

🐍 Exercise 1: Lebesgue integration by simple functions
Integrate over [0,1] by slicing the range: compute the integral of the simple function phi_n = min(n, floor(2^n f)/2^n), check that it increases to the true value, then compute the layer-cake integral of the measure of {f > t}, and the tail formula E X = ∫ P(X > t) dt from samples.
📝 Quick check (Level 2)
0/3 answered
  1. 1. For X ≥ 0, E X equals…
  2. 2. The Lebesgue integral of 1 on the rationals in [0,1] is…
  3. 3. Swapping ∇ and E is justified by…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Proving monotone convergence

Let 0≤fn↑f0\le f_n\uparrow f. Monotonicity gives ∫fn≤∫f\int f_n\le\int f, and the limit L=lim⁡∫fnL = \lim\int f_n exists.

  1. Fix a simple function. Take simple 0≤φ≤f0\le\varphi\le f and c<1c<1. Let En={fn≥cφ}E_n = \{f_n\ge c\varphi\}. These sets increase to Ω\Omega, because fn→f≥φ>cφf_n\to f\ge\varphi > c\varphi wherever φ>0\varphi > 0.
  2. Bound the integral. ∫fn≥∫Enfn≥c∫Enφ=c∑iaiP(Ai∩En)\int f_n\ge\int_{E_n}f_n\ge c\int_{E_n}\varphi = c\sum_ia_iP(A_i\cap E_n).
  3. Pass to the limit. By continuity of measure (from countable additivity), P(Ai∩En)→P(Ai)P(A_i\cap E_n)\to P(A_i), so L≥c∫φL\ge c\int\varphi.
  4. Conclude. Let c→1c\to1 and take the sup over φ\varphi: L≥∫fL\ge\int f. ∎

When limits and integrals don’t commute

Take fn=n1(0,1/n)f_n = n\mathbf 1_{(0,1/n)}. It tends to 0 at every point, yet ∫fn=1\int f_n = 1 for all nn. No integrable gg dominates all fnf_n, since sup⁡nfn≈1/x\sup_nf_n\approx1/x is not integrable. So the DCT doesn’t apply (Practice Code 4). Fatou’s lemma still gives the inequality ∫lim inf⁡fn≤lim inf⁡∫fn\int\liminf f_n\le\liminf\int f_n.

Conditional expectation is projection onto information

For a sub-σ-algebra G⊆F\mathcal G\subseteq\mathcal F (the information you have), E[X∣G]\mathbb E[X\mid\mathcal G] is the G\mathcal G-measurable random variable with E[(X−E[X∣G])1G]=0\mathbb E[(X - \mathbb E[X\mid\mathcal G])\mathbf 1_G] = 0 for all G∈GG\in\mathcal G. For square-integrable XX, this is the orthogonal projection in L2L^2 (A3.5-5) onto the G\mathcal G-measurable functions, and therefore the minimum-MSE predictor. When G\mathcal G is generated by a partition, it’s the probability-weighted average over each cell.

Exercise 3.1: Show that a finite σ-algebra has 2^k events

The atoms (the minimal non-empty events) partition Ω\Omega into kk cells. Every event is a union of atoms, and each of the 2k2^k subsets of atoms gives a different event.

📝 Quick check (Level 3)
0/3 answered
  1. 1. f_n = n·1(0, 1/n) shows that…
  2. 2. E[X | 𝒢] is the orthogonal projection onto…
  3. 3. A σ-algebra with 3 atoms has how many events?

Level 4: Expert

★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.

Information, filtrations and quantized sensors

A sensor that reports only which of 4 range bins an object is in gives you a σ-algebra with 4 atoms. A finer sensor gives a finer σ-algebra. Your best estimate is E[X∣G]\mathbb E[X\mid\mathcal G], the average over the bin, and finer information can only lower its mean-squared error. A growing sequence F1⊆F2⊆⋯\mathcal F_1\subseteq\mathcal F_2\subseteq\cdots is a filtration, the formal model of information arriving over time. It is the language of martingales, stopping times and optimal filtering (Williams, 1991). The tower property E[E[X∣F2]∣F1]=E[X∣F1]\mathbb E[\mathbb E[X\mid\mathcal F_2]\mid\mathcal F_1] = \mathbb E[X\mid\mathcal F_1] is what makes recursive filters consistent.

🐍 Exercise 2 (research): conditional expectation as projection onto sensor information
Build the sigma-algebra a partition generates and check its axioms. Compute E[X | G] for quantized-sensor partitions of a range, then verify the tower property, orthogonality of the residual, that E[X | G] beats random G-measurable predictors, and that the MSE falls as the sigma-algebra refines.

Measure theory in AI, robotics and aerospace

  • Reinforcement learning on continuous spaces needs measurable policies and transition kernels. Without them, the value function of a continuous-state MDP may not even be well-defined (Bertsekas and Shreve, 1978).
  • Normalizing flows and diffusion models are statements about how measures push forward under maps and how densities with respect to Lebesgue measure change (A4.3-2; Papamakarios et al., 2021).
  • Off-policy evaluation and importance sampling use Radon–Nikodym derivatives dπ/dμd\pi/d\mu. Estimates blow up when π\pi is not absolutely continuous with respect to the behaviour policy μ\mu, which is why coverage assumptions matter.
  • Rare-event estimation for spacecraft (collision probabilities around 1e-5 and below) relies on change of measure. Naive Monte Carlo almost never sees the event (Rubino and Tuffin, 2009).
  • Stochastic calculus for estimation and control (A4.4-5) is built on filtrations and conditional expectations.

References

  1. D. Williams (1991). Probability with Martingales. Cambridge University Press.
  2. R. Durrett (2019). Probability: Theory and Examples, 5th ed. Cambridge University Press.
  3. P. Billingsley (1995). Probability and Measure, 3rd ed. Wiley.
  4. T. Tao (2011). An Introduction to Measure Theory. AMS.
  5. H. Lebesgue (1902). “Intégrale, longueur, aire.” Annali di Matematica, 7.
  6. G. Vitali (1905). Sul problema della misura dei gruppi di punti di una retta. Bologna.
  7. D. Bertsekas, S. Shreve (1978). Stochastic Optimal Control: The Discrete-Time Case. Academic Press.
  8. G. Papamakarios et al. (2021). “Normalizing flows for probabilistic modeling and inference.” JMLR, 22(57).
  9. G. Rubino, B. Tuffin, eds. (2009). Rare Event Simulation Using Monte Carlo Methods. Wiley.
  10. A. N. Kolmogorov (1933). Grundbegriffe der Wahrscheinlichkeitsrechnung. Springer.