# Lebesgue Measure, Borel Sets and Null Sets Explained

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.

The lesson "Measuring the size of sets" listed the rules that any sensible notion of size obeys, with length on $[0, 1]$ as one of its main examples, and simply assumed that length exists. "σ-algebras and Borel sets" then showed that this assumption needs care: Vitali's set cannot be given a length at all, so length can only live on a chosen σ-algebra, and the natural choice is the Borel sets. Two questions are left open. Is there really a countably additive length on every Borel set, including sets far stranger than intervals? And what do such sets look like when their length is zero? This lesson answers both. It builds **Lebesgue measure** by covering sets with intervals, explains why the covers have to be countable, and then studies the sets it calls small: countable sets, the Cantor set, and properties that hold almost everywhere.

## Length of intervals

Everything starts from the length of an interval. For $a \le b$,

$$
\lambda([a, b]) = b - a.
$$

The same number is used for $(a, b)$, $[a, b)$ and $(a, b]$. This is forced by the rules of a measure, not chosen as a convention: a single point $\{a\}$ lies inside $[a, a + \varepsilon]$ for every $\varepsilon > 0$, so by monotonicity its length is at most $\varepsilon$, hence zero, and adding or removing an endpoint changes nothing.

Lengths of disjoint intervals add. A finite union of intervals, an **elementary set**, has as its length the total length of the disjoint pieces it can be cut into. The set $[0, 0.2] \cup [0.5, 0.6]$ has length $0.2 + 0.1 = 0.3$. The set $[0, 0.5] \cup [0.3, 0.8]$ is the single interval $[0, 0.8]$ and has length $0.8$, not $0.5 + 0.5$, because the overlap $[0.3, 0.5]$ may only be counted once; inclusion–exclusion from "Measuring the size of sets" gives the same answer, $0.5 + 0.5 - 0.2 = 0.8$.

Elementary sets are far too few. The Borel sets of "σ-algebras and Borel sets" include the rational numbers, the irrational numbers, and sets built by removing infinitely many intervals, and none of these is a finite union of intervals. What is needed is a way to give a set a length without first writing it as a list of intervals.

## Covering a set by intervals

The idea is the one used to estimate the area of an irregular region with square tiles: cover the region, add up the sizes of the tiles, and look for the cheapest covering. Tiles may overlap and may stick out of the region. That only makes the total larger, never smaller, so the cheapest covering is an honest estimate from outside.

Formally, a **countable cover** of a set $A \subseteq \mathbb{R}$ is a sequence of intervals $I_1, I_2, \ldots$ whose union contains $A$. The **outer measure** of $A$ is the smallest total length that a countable cover can achieve:

$$
\lambda^*(A) = \inf\Big\{ \sum_{k=1}^{\infty} \lambda(I_k) \;:\; A \subseteq \bigcup_{k=1}^{\infty} I_k \Big\}.
$$

In words, $\lambda^*(A)$ is the least amount of interval length it takes to hide $A$. The infimum is needed because the cheapest cover is often approached but not reached: a single point is hidden by an interval of length $\varepsilon$ for every $\varepsilon > 0$, so its outer measure is 0, although every honest interval around it has positive length.

Three properties follow from the definition. Outer measure is **monotone**: if $A \subseteq B$, every cover of $B$ also covers $A$, so $\lambda^*(A) \le \lambda^*(B)$. It is **countably subadditive**: $\lambda^*\big(\bigcup_k A_k\big) \le \sum_k \lambda^*(A_k)$. To see this, cover each $A_k$ by intervals of total length at most $\lambda^*(A_k) + \varepsilon/2^k$. All these intervals together still form one countable list, they cover the union, and their total length is at most $\sum_k \lambda^*(A_k) + \varepsilon$; then let $\varepsilon$ shrink to 0. Finally, outer measure gives intervals their length: $\lambda^*([a, b]) = b - a$.

The last property sounds obvious, but it is where the real work hides. The upper bound is free, since $[a, b]$ covers itself. The lower bound says that no clever countable cover of $[0, 1]$ has total length below 1. The proof idea: enlarge each interval of the cover slightly into an open interval; use the compactness of $[0, 1]$, which says that any cover by open intervals contains a finite cover, to keep only finitely many; then walk from 0 to 1 through these overlapping intervals, which shows that their lengths add up to more than 1. This is an outline rather than a full proof, but it shows where the completeness of the real line enters.

## Why the covers must be countable

