Lusin's Theorem

J. E. Littlewood summed up real analysis in three principles. Every measurable set is nearly a finite union of intervals. Every measurable function is nearly continuous. Every convergent sequence of measurable functions is nearly uniformly convergent. This page is the second principle, made precise: change a measurable function on a set as small as you like, and it becomes continuous. Then we'll squeeze it, without changing it at all, between two functions that are almost continuous.

The third principle is Egoroff's theorem, in the Lᵖ chapter. It also gives a second proof of Lusin's theorem (that page's Spicy Bonus), and the two proofs make a nice pair.

Nearly Continuous

Start with a function that can't be continuous: a step. A jump is a jump, and no continuous function has one. But a continuous function can almost have one. Replace the vertical cliff with a steep ramp, and the two functions agree everywhere except on the ramp. Make the ramp narrower and the set where they disagree shrinks.

The price of continuity is paid only at the jumps, and you choose how much to pay. Here's the bill for the simplest step there is.

On $\mathbb{R}$ with Lebesgue measure $m$, let $f = \chi_{[0, 1]}$ and $0 < \delta < \frac{1}{2}$. Find a continuous $g$ with compact support, $|g| \le 1$, and $m(\{f \neq g\}) = 2\delta$.


Let $g$ ramp up just inside each end: $$g(x) = \begin{cases} x / \delta, & 0 \le x \le \delta, \\ 1, & \delta \le x \le 1 - \delta, \\ (1 - x)/\delta, & 1 - \delta \le x \le 1, \\ 0, & \text{otherwise.} \end{cases}$$ The pieces agree where they meet, so $g$ is continuous. Its support is $[0, 1]$, which is compact, and $0 \le g \le 1$.

Off $[0, 1]$ both functions are $0$, and on $[\delta, 1 - \delta]$ both are $1$. On $[0, \delta)$, $f = 1$ but $g = x/\delta < 1$, and on $(1 - \delta, 1]$ the same happens in reverse. So $$\{f \neq g\} = [0, \delta) \cup (1 - \delta, 1], \qquad m(\{f \neq g\}) = 2\delta.$$

So $\chi_{[0, 1]}$ is continuous except on a set of measure $2\delta$, and $\delta$ is up to us. Lusin's theorem says the same is true of every measurable function that vanishes off a set of finite measure, no matter how wild. To say that on a general space, though, the measure has to get along with the topology.

The Standing Hypotheses

These are the properties of the measure that the Riesz Representation Theorem builds out of a positive linear functional on $C_c(X)$, and Lebesgue measure on $\mathbb{R}^n$ is the measure it builds from the ordinary integral. This page only uses the list below.

On $\mathbb{R}$ the proof will need two moves over and over: find a compact set inside a measurable set that misses only a little of it, and find an open set outside it that adds only a little. Here is exactly what we assume, on this whole page.

$X$ is a locally compact Hausdorff space, and $\mu$ is a positive measure on a σ-algebra $\mathcal{M}$ in $X$ such that:

  1. $\mathcal{M}$ contains the Borel sets $\mathcal{B}(X)$;
  2. $\mu(K) < \infty$ for every compact $K \subseteq X$;
  3. every $E \in \mathcal{M}$ is outer regular: $\mu(E) = \inf\{\mu(V) : E \subseteq V, \ V \text{ open}\}$;
  4. every open set, and every $E \in \mathcal{M}$ with $\mu(E) < \infty$, is inner regular: $\mu(E) = \sup\{\mu(K) : K \subseteq E, \ K \text{ compact}\}$.

In words: (c) says you can wrap $E$ in an open set that is barely bigger, and (d) says you can fill a set of finite measure with a compact set that is barely smaller. Lebesgue measure on $\mathbb{R}^n$ satisfies all four, and that's the example to keep in mind. (The Riesz measure also turns out to be complete, but nothing here needs that.)

Not every measure on a nice space passes. Two quick checks on $\mathbb{R}$ show which hypothesis does the work.

On $X = \mathbb{R}$ with $\mathcal{M}$ = all subsets, which of the standing hypotheses hold for the point mass $\delta_0$, and which for counting measure $c$?


The point mass: $\delta_0(E)$ is $1$ if $0 \in E$ and $0$ otherwise. (a) holds, since every set is in $\mathcal{M}$, and (b) holds, since $\delta_0(K) \le 1$. For (c), if $0 \in E$ then every open $V \supseteq E$ has $\delta_0(V) = 1 = \delta_0(E)$, and if $0 \notin E$ then $V = \mathbb{R} \setminus \{0\}$ is open with $\delta_0(V) = 0$. For (d), the compact set $K = \{0\}$ (or $K = \emptyset$) inside $E$ already reaches $\delta_0(E)$. All four hold.

Counting measure: $c(E)$ is the number of points of $E$. Then $c([0, 1]) = \infty$ for the compact set $[0, 1]$, so (b) fails. So does (c): $c(\{0\}) = 1$, but every open set around $0$ is infinite. Lusin's theorem is about measures that see the topology, and counting measure ignores it.

The point mass is as regular as it gets; counting measure piles infinite mass onto compact sets. From here on, every result assumes the list above.

Lusin's Theorem

Here it is. The first inequality is the "nearly continuous". The second says the continuous stand-in never gets bigger than the function it replaces, which matters more than it looks: without it, $g$ could be enormous on the small set where it disagrees with $f$.

Assume the standing hypotheses. Let $f\colon X \to \mathbb{C}$ be measurable, let $A = \{f \neq 0\}$, and suppose $\mu(A) < \infty$. Then for every $\varepsilon > 0$ there is $g \in C_c(X)$ with $$\mu(\{f \neq g\}) < \varepsilon \quad \text{and} \quad \sup_{x \in X} |g(x)| \le \sup_{x \in X} |f(x)|.$$

Show proof

Proof. In Steps 1 to 4, $f$ vanishes off a fixed compact set $Q$. Fix an open $W$ with compact closure and $Q \subseteq W$ (the shrinking theorem on Locally Compact Spaces, with $U = X$). Step 5 removes the assumption.

A separation fact. Disjoint compact sets $K_1, \ldots, K_n$ in a Hausdorff space lie in pairwise disjoint open sets. For two disjoint compact sets $K$ and $L$: each $p \in K$ has disjoint open $U_p \ni p$ and $O_p \supseteq L$ (separate a point from a compact set); finitely many $U_{p_1}, \ldots, U_{p_r}$ cover $K$, and $U = \bigcup_i U_{p_i}$ and $O = \bigcap_i O_{p_i}$ are disjoint open sets around $K$ and $L$. Now for each pair $i \neq j$ take disjoint open $O_{ij} \supseteq K_i$ and $O_{ji} \supseteq K_j$, and let $V_j = \bigcap_{i \neq j} O_{ji}$. Then $V_j \supseteq K_j$ is open, and $V_i \cap V_j \subseteq O_{ij} \cap O_{ji} = \emptyset$.

Step 1: simple functions. Let $s = \sum_{j=1}^{n} \alpha_j \chi_{A_j}$ with $\alpha_j > 0$ and disjoint measurable $A_j \subseteq Q$, and let $\eta > 0$. We find $g \in C_c(X)$ with $0 \le g \le \max_j \alpha_j$, $\operatorname{supp} g \subseteq W$, and $\mu(\{s \neq g\}) < \eta$.

Each $\mu(A_j) \le \mu(Q) < \infty$, so inner regularity gives compact $K_j \subseteq A_j$ with $\mu(A_j \setminus K_j) < \eta / 2n$. The $K_j$ are disjoint, so they lie in pairwise disjoint open sets $V_j$. Outer regularity gives open $O_j \supseteq K_j$ with $\mu(O_j) < \mu(K_j) + \eta/2n$; replacing $V_j$ by $V_j \cap O_j \cap W$, the $V_j$ are still disjoint, open, and contain $K_j$, and now $V_j \subseteq W$ and $\mu(V_j \setminus K_j) < \eta / 2n$ (since $\mu(K_j) < \infty$).

Urysohn's lemma gives $g_j \in C_c(X)$ with $\chi_{K_j} \le g_j \le \chi_{V_j}$ and $\operatorname{supp} g_j \subseteq V_j$. Let $g = \sum_j \alpha_j g_j$. It is continuous, and its support lies in $\bigcup_j \operatorname{supp} g_j$, a finite union of compact sets inside $W$. Because the $V_j$ are disjoint, at each point at most one $g_j$ is nonzero, so $0 \le g \le \max_j \alpha_j$.

On $K_j$, $g = \alpha_j = s$. Off $\bigcup_j A_j \cup \bigcup_j V_j$, both are $0$. Every other point lies in some $A_j \setminus K_j$ or some $V_j \setminus K_j$, so $$\mu(\{s \neq g\}) \le \sum_{j=1}^{n} \mu(A_j \setminus K_j) + \sum_{j=1}^{n} \mu(V_j \setminus K_j) < n \cdot \frac{\eta}{2n} + n \cdot \frac{\eta}{2n} = \eta.$$

Step 2: $0 \le f \le 1$. Let $s_n = \varphi_n \circ f$ be the staircase approximations and $s_0 = 0$, and let $t_n = s_n - s_{n-1}$. The $s_n$ are simple, increase, and converge to $f$ at every point, so $f = \sum_{n \ge 1} t_n$. Each $t_n$ is a nonnegative simple function that vanishes off $Q$ (since $\varphi_n(0) = 0$). For $f \le 1$, the staircase values satisfy $0 \le t_n \le 2^{1-n}$: $t_1 \le 1$, and for $n \ge 2$, $t_n$ takes only the values $0$ and $2^{-n}$.

By Step 1 with $\eta = \varepsilon 2^{-n}$, there are $g_n \in C_c(X)$ with $0 \le g_n \le 2^{1-n}$, $\operatorname{supp} g_n \subseteq W$, and $\mu(\{t_n \neq g_n\}) < \varepsilon 2^{-n}$. Since $\sum_n 2^{1-n} = 2 < \infty$, the series $g = \sum_n g_n$ converges uniformly (Weierstrass M-test), so $g$ is continuous. Every $g_n$ vanishes off $W$, so $g$ does, and $\operatorname{supp} g \subseteq \overline{W}$, which is compact. So $g \in C_c(X)$. If $t_n(x) = g_n(x)$ for every $n$, then $g(x) = f(x)$. Hence $$\mu(\{f \neq g\}) \le \sum_{n=1}^{\infty} \mu(\{t_n \neq g_n\}) < \sum_{n=1}^{\infty} \varepsilon 2^{-n} = \varepsilon.$$ (This $g$ can be as large as $2$; the bound comes in Step 4.) If instead $0 \le f \le M$ with $M > 0$, apply this to $f/M$ and multiply the result by $M$.

Step 3: $f\colon X \to [0, \infty)$. The sets $\{f \ge n\}$ decrease, their intersection is empty (every value of $f$ is finite), and $\mu(\{f \ge 1\}) \le \mu(Q) < \infty$. By continuity from above, $\mu(\{f \ge n\}) \to 0$. Pick $n$ with $\mu(\{f \ge n\}) < \varepsilon/2$. The function $f\chi_{\{f < n\}}$ is bounded by $n$ and vanishes off $Q$, so Step 2 gives $g \in C_c(X)$ equal to it outside a set of measure less than $\varepsilon/2$. Since $f = f\chi_{\{f < n\}}$ off $\{f \ge n\}$, $\mu(\{f \neq g\}) < \varepsilon$.

Step 4: complex $f$, and the bound. Write $f = (u^+ - u^-) + i(v^+ - v^-)$ with $u = \operatorname{Re} f$ and $v = \operatorname{Im} f$. The four parts are measurable, nonnegative, finite, and vanish off $Q$. Step 3 with $\varepsilon/4$ gives $g_1, g_2, g_3, g_4 \in C_c(X)$, and $g = (g_1 - g_2) + i(g_3 - g_4) \in C_c(X)$ disagrees with $f$ only where one of the four pairs disagrees, so $\mu(\{f \neq g\}) < \varepsilon$.

For the bound, let $M = \sup_X |f|$. If $M = \infty$ there is nothing to prove, and if $M = 0$ then $f = 0$ and $g = 0$ works. Otherwise let $$\varphi(z) = \begin{cases} z, & |z| \le M, \\ Mz/|z|, & |z| > M. \end{cases}$$ The two formulas agree on $|z| = M$, so $\varphi$ is continuous on $\mathbb{C}$, with $|\varphi| \le M$ and $\varphi(0) = 0$. Then $\varphi \circ g$ is continuous and vanishes wherever $g$ does, so $\operatorname{supp}(\varphi \circ g) \subseteq \operatorname{supp} g$ is compact and $\varphi \circ g \in C_c(X)$. Where $g(x) = f(x)$ we have $|g(x)| \le M$, so $\varphi(g(x)) = f(x)$. Hence $\{f \neq \varphi \circ g\} \subseteq \{f \neq g\}$, and $\varphi \circ g$ satisfies both inequalities.

Step 5: the general case. Now $A = \{f \neq 0\} \in \mathcal{M}$ with $\mu(A) < \infty$. Inner regularity gives compact $Q \subseteq A$ with $\mu(A \setminus Q) < \varepsilon/2$. The function $f\chi_Q$ vanishes off $Q$, so Steps 1 to 4 (with this $Q$ and $\varepsilon/2$) give $g \in C_c(X)$ with $\mu(\{f\chi_Q \neq g\}) < \varepsilon/2$ and $\sup|g| \le \sup|f\chi_Q| \le \sup|f|$. Since $f = f\chi_Q$ off $A \setminus Q$, $$\mu(\{f \neq g\}) \le \mu(A \setminus Q) + \mu(\{f\chi_Q \neq g\}) < \varepsilon. \qquad \blacksquare$$

That's the whole theorem. Before the proof, get a feel for what it promises. Pick a step function and set the ramp width yourself.

Agree Except on ε

Each jump costs exactly its ramp, whether the ramp sits inside a step or straddles the jump, and the bound $\sup|g| \le \sup|f|$ comes for free with straight ramps. Now draw your own $g$. Nothing forces you to use ramps.

Draw Your g

However you draw it, $g$ has to cross every jump of $f$ somewhere, and wherever it's crossing, it isn't equal to $f$. Count the ramps and add their widths.

Loading practice engine...

Can we do better than "less than $\varepsilon$"? Two natural hopes, and both fail. First, the hypothesis $\mu(A) < \infty$ isn't decoration.

On $\mathbb{R}$ with Lebesgue measure $m$, let $f \equiv 1$. Show that $m(\{f \neq g\}) = \infty$ for every $g \in C_c(\mathbb{R})$. Which hypothesis of Lusin's theorem fails?

Show answer

Let $g \in C_c(\mathbb{R})$. Its support is compact, hence bounded, so $\operatorname{supp} g \subseteq [-R, R]$ for some $R$, and $g = 0$ outside $[-R, R]$. There $f = 1 \neq g$, so $$\{f \neq g\} \supseteq (-\infty, -R) \cup (R, \infty), \qquad m(\{f \neq g\}) = \infty.$$ The hypothesis that fails is $m(A) < \infty$: here $A = \{f \neq 0\} = \mathbb{R}$. The trouble is the compact support of $g$, not continuity: $g \equiv 1$ is continuous and agrees with $f$ everywhere. (The Spicy Bonus shows that on $\mathbb{R}$, if you give up compact support, the hypothesis can go.) $\blacksquare$

Second, "less than every $\varepsilon$" can't be pushed to "equal to $0$". A jump is a jump, and no set of measure zero can hide one.

Show that there is no continuous $g\colon \mathbb{R} \to \mathbb{R}$ with $m(\{\chi_{[0, 1]} \neq g\}) = 0$.

Show proof

Proof. Suppose $g$ is continuous and $N = \{\chi_{[0, 1]} \neq g\}$ has measure $0$. An interval of positive length can't lie inside $N$, so every such interval contains a point where $g = \chi_{[0, 1]}$.

For each $k \ge 2$, pick $x_k \in (1 - \frac{1}{k}, 1)$ and $y_k \in (1, 1 + \frac{1}{k})$ outside $N$. Then $g(x_k) = 1$ and $g(y_k) = 0$. Both sequences converge to $1$, so continuity gives $g(1) = \lim g(x_k) = 1$ and $g(1) = \lim g(y_k) = 0$, a contradiction. $\blacksquare$

So Lusin's theorem is sharp in both directions. Now for how it's proved. The proof builds $g$ in five steps, from simple functions up to everything, and each step has a picture.

On Locally Compact Spaces, Urysohn's lemma built a continuous $g$ with $\chi_K \le g \le \chi_V$ for compact $K$ inside open $V$. Step 1 is that lemma plus regularity, and nothing else.

First, Step 1: simple functions. Take $s = \sum_j \alpha_j \chi_{A_j}$. Inner regularity puts a compact $K_j$ inside each $A_j$, missing only a little of it. Outer regularity and the Hausdorff property put disjoint open sets $V_j$ around the $K_j$, adding only a little. Urysohn's lemma fills in a continuous bump of height $\alpha_j$ that is flat on $K_j$ and dies before it leaves $V_j$. The bumps agree with $s$ on the $K_j$, and they can only go wrong on the thin shells $A_j \setminus K_j$ and $V_j \setminus K_j$.

The whole step is one budget: the leftover $\mu(A \setminus K)$ plus the overhang $\mu(V \setminus K)$ has to come in under $\eta$. Try paying it yourself.

Squeeze K and V

Notice that you never had to make $K$ equal to $A$. You only had to make the shells thin, and regularity always lets you.

On Upper Limits & Simple Functions, the staircase $\varphi_n$ rounded $f$ down to the nearest multiple of $2^{-n}$, and the simple functions $s_n = \varphi_n \circ f$ climbed up to $f$.

Next, Step 2: $0 \le f \le 1$. Peel $f$ into layers. The difference $t_n = s_n - s_{n-1}$ between consecutive staircases is a simple function of height at most $2^{1-n}$, and $f$ is the sum of all the layers. Step 1 replaces each layer with a continuous one, wrong on a set of measure less than $\varepsilon 2^{-n}$. The layers shrink geometrically, so the continuous layers add up to a continuous function, and the bad sets add up to less than $\varepsilon$.

One subtle point: each $g_n$ has compact support, but infinitely many compact sets can spread out. That's why every $g_n$ lives inside the same $W$ with compact closure: then the sum's support stays inside $\overline{W}$.

Then Step 3: unbounded $f \ge 0$. Cut $f$ off at height $n$. The set where $f \ge n$ shrinks to nothing as $n$ grows, and since it starts out with finite measure, continuity from above makes its measure tend to $0$. Below the cut, $f$ is bounded and Step 2 applies.

Then Step 4: complex $f$. Split $f$ into four nonnegative parts, real and imaginary, positive and negative, and approximate each one. That handles the measure. For the bound $\sup|g| \le \sup|f| = M$, push every value of $g$ that sticks out of the disk of radius $M$ straight back to its edge, along the ray through $0$.

The radial push only moves values with $|g(x)| > M$, and at those points $g(x)$ can't equal $f(x)$, since $|f| \le M$. So it never spoils a point where $g$ was already right. The obvious alternative is a trap.

Don't cap the real and imaginary parts separately. Clipping each coordinate to $[-M, M]$ squeezes $g$ into a square, not a disk, and the square's corner $M + Mi$ has modulus $M\sqrt{2}$. The retraction $z \mapsto Mz/|z|$ is the one that respects $|\cdot|$. (Its formula is not compactly supported on $\mathbb{C}$; what keeps $\varphi \circ g$ compactly supported is $\varphi(0) = 0$.)

See the difference for yourself.

Retract It

Last, Step 5: the general case. Steps 1 to 4 assumed $f$ vanishes off a compact set. Inner regularity finds a compact $Q$ inside $A$ that misses less than $\varepsilon/2$ of it; run Steps 1 to 4 on $f\chi_Q$ with $\varepsilon/2$, and the two halves of the budget add up to $\varepsilon$.

Here's an example that shows how far "nearly continuous" can stretch.

On $\mathbb{R}$ with Lebesgue measure $m$, let $f = \chi_{\mathbb{Q} \cap [0, 1]}$. Where is $f$ continuous? Find $g \in C_c(\mathbb{R})$ for Lusin's theorem.


Every interval contains both rationals and irrationals. So at each $x \in [0, 1]$, there are points arbitrarily close to $x$ where $f = 1$ and points where $f = 0$: $f$ is discontinuous at every point of $[0, 1]$. (Off $[0, 1]$ it is $0$ on a neighborhood, so continuous there.)

But $g = 0$ is in $C_c(\mathbb{R})$, and $\{f \neq g\} = \mathbb{Q} \cap [0, 1]$ is countable, so $m(\{f \neq g\}) = 0 < \varepsilon$ for every $\varepsilon$. And $\sup|g| = 0 \le 1$.

$\chi_{\mathbb{Q}}$ is discontinuous at every single point, and Lusin just shrugs and hands it the zero function.

A function that jumps at every point of $[0, 1]$, and it's "nearly continuous" with room to spare. That's worth a warning.

Lusin's theorem does not say $f$ is continuous at almost every point. $\chi_{\mathbb{Q} \cap [0, 1]}$ is discontinuous on a set of measure $1$. What it says is that $f$ agrees with a continuous function off a small set. Other books state it another way: there is a closed (or compact) set $F$ with $\mu(F^c)$ small on which the restriction $f|_F$ is continuous. That's the next exercise, and it's about the restriction, not about $f$ at the points of $F$. (The name is also spelled Luzin.)

Here's that version, straight from the theorem plus one more use of inner regularity.

Every measurable function is continuous if you squint at the right set.

Assume the hypotheses of Lusin's theorem. Show that for every $\varepsilon > 0$ there is a compact $K \subseteq A$ with $\mu(A \setminus K) < \varepsilon$ such that the restriction $f|_K$ is continuous.

Show proof

Proof. Lusin's theorem with $\varepsilon/2$ gives $g \in C_c(X)$ with $\mu(E) < \varepsilon/2$, where $E = \{f \neq g\}$. The set $A \setminus E$ is measurable with finite measure, so inner regularity gives a compact $K \subseteq A \setminus E$ with $\mu((A \setminus E) \setminus K) < \varepsilon/2$.

On $K$ we have $f = g$, so $f|_K = g|_K$, which is continuous as the restriction of a continuous function. And $A \setminus K \subseteq E \cup ((A \setminus E) \setminus K)$, so $\mu(A \setminus K) < \varepsilon/2 + \varepsilon/2 = \varepsilon$. $\blacksquare$

Continuous Functions That Converge Almost Everywhere

Run Lusin's theorem again and again with $\varepsilon = \frac{1}{2}, \frac{1}{4}, \frac{1}{8}, \ldots$, and you get a sequence of continuous functions. Each one is wrong on a smaller set, and the sizes of those sets add up to something finite. That's exactly the situation Borel–Cantelli was made for.

Assume the hypotheses of Lusin's theorem, and $|f| \le 1$. Then there are $g_n \in C_c(X)$ with $|g_n| \le 1$ such that $g_n(x) \to f(x)$ for $\mu$-almost every $x$.

Show proof

Proof. For each $n$, Lusin's theorem with $\varepsilon = 2^{-n}$ gives $g_n \in C_c(X)$ with $|g_n| \le \sup|f| \le 1$ and $\mu(E_n) < 2^{-n}$, where $E_n = \{f \neq g_n\}$. Then $\sum_n \mu(E_n) < 1 < \infty$, so by Borel–Cantelli, almost every $x$ lies in only finitely many $E_n$. For such an $x$, $g_n(x) = f(x)$ for all large $n$, so $g_n(x) \to f(x)$. $\blacksquare$

The convergence is even better than it sounds: at almost every point, $g_n(x)$ doesn't just approach $f(x)$, it lands on it and stays. Here's Borel–Cantelli doing the counting.

"Almost every" is honest here: a few points can be missed forever. A concrete case shows which ones.

On $\mathbb{R}$, let $f = \chi_{[0, 1]}$ and let $g_n$ be the ramp from the first example with $\delta = 2^{-n-1}$. Where does $g_n \to f$?


Off $[0, 1]$, $g_n = 0 = f$ for every $n$. For $0 < x < 1$, once $2^{-n-1} \le \min\{x, 1 - x\}$ the point $x$ is on the flat part, so $g_n(x) = 1 = f(x)$ from then on.

But $g_n(0) = 0$ and $g_n(1) = 0$ for every $n$, while $f(0) = f(1) = 1$. So $g_n \to f$ everywhere except on $\{0, 1\}$, a set of measure $0$, exactly as the corollary allows. Here $E_n = [0, 2^{-n-1}) \cup (1 - 2^{-n-1}, 1]$, and the two endpoints are the points in infinitely many $E_n$.

That's every step of Lusin's proof and its corollary. Check that you can put them back together: each question below shows one line of a proof with a hole in it.

Loading practice engine...

The Vitali–Carathéodory Theorem

Lusin changes $f$ on a small set. Sometimes you can't afford to change $f$ at all, say because you're estimating $\int f$ and need bounds that hold everywhere. The Vitali–Carathéodory theorem leaves $f$ alone and squeezes it from both sides: a function $u$ below it and a function $v$ above it, with almost no room between them in the integral. The price is that $u$ and $v$ are only semicontinuous, the weaker cousin of continuity from Locally Compact Spaces.

The pattern is: $\chi_K$ for compact $K$ is upper semicontinuous, and $\chi_V$ for open $V$ is lower semicontinuous. So compact sets go under $f$, and open sets go over it. Here's the squeeze for the everywhere-discontinuous function from before.

Let $q_1, q_2, \ldots$ list the rationals in $[0, 1]$, $f = \chi_{\mathbb{Q} \cap [0, 1]}$ on $\mathbb{R}$, and $\varepsilon > 0$. Find $u \le f \le v$ with $u$ upper semicontinuous, $v$ lower semicontinuous, and $\int (v - u)\, dm < \varepsilon$.


Below: $u = 0$. It is continuous, so in particular upper semicontinuous, and $0 \le f$.

Above: put a small open interval around each rational, $V = \bigcup_n (q_n - \varepsilon 2^{-n-2}, \ q_n + \varepsilon 2^{-n-2})$, and let $v = \chi_V$. The set $V$ is open, so $v$ is lower semicontinuous, and $V$ contains every $q_n$, so $v \ge f$.

The gap: by countable subadditivity, $$\int (v - u)\, dm = m(V) \le \sum_{n=1}^{\infty} 2 \cdot \varepsilon 2^{-n-2} = \frac{\varepsilon}{2} \sum_{n=1}^{\infty} 2^{-n} = \frac{\varepsilon}{2} < \varepsilon.$$

An open set of tiny measure that contains every rational in $[0, 1]$: a dense open set with almost nothing in it. Watch it get built.

For a step function the squeeze looks like the first picture on this page, turned inside out: compact intervals just inside each step for $u$, open intervals just outside for $v$, and the gap is the thin frame between them.

The general theorem writes $f$ as a sum of such steps and squeezes each one, with one extra trick: an integrable $f$ may need infinitely many steps, and an upper semicontinuous $u$ can only afford finitely many, so $u$ stops at some $N$ and the tail goes into the gap.

Assume the standing hypotheses. Let $f \in L^1(\mu)$ be real-valued and $\varepsilon > 0$. Then there are functions $u\colon X \to [-\infty, \infty)$ and $v\colon X \to (-\infty, \infty]$ with $u \le f \le v$, $u$ upper semicontinuous and bounded above, $v$ lower semicontinuous and bounded below, and $$\int_X (v - u)\, d\mu < \varepsilon.$$

Show proof

Proof. First, $f \ge 0$. With the staircase approximations $s_n \uparrow f$ and $s_0 = 0$, each $t_n = s_n - s_{n-1}$ is a nonnegative simple function, so it is a finite sum of terms $c\,\chi_E$ with $c > 0$ and $E \in \mathcal{M}$. Listing all these terms gives constants $c_j > 0$ and sets $E_j \in \mathcal{M}$ with $$f = \sum_{j} c_j \chi_{E_j} \quad \text{pointwise}.$$ (If the list is finite, the tail below is empty.) By monotone convergence for series, $\sum_j c_j \mu(E_j) = \int_X f\, d\mu < \infty$, so every $\mu(E_j) < \infty$.

By regularity there are compact $K_j$ and open $V_j$ with $K_j \subseteq E_j \subseteq V_j$ and $c_j \mu(V_j \setminus K_j) < \varepsilon 2^{-j-1}$. Since the series converges, there is $N$ with $\sum_{j > N} c_j \mu(E_j) < \varepsilon / 2$. Let $$u = \sum_{j=1}^{N} c_j \chi_{K_j}, \qquad v = \sum_{j} c_j \chi_{V_j}.$$ Each $\chi_{K_j}$ is upper semicontinuous ($K_j$ is closed, since $X$ is Hausdorff), so the finite sum $u$ is upper semicontinuous, and $0 \le u \le \sum_{j \le N} c_j$. Each $\chi_{V_j}$ is lower semicontinuous, so the partial sums of $v$ are, and $v$ is their increasing limit, hence lower semicontinuous; and $v \ge 0$. Also $u \le \sum_{j \le N} c_j \chi_{E_j} \le f \le v$.

Since $u$ is finite, $v - u = \sum_{j \le N} c_j \chi_{V_j \setminus K_j} + \sum_{j > N} c_j \chi_{V_j}$, and $\mu(V_j) \le \mu(V_j \setminus K_j) + \mu(E_j)$. So $$\int_X (v - u)\, d\mu = \sum_{j \le N} c_j \mu(V_j \setminus K_j) + \sum_{j > N} c_j \mu(V_j) \le \sum_{j} c_j \mu(V_j \setminus K_j) + \sum_{j > N} c_j \mu(E_j) < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon.$$

General $f$. Write $f = f^+ - f^-$, both nonnegative and in $L^1(\mu)$. The first case gives $u_1 \le f^+ \le v_1$ and $u_2 \le f^- \le v_2$ with $\int (v_1 - u_1) < \varepsilon/2$ and $\int (v_2 - u_2) < \varepsilon/2$. Let $u = u_1 - v_2$ and $v = v_1 - u_2$. A minus sign swaps lower and upper semicontinuity, so $-v_2$ is upper semicontinuous and bounded above, and $-u_2$ is lower semicontinuous and bounded below. The sum of two upper semicontinuous functions is upper semicontinuous (here $u_1$ is finite, so no $\infty - \infty$ appears), so $u$ is, and likewise $v$ is lower semicontinuous. Both bounds carry over, and $$u = u_1 - v_2 \le f^+ - f^- \le v_1 - u_2 = v, \qquad \int_X (v - u)\, d\mu = \int_X (v_1 - u_1)\, d\mu + \int_X (v_2 - u_2)\, d\mu < \varepsilon. \qquad \blacksquare$$

So every integrable function sits in a semicontinuous sandwich as thin as you like. The bread is semicontinuous rather than continuous, and the Exercise below shows it can't be improved. First, build a sandwich yourself.

Vitali–Carathéodory: $f$ gets a bodyguard on each side, and both bodyguards are only semi-reliable.

Fit u and v

The gap is the thin frame around each step, weighted by its height, plus whole blocks you leave out of $u$. Compute one.

Loading practice engine...

A valid pair has to pass four checks at once: the right semicontinuity on each side, the right inequalities, and the budget. Spot the one that does.

Loading practice engine...

Last in this section: why the theorem settles for semicontinuous. A closed set with no interior and positive measure (a "fat Cantor set", built on Lebesgue Measure) makes continuous bread impossible.

Let $C \subseteq [0, 1]$ be a closed set with empty interior and $m(C) = c > 0$, and let $f = \chi_C$. Show that if $u \le f \le v$ with $u$ and $v$ continuous on $\mathbb{R}$, then $\int (v - u)\, dm \ge c$.

Show proof

Proof. Since $C$ is closed with empty interior, $C^c$ is open and dense in $\mathbb{R}$. On $C^c$, $u \le f = 0$. Every point is a limit of points of $C^c$, so by continuity $u \le 0$ everywhere.

On $C$, $v \ge f = 1$, so $v - u \ge 1$ there. Everywhere, $v - u \ge f - f = 0$. Hence $$\int_{\mathbb{R}} (v - u)\, dm \ge \int_C (v - u)\, dm \ge m(C) = c.$$ So no continuous pair gets the gap below $c$, while Vitali–Carathéodory gets it below any $\varepsilon$ with semicontinuous $u$ and $v$. $\blacksquare$

Mixed Practice

Every question so far came right after its idea, which is a hint. Down here the hint is gone. First, true or false: a claim about anything on this page, some of them the kind that sounds right and isn't. Decide, then read why.

Loading practice engine...

Next, the mixed set. Every question type on this page except true or false goes into one hat, and each click draws a new one at random. Flip the switch to type your answer; the types that need their answer choices will say so.

Loading practice engine...

Last, the Spicy Bonus. The first exercise showed that $\mu(A) < \infty$ can't be dropped, and the culprit was compact support. On $\mathbb{R}$, give up compact support and the hypothesis goes away: chop the line into unit intervals, run Lusin on each, and glue.

🌶️ SPICY BONUS 🌶️

Let $m$ be Lebesgue measure on $\mathbb{R}$ and $f\colon \mathbb{R} \to \mathbb{C}$ measurable, with no assumption on $m(\{f \neq 0\})$. Prove that for every $\varepsilon > 0$ there is a continuous $g\colon \mathbb{R} \to \mathbb{C}$ with $$m(\{f \neq g\}) < \varepsilon \quad \text{and} \quad \sup_{\mathbb{R}} |g| \le \sup_{\mathbb{R}} |f|.$$

Show proof

Proof. We may assume $\varepsilon \le 1$. For $n \in \mathbb{Z}$ let $I_n = (n, n + 1)$ and $\delta_n = \frac{\varepsilon}{10} 2^{-|n|}$, so $\delta_n < \frac{1}{2}$.

Pieces. The function $f_n = f\chi_{I_n}$ is measurable and vanishes off $I_n$, which has measure $1$. Lusin's theorem gives $g_n \in C_c(\mathbb{R})$ with $m(\{f_n \neq g_n\}) < \delta_n$ and $\sup|g_n| \le \sup|f_n| \le \sup|f|$.

Cutoffs. The support of $g_n$ may spill outside $I_n$, so trim it. The set $K_n = [n + \delta_n, n + 1 - \delta_n]$ is compact and lies in the open set $I_n$, so Urysohn's lemma gives $h_n \in C_c(\mathbb{R})$ with $\chi_{K_n} \le h_n \le \chi_{I_n}$ and $\operatorname{supp} h_n \subseteq I_n$. Let $k_n = g_n h_n$. It is continuous, $|k_n| \le |g_n| \le \sup|f|$, and $\operatorname{supp} k_n \subseteq \operatorname{supp} h_n$, a compact subset of $I_n$.

Glue. Let $g = \sum_{n \in \mathbb{Z}} k_n$. The supports of the $k_n$ lie in the disjoint intervals $I_n$, so at each point at most one term is nonzero, and every bounded interval meets only finitely many of the supports. So near each point $g$ is a finite sum of continuous functions, hence continuous on $\mathbb{R}$, and $|g| \le \sup|f|$ everywhere.

The bad set. If $x \in K_n$ and $f_n(x) = g_n(x)$, then $g(x) = g_n(x) h_n(x) = g_n(x) = f_n(x) = f(x)$. Every $x$ lies in $\mathbb{Z}$ or in exactly one $I_n$, so $$\{f \neq g\} \subseteq \mathbb{Z} \cup \bigcup_{n \in \mathbb{Z}} \Big( \{f_n \neq g_n\} \cup (I_n \setminus K_n) \Big),$$ and $m(I_n \setminus K_n) = 2\delta_n$. Since $m(\mathbb{Z}) = 0$ and $\sum_{n \in \mathbb{Z}} 2^{-|n|} = 3$, $$m(\{f \neq g\}) \le \sum_{n \in \mathbb{Z}} (\delta_n + 2\delta_n) = 3 \cdot \frac{\varepsilon}{10} \cdot 3 = \frac{9\varepsilon}{10} < \varepsilon. \qquad \blacksquare$$