# Lebesgue Measure and Null Sets: Covering Lab

Measure length by covering: the rationals are dense yet fit in intervals of tiny total length, and the Cantor set is uncountable and null. Interactive lab.

## About this tool

Lebesgue measure gives a subset of the interval from 0 to 1 a length, even when the set is far from an interval. The idea is to cover the set with countably many intervals and take the smallest total length you can reach. Sets that can be hidden inside intervals of arbitrarily small total length are null sets. Here you can cover the rationals, the Cantor set and a fat Cantor set, and see how much length each one really needs. A uniform random point misses a null set almost surely.

## Frequently asked questions

### What is the Lebesgue measure of a set?

It is the smallest total length of countably many intervals that together cover the set. For an interval it is the usual length, and for a countable union of disjoint intervals it is the sum of the lengths. The definition also works for sets with no intervals at all, which is why it can serve as the probability P of a uniformly drawn number. A set whose cover can be made as short as you like has measure zero.

### How can the rationals be dense yet have length zero?

Dense means every interval contains a rational, so the rationals cannot hide in a few small intervals one by one. But they are countable: list them as q₁, q₂, q₃ and so on, and cover qₙ by an interval of length ε/2ⁿ. The total length is at most ε, and ε was arbitrary. So the rationals have length 0 even though they are everywhere. A uniform random number is irrational almost surely.

### What should I try on the page?

Give yourself a length budget ε and try to cover each set. The rationals fit under any budget. The Cantor set is uncountable and still fits, because only (2/3)ⁿ of the interval is left after n steps. A fat Cantor set removes less each time, contains no interval and still has length 1/2, so no budget below 1/2 works. Compare the three to see that size, density and length are different ideas.

### Does measure zero mean the set is small or empty?

No. Null sets can be dense, like the rationals, or uncountable, like the Cantor set. Zero measure only says that a uniform draw lands in the set with probability 0. Events of probability 0 can still happen in an uncountable space, since something must be drawn. That is why probability statements are made almost surely: they hold except on a null set, and a null set can be ignored for integrals and probabilities.

## Learn the theory

- [Lebesgue measure and null sets](https://quantsandbox.dev/guide/probability/lebesgue-measure-null-sets): Building length for every Borel set: countable covers and outer measure, sets of length zero, the Cantor sets, almost everywhere, and why length is unique.
- [Measuring the size of sets](https://quantsandbox.dev/guide/probability/measuring-sets): What counting, length, area and mass have in common: the rules of a measure, why additivity must be countable, and the first examples of measures.
- [Probability spaces, σ-algebras and random variables](https://quantsandbox.dev/guide/stochastic/probability-spaces): Sample space, σ-algebra, probability measure, measurable maps and the σ-algebra generated by a variable.

Open the interactive tool: https://quantsandbox.dev/lebesgue-measure