Allowing only finite covers would look more natural, and it was the older approach, called Jordan content. It fails exactly on the sets this lesson cares about. Take the rationals in $[0, 1]$ and try to cover them by finitely many closed intervals. Every point of $[0, 1]$ is a limit of rationals, and a finite union of closed intervals is a closed set, so it contains all these limits: any finite cover of the rationals covers the whole of $[0, 1]$, and its total length is at least 1. The irrationals of $[0, 1]$ are just as densely spread, so by the same argument every finite cover of them also costs at least 1.

With finite covers, then, the rationals and the irrationals would both have size 1, although together they make up $[0, 1]$, which also has size 1. Additivity would claim $1 + 1 = 1$. Countable covers repair this, because a countable list of intervals can visit each rational separately with an interval as short as you like, as the next section shows. This is why measure theory insists on countable covers and countable additivity: they let a notion of size see individual points.

## Countable sets have length zero

A single point $x$ is covered by $[x - \varepsilon/2, x + \varepsilon/2]$, of length $\varepsilon$, for every $\varepsilon > 0$, so $\lambda^*(\{x\}) = 0$. Finitely many points are covered just as cheaply. The interesting case is a countably infinite set, and the standard example is the set of rationals in $[0, 1]$.

The rationals can be listed one after another, $q_1, q_2, q_3, \ldots$, for example by denominator: $0, 1, \tfrac12, \tfrac13, \tfrac23, \tfrac14, \tfrac34, \tfrac15, \ldots$. Fix a budget $\varepsilon > 0$ and give the $k$-th rational an interval of length $\varepsilon/2^k$ centred on it. The first interval uses half the budget, the second a quarter, the third an eighth, and the whole list never exceeds the budget:

$$
\sum_{k=1}^{\infty} \frac{\varepsilon}{2^k} = \varepsilon\Big(\frac12 + \frac14 + \frac18 + \cdots\Big) = \varepsilon.
$$

Since $\varepsilon$ was arbitrary, the rationals of $[0, 1]$ have outer measure 0. They are dense, with one inside every interval however short, and yet together they fill no room at all. Length measures how much room a set occupies, not how widely its points are scattered. The same argument works for every countable set: the integers, the numbers of the form $k/2^n$, and the endpoints of the intervals in the Cantor construction below.

### Worked example: Covering the rationals with a budget of 0.01

1. The interval around $q_1$ uses half the budget:
   $$0.01/2$$ → **0.005**
2. The interval around $q_2$ uses a quarter of it:
   $$0.01/4$$ → **0.0025**
3. The first ten intervals together:
   $$0.01\,(1 - 2^{-10})$$ → **0.0099902**
4. All of them together, at most:
   $$0.01 \sum_{k \ge 1} 2^{-k}$$ → **0.01**
5. For comparison, a finite cover by closed intervals covers all of $[0, 1]$, so it costs at least:
   $$\lambda([0, 1])$$ → **1**

> A countable union of null sets is null: cover the $k$-th set by intervals of total length $\varepsilon/2^k$, and all these intervals together form one countable list of total length at most $\varepsilon$. The rationals are this rule applied to countably many single points.

## Measurable sets

Outer measure is defined for every subset of $\mathbb{R}$, so it is tempting to call it length and stop. Vitali's set from "σ-algebras and Borel sets" shows why that cannot work: $[0, 1)$ splits into countably many shifted copies of that set, and no single number can be the length of all of them. Outer measure still gives the Vitali set a number, but on such sets it is only subadditive: the outer measures of the pieces add up to more than the outer measure of the whole. The cheapest covers of different pieces are forced to overlap.

Carathéodory found a test that picks out the sets on which this never happens. A set $E$ is **Lebesgue-measurable** if it splits every set cleanly:

$$
\lambda^*(A) = \lambda^*(A \cap E) + \lambda^*(A \setminus E) \qquad \text{for every } A \subseteq \mathbb{R}.
$$

In words: whatever test set $A$ you take, cutting it along $E$ produces two pieces whose outer measures add up exactly to that of $A$; the cut wastes nothing. An interval passes the test. For $E = [0, 0.5]$ and the test set $A = [0.25, 0.75]$, the two pieces are $[0.25, 0.5]$ and $(0.5, 0.75]$, of outer measure $0.25$ each, and $0.25 + 0.25 = 0.5 = \lambda^*(A)$. The Vitali set fails the test: its points are spread so irregularly that some test sets lose length-additivity when cut along it.

**Carathéodory's theorem** says three things. The Lebesgue-measurable sets form a σ-algebra. This σ-algebra contains every interval, and therefore every Borel set, because the Borel sets form the smallest σ-algebra that contains the intervals. And on it, outer measure is countably additive. Restricted to the measurable sets, $\lambda^*$ is called **Lebesgue measure** and written $\lambda$. The proof is a page of careful inequalities and is not reproduced here. What matters is the outcome, which settles the first question of this lesson: length exists on every Borel set and obeys all the rules of "Measuring the size of sets".

## Uniqueness, shifts and scaling

Could another measure on the Borel sets also give every interval its length, but disagree with $\lambda$ somewhere else? No: two measures that agree on all intervals of $[0, 1]$ agree on every Borel subset of $[0, 1]$. The intuition is this. The sets on which the two measures agree are closed under complements and under countable disjoint unions, they contain every interval, and the intersection of two intervals is again an interval. These three facts are enough to force agreement on the whole σ-algebra that the intervals generate; the precise statement is Dynkin's π–λ theorem. So length on the Borel sets is not a choice: once intervals are fixed, everything else is fixed too.

Two symmetry rules follow from uniqueness. Shifting a set does not change its length, $\lambda(A + x) = \lambda(A)$, because $A \mapsto \lambda(A + x)$ is again a measure that gives every interval its length. Stretching a set by a factor $c$ multiplies its length by $|c|$, $\lambda(cA) = |c|\,\lambda(A)$, because $A \mapsto \lambda(cA)/|c|$ also gives every interval its length. On the whole line $\lambda(\mathbb{R}) = \infty$, but $\mathbb{R}$ is the countable union of the intervals $[n, n + 1]$, each of length 1, and that is all the theory needs to carry over from $[0, 1]$ to $\mathbb{R}$.

## The Cantor set

Countable sets are not the only sets of length zero. The Cantor set is built by removing middle thirds again and again:

1. Start with $C_0 = [0, 1]$.
2. Remove the open middle third $(\tfrac13, \tfrac23)$. What is left, $C_1 = [0, \tfrac13] \cup [\tfrac23, 1]$, consists of 2 intervals of length $\tfrac13$.
3. From each interval left, remove its open middle third. $C_2$ consists of 4 intervals of length $\tfrac19$.
4. Repeat. After $n$ steps, $C_n$ consists of $2^n$ intervals of length $3^{-n}$, with total length $(2/3)^n$.
5. The **Cantor set** is what is never removed: $C = C_0 \cap C_1 \cap C_2 \cap \cdots$.

The sets $C_n$ shrink, $C_0 \supseteq C_1 \supseteq C_2 \supseteq \cdots$, and each has finite length, so continuity from above, from "Measuring the size of sets", gives the length of their intersection as the limit of their lengths:

$$
\lambda(C) = \lim_{n \to \infty} \lambda(C_n) = \lim_{n \to \infty} \Big(\frac{2}{3}\Big)^n = 0.
$$

A second argument uses the symmetry rules. The Cantor set is made of two copies of itself shrunk by a factor 3: $C = \tfrac13 C \,\cup\, \big(\tfrac13 C + \tfrac23\big)$, the left copy inside $[0, \tfrac13]$ and the right copy inside $[\tfrac23, 1]$. Scaling and shifting give $\lambda(C) = \tfrac13\lambda(C) + \tfrac13\lambda(C) = \tfrac23\lambda(C)$, and the only finite number equal to two thirds of itself is 0.

Yet $C$ is anything but small when its points are counted. Write the numbers of $[0, 1]$ in base 3, with digits 0, 1 and 2. The first step removes the numbers whose first ternary digit has to be 1, the second step those whose second digit has to be 1, and so on. So $C$ consists exactly of the numbers that have a ternary expansion using only the digits 0 and 2. Some of them are endpoints, such as $\tfrac13 = 0.0222\ldots_3$, but most are not: $\tfrac14 = 0.020202\ldots_3$ lies in $C$ and is the endpoint of no removed interval. Now replace every digit 2 by a 1 and read the result in base 2, so that $0.0202\ldots_3$ becomes $0.0101\ldots_2$. Every number of $[0, 1]$ has a binary expansion, so this map from $C$ onto $[0, 1]$ misses nothing, and $C$ has at least as many points as $[0, 1]$: it is uncountable. A set can have as many points as an interval and still have length zero.

