Start by accepting something counterintuitive: not every set can be sensibly assigned a "size." Insisting on a length for every subset forces "$1=2$"-style contradictions (the Banach–Tarski paradox). So mathematicians step back: first fence off a well-behaved collection of sets, and speak of size only for those. That fenced-off collection is a σ-algebra — a list of "events you are allowed to ask about."
It must be closed under three things: the whole space is in it; if an event $A$ is in it, then "$A$ does not happen" is too; and if countably many events are in it, so is "at least one of them happens." In plain terms: the moment you can ask "what is the probability of $A$," you can automatically ask about "not $A$" and "$A$ or $B$ or $C$…". A σ-algebra guarantees the questioning system is self-consistent — you never pose a question that has no answer.
A σ-algebra $\mathcal{F}\subseteq 2^\Omega$ over a sample space $\Omega$ satisfies:
The three clauses: the full set is measurable; closure under complement; closure under countable union (the Greek σ literally marks "countable"). The smallest σ-algebra generated by all open intervals is the Borel sets — nearly every set you could write down is a Borel set.
The depth of a σ-algebra lies not in "size" but in the fact that it encodes information. Picture a wager revealed over time: $\mathcal{F}_t$ stands for "everything you know by time $t$." The later it gets, the more questions you can answer, and the larger $\mathcal{F}_t$ grows — this increasing chain of σ-algebras is a filtration. One object, two faces: "which sets are measurable" on one side, "how much you currently know" on the other. Measure theory geometrizes knowledge.
Finance uses filtrations to model "information arriving over time," and the martingale theory of option pricing is built on them; in machine learning the conditional expectation $E[X\mid\mathcal{F}]$ — "the best guess of $X$ given this information" — is exactly a projection onto a σ-algebra, the mathematical core of Bayesian inference and of value functions in reinforcement learning.
A measure is a "size-assigning machine": feed it a set, get back a non-negative number — length, area, volume, mass, or probability. It need only obey one iron law: countable additivity — cut a set into countably many non-overlapping pieces, and the total size equals the sum of the pieces. Sounds bland; the power is startling.
The classic shock: all rational numbers in $[0,1]$ have measure $0$. The rationals are everywhere dense — so why is their "length" zero? Because they are countable, and can be covered by a sequence of intervals of arbitrarily small total length — cover the $n$-th rational with an interval of length $\varepsilon/2^n$, and the total is at most $\varepsilon$, which can be as small as you like. Being dense and occupying zero space can coexist — a conclusion the Riemann-era intuition could never deliver.
$\mu$ acts on a σ-algebra (only measurable sets), the empty set has size $0$, and additivity holds for disjoint ($\bigsqcup$) countable unions. Extending "length" this way to as many sets of $\mathbb{R}$ as possible gives the Lebesgue measure.
One axiom subsumes length, area, volume, mass distribution, and probability — from now on they are different instances of the same structure. Better still is the notion of a "null set": the Cantor set is uncountable (as many points as the whole real line) yet has measure $0$. It forces you to fully separate "how many points" from "how much room" — cardinality and measure are two independent rulers, gauging two utterly different senses of a set's "bigness."
Wherever a "distribution" must be weighed, measure appears: mass and charge distributions in physics, grayscale density in image processing. In generative AI, the distance between two probability distributions — the Wasserstein distance (optimal transport) — is essentially asking "to haul one heap of measure into another, how far must you carry it, minimally," the theoretical pillar behind Wasserstein-GAN and the training stability of diffusion models.
Lebesgue himself told a wonderful analogy. To count a scattered pile of coins, there are two ways: Riemann's way takes them by position, adding them one by one from left to right; Lebesgue's way first sorts by denomination — all the ones together, all the fifty-cents together — then sums "denomination × count in that pile."
Translated to integration: Riemann slices vertical thin strips along the x-axis (the domain); Lebesgue slices horizontally along the y-axis (the range), asking "the part of the domain where the function's value lands in $[y,y+dy]$ — how big is its measure?" For tame functions the two agree; but faced with a wild function that jumps everywhere, the horizontal Lebesgue slicing stays unbothered — it only cares "how large, in total, is the region at each height," not how fragmented that region is.
First define it for "simple functions" (step functions taking finitely many values): $\int s\,d\mu=\sum_k y_k\,\mu(\{x:s(x)=y_k\})$ — each height times the measure of the domain-chunk taking that height; then take the supremum over simple functions approaching from below:
It cures Riemann integration's two chronic ailments. First, far more functions become integrable: the Dirichlet function ($1$ on rationals, $0$ on irrationals) is utterly non-integrable for Riemann, yet Lebesgue sees at once that its integral is $0$ (the rationals have measure zero). Second, limits and integrals exchange freely — the monotone and dominated convergence theorems make "$\lim\int=\int\lim$" hold under mild conditions, a luxury Riemann cannot grant. This is precisely why the $L^p$ function spaces are complete (every Cauchy sequence converges), forming the bedrock of functional analysis and of the Hilbert spaces of quantum mechanics.
An expectation in probability is just a Lebesgue integral $E[X]=\int X\,dP$, covering both discrete sums and continuous integrals with no need for two separate formulas; Fourier analysis, signal processing, and "taking the expected loss over a data distribution" in machine learning all rest on it underneath. Empirical risk minimization in deep learning is, at bottom, approximating a Lebesgue integral by a sample average.
In 1933, Kolmogorov gave "luck" a solid foundation in a single line: probability is just a measure whose total is exactly $1$. Rolling dice, rain tomorrow, a quantum measurement — every random phenomenon is caught by the same skeleton: a probability space $(\Omega,\mathcal{F},P)$. $\Omega$ is all possible outcomes, $\mathcal{F}$ is the events you may ask about (a σ-algebra), and $P$ is a measure weighing each event, with the whole space weighing $1$.
A random variable, then, is not "a number that varies" — it is a measurable function $X:\Omega\to\mathbb{R}$, translating each underlying outcome into a value. So "the expectation of $X$" is the Lebesgue integral of $X$ against the probability measure. All the machinery of the previous three cards fuses here into one engine: randomness is fully geometrized.
Probability is all three measure axioms plus one normalization, $P(\Omega)=1$. That single difference aside, probability theory and measure theory share the same skeleton.
This language stitches together two long-divided halves: discrete probability (sums) and continuous probability (integrals) are both now "integration against $P$," with no need for two sets of theorems. More crucially, it gave, for the first time, a rigorous stage for the law of large numbers and the central limit theorem, and let martingales, Markov processes, and Brownian motion — "randomness evolving in time" — be precisely defined. What Kolmogorov did was, in essence, replace the three-centuries-tangled philosophical question "what is probability" with an axiom system anyone can verify — turning luck from metaphysics into geometry.
All of modern statistics and machine learning is built on it: Bayesian inference updates between probability measures; reinforcement learning's Markov decision processes need measure theory to define policies and returns rigorously; martingale pricing in finance and the forward/reverse stochastic differential equations of diffusion generative models all run on the $(\Omega,\mathcal{F},P)$ skeleton. Every time you write $E[\text{loss}]$, you are invoking Kolmogorov's foundation.