## The fat Cantor set

The opposite surprise comes from removing less. The **fat Cantor set** removes, at step $k$, an open middle interval of length $4^{-k}$ from each of the $2^{k-1}$ pieces present. Step 1 removes $(\tfrac38, \tfrac58)$, of length $\tfrac14$; step 2 removes an interval of length $\tfrac1{16}$ from the middle of each of the two pieces; and so on. The total length removed is

$$
\sum_{k=1}^{\infty} 2^{k-1} \cdot 4^{-k} = \sum_{k=1}^{\infty} \frac{1}{2^{k+1}} = \frac12,
$$

so after $n$ steps the length left is $\tfrac12 + 2^{-(n+1)}$, and the limit set has length $\tfrac12$. The pieces shrink to width zero, so every interval of $[0, 1]$ eventually has a hole punched into it, and the fat Cantor set contains no interval at all. Still, it occupies half of $[0, 1]$. Containing an interval is a statement about shape; length is a statement about amount, and the two are independent.

The figure runs both constructions. Choose the construction, move the number of steps $n$, and compare the readouts. With middle thirds and the default $n = 4$ there are 16 intervals, the smallest of length $1/81 \approx 0.0123$, and the length left is $16/81 \approx 0.1975$, on its way to 0. Switching to the fat set at the same $n$ leaves $0.5313$, on its way to $0.5$.

*[Interactive figure: cantor steps](https://quantsandbox.dev/guide/probability/lebesgue-measure-null-sets)*

> Counting points, spread and length are three different ways to describe a set. The rationals are countable and dense, with length 0; the Cantor set is uncountable and contains no interval, with length 0; the fat Cantor set is uncountable and contains no interval, with length 1/2.

## Null sets and almost everywhere

A set of measure zero is a **null set**. Every countable set is null, the Cantor set is null, and so is every subset of a null set and every countable union of null sets. Null sets are the sets a measure cannot see: removing one from a set, or adding one to it, leaves the measure unchanged.

This makes a new kind of statement possible. A property holds **almost everywhere** (a.e.) if the set where it fails is null. Almost every number in $[0, 1]$ is irrational, because the exceptions, the rationals, form a null set. The indicator $\mathbf{1}_{\mathbb{Q}}$, equal to 1 at the rationals and 0 elsewhere, equals the zero function almost everywhere, although it differs from it at infinitely many points of every interval. Later lessons of this track use this all the time: functions that agree almost everywhere have the same integral, and in probability the same idea is called almost surely.

A more striking example comes from decimal digits. Which numbers of $[0, 1]$ never use the digit 7? After one digit, they lie in 9 of the 10 intervals $[0, 0.1), [0.1, 0.2), \ldots, [0.9, 1]$, with total length $0.9$. After two digits they lie in $9^2 = 81$ of the 100 intervals of length $0.01$, with total length $0.81$. After $n$ digits the length left is $0.9^n$. The numbers with no 7 at all lie inside every one of these sets, so their length is at most $0.9^n$ for every $n$: they form a null set. Almost every number has a 7 somewhere in its decimal expansion. The same argument works for any digit and for any finite string of digits, so almost every number contains every string of digits somewhere in its expansion. Yet the exceptional set is not empty, since $0.5$ and $\tfrac19 = 0.111\ldots$ avoid the digit 7, and by the digit argument used for the Cantor set it is even uncountable.

### Worked example: Numbers without the digit 7

1. After one digit, 9 of the 10 intervals of length 0.1 remain:
   $$9 \cdot 0.1$$ → **0.9**
2. After two digits, 81 of the 100 intervals of length 0.01 remain:
   $$81 \cdot 0.01$$ → **0.81**
3. After ten digits:
   $$0.9^{10}$$ → **0.348678**
4. After fifty digits:
   $$0.9^{50}$$ → **0.005154**
5. The first $n$ for which the length left drops below 0.01:
   $$\min\{n : 0.9^n < 0.01\}$$ → **44**
6. The numbers with no 7 at all lie inside every one of these sets, so their length is:
   $$\lim_{n \to \infty} 0.9^n$$ → **0**

Null is not the same as empty, and once length is read as probability, null is not the same as impossible either. A number drawn uniformly from $[0, 1]$ lands in the Cantor set with probability zero, and it equals $0.5$ with probability zero. Yet the number drawn has to be some number, and every single number has probability zero. Probability zero says that a set is too thin to be hit with any positive frequency, not that it has no points.

## Completion

Lebesgue measure, as Carathéodory's test builds it, lives on a σ-algebra slightly larger than the Borel sets: it also contains every subset of every Borel null set, with measure zero. This enlargement is the **completion** of the Borel σ-algebra. The extra sets are many. The Cantor set has as many points as $[0, 1]$, so it has as many subsets as $[0, 1]$ has, all of them null and Lebesgue-measurable, and there are more of them than there are Borel sets. But completion adds no new lengths, only new null sets, and it never changes the measure of a set that already had one. Its use is convenience: a statement such as "$f = g$ almost everywhere" can refer to the set where $f \ne g$ without first checking that this set is Borel.

## Measurable sets are nearly intervals

After the Cantor sets, measurable sets may look hopelessly wild. In a precise sense they are not: every measurable set can be squeezed between an open set and a closed set whose lengths are as close as you like. For a measurable $E \subseteq [0, 1]$ and any $\varepsilon > 0$ there are an open set $U$ and a closed set $F$ with

$$
F \subseteq E \subseteq U \qquad \text{and} \qquad \lambda(U \setminus F) < \varepsilon.
$$

The open set comes straight from the definition of outer measure: take a cover of $E$ by intervals with total length below $\lambda(E) + \varepsilon$ and enlarge each interval slightly into an open one. For the rationals, $U$ is the union of the short intervals of the worked example, with a budget below $\varepsilon$, and $F$ can be the empty set. For the fat Cantor set, $F$ is the fat Cantor set itself, which is closed, and $U$ is a slightly enlarged step $C_n$ of its construction.

An open subset of $[0, 1]$ is a countable union of disjoint open intervals, and since their total length is finite, all but finitely many of them together have negligible length. So there is even a finite union of intervals $G$ with $\lambda(E \,\triangle\, G) < \varepsilon$, where $E \triangle G$ is the set of points that lie in one of the two sets but not in the other. The mathematician J. E. Littlewood summarised this as his first principle: every measurable set is nearly a finite union of intervals. Lebesgue measure extends length to strange sets, but only to sets that intervals approximate arbitrarily well, which is why its values agree with intuition wherever intuition has something to say.

## Area and volume

The construction works in any dimension. In the plane, cover a set by countably many rectangles $[a_1, b_1] \times [a_2, b_2]$, add up their areas $(b_1 - a_1)(b_2 - a_2)$ and take the infimum. Carathéodory's test then picks out the measurable sets, and on them this outer measure is two-dimensional Lebesgue measure: area. It gives a disc of radius $r$ the area $\pi r^2$, which can be checked by filling the disc from inside and covering it from outside with thin rectangles. It gives every line segment area 0, since a segment of length $\ell$ fits inside a rectangle of area $\ell\varepsilon$ for every $\varepsilon > 0$, and for the same reason the graph of any continuous function on $[0, 1]$ has area 0. In three dimensions, boxes give volume. Everything in this lesson, null sets, almost everywhere and the approximation by simple sets, carries over unchanged.

## Summary

- Lebesgue measure $\lambda$ gives every interval its length; outer measure $\lambda^*(A)$, the cheapest total length of a countable cover of $A$ by intervals, extends it to every set.
- The covers must be countable: with finite covers, the rationals and the irrationals of $[0, 1]$ would both have size 1, and additivity would fail.
- Carathéodory's test picks out the measurable sets; they form a σ-algebra containing every Borel set, on which $\lambda$ is countably additive, unique, unchanged by shifts and scaled by stretches.
- Null sets include every countable set and the uncountable Cantor set; the fat Cantor set contains no interval yet has length 1/2.
- A property holds almost everywhere if it fails only on a null set: almost every number is irrational and contains every digit in its decimal expansion.

[Open the Lebesgue measure lab](https://quantsandbox.dev/lebesgue-measure)

## Interactive labs

- [Lebesgue Measure and Null Sets: Covering Lab](https://quantsandbox.dev/lebesgue-measure)

---

Source: https://quantsandbox.dev/guide/probability/lebesgue-measure-null-sets

Previous lesson: [Sigma-Algebras, Atoms and Borel Sets Explained](https://quantsandbox.dev/guide/probability/sigma-algebras-borel-sets)

Next lesson: [Measurable Functions, Preimages and Image Measures](https://quantsandbox.dev/guide/probability/measurable-functions)
