This is where measure theory starts. Before we can measure anything or integrate anything, we have to decide which sets we're even allowed to measure, and which functions play nicely with those sets. Those are σ-algebras and measurable functions, and they're the whole page. Practice sits right after each idea, and the Mixed Practice at the bottom takes that hint away.
The Riemann integral chops $[a, b]$ into thin strips and adds up rectangles. For continuous functions it works beautifully. But it leans on continuity: inside a thin strip, a continuous function barely moves, so the tall rectangle and the short rectangle almost agree.
Here's a function where that goes badly wrong. On $[0, 1]$, let it be $1$ at every rational number and $0$ at every irrational number. Watch what Riemann sums do with it.
Every strip, however thin, contains rationals and irrationals, so the upper sum is always $1$ and the lower sum is always $0$. They never meet, so there's no Riemann integral. And this isn't some exotic monster. It's $1$ on a countable set and $0$ everywhere else, so if anything its integral "should" be $0$.
The fix is to stop chopping up the $x$-axis and decide instead which sets we know how to measure. Topology made the same move: it doesn't define continuity point by point, it picks out a collection of "open" sets and asks preimages to land in it.
On Topological Spaces & Bases, a topology on $X$ was a collection of subsets that contains $\emptyset$ and $X$ and is closed under arbitrary unions and finite intersections. A function is continuous when the preimage of every open set is open. Measure theory copies the shape of that definition with a different list of rules.
So the plan for this page: a new kind of collection of sets, then the functions that respect it. Here's the new list of rules.
Throughout, $X$ is a nonempty set and $\mathcal{P}(X)$ is its power set, the collection of all subsets of $X$. We want a collection of subsets that you can complement, and take countable unions of, without ever falling out of it.
Why "$\sigma$"? Because "closed-under-countably-many-unions algebra" wouldn't fit on the menu.
A collection $\mathcal{M} \subseteq \mathcal{P}(X)$ is a σ-algebra on $X$ if
Rule 3 is where the $\sigma$ comes from: countably many unions, not just finitely many. That one word is what will let us take limits later. Once we have a σ-algebra, the pair and its members get names.
If $\mathcal{M}$ is a σ-algebra on $X$, the pair $(X, \mathcal{M})$ is a measurable space, and each set $E \in \mathcal{M}$ is a measurable set.
With the names in hand, here are a few σ-algebras on a set small enough to check by hand.
Find some σ-algebras on $X = \{1, 2, 3, 4\}$, and check one collection that isn't.
On any set, $\mathcal{P}(X)$ (here all $16$ subsets) and $\{\emptyset, X\}$ are σ-algebras: the biggest and the smallest.
In between, take $\mathcal{M} = \{\emptyset, \{1, 2\}, \{3, 4\}, X\}$. It contains $X$. Complements pair up: $\{1, 2\}$ with $\{3, 4\}$, and $\emptyset$ with $X$. Any union of members is $\emptyset$, $\{1, 2\}$, $\{3, 4\}$, or $X$. So $\mathcal{M}$ is a σ-algebra.
But $\{\emptyset, \{1\}, X\}$ is not: $\{1\}$ is in it, and its complement $\{2, 3, 4\}$ isn't.
You only ever check three rules, but a σ-algebra survives much more than that. Everything you'd want to do to sets, it's closed under.
Let $\mathcal{M}$ be a σ-algebra on $X$. Then
Proof. (a) $X \in \mathcal{M}$, so its complement $X^c = \emptyset$ is in $\mathcal{M}$.
(b) Put $A_k = \emptyset$ for $k > n$. Then $\bigcup_{k=1}^{\infty} A_k = A_1 \cup \cdots \cup A_n$, a countable union of members of $\mathcal{M}$.
(c) By De Morgan's law, $\bigcap_{n} A_n = \left(\bigcup_{n} A_n^c\right)^c$. Each $A_n^c$ is in $\mathcal{M}$ by rule 2, their union by rule 3, and its complement by rule 2 again. For a finite intersection $A_1 \cap \cdots \cap A_n$, put $A_k = X$ for $k > n$.
(d) $A \setminus B = A \cap B^c$, an intersection of two members of $\mathcal{M}$. $\blacksquare$
So countably many set operations can never take you out of a σ-algebra. The sets in a σ-algebra are going to be the sets we're allowed to measure. That's why the rules are what they are.
On Measures, the page after next, a measure $\mu$ gives each $E \in \mathcal{M}$ a size $\mu(E) \in [0, \infty]$, and it has to add up over countably many disjoint pieces. That's exactly why a σ-algebra has to be closed under countable unions: the union of the pieces has to be a set we can measure.
Topologies and σ-algebras have the same shape and different rules, and they're easy to mix up.
Topology vs. σ-algebra. A topology wants arbitrary unions and finite intersections, and says nothing about complements. A σ-algebra wants complements, and only countable unions. So the open sets of $\mathbb{R}$ form a topology but not a σ-algebra: $(0, 1)$ is open, and its complement $(-\infty, 0] \cup [1, \infty)$ isn't. Going the other way, a σ-algebra needn't be a topology: the co-countable σ-algebra in the second exercise below contains every single point of $\mathbb{R}$, but not $[0, 1]$, their union. $\mathcal{P}(X)$ and $\{\emptyset, X\}$ are both.
Why insist on countable unions instead of finite ones? Because finite unions are a genuinely weaker rule. Here's a collection that has everything except the $\sigma$.
Let $\mathcal{A}$ be the collection of subsets of $\mathbb{N} = \{1, 2, 3, \ldots\}$ that are finite or have a finite complement. Show that $\mathcal{A}$ contains $\mathbb{N}$ and is closed under complements and finite unions, but is not a σ-algebra.
Proof. $\mathbb{N}^c = \emptyset$ is finite, so $\mathbb{N} \in \mathcal{A}$. If $E$ is finite, then $E^c$ has the finite complement $E$; if $E^c$ is finite, then $E^c$ is finite. Either way $E^c \in \mathcal{A}$.
For finite unions, take $A, B \in \mathcal{A}$. If both are finite, so is $A \cup B$. Otherwise one of them, say $A$, has a finite complement, and $(A \cup B)^c \subseteq A^c$ is finite. Either way $A \cup B \in \mathcal{A}$, and induction handles any finite union.
But the sets $\{2\}, \{4\}, \{6\}, \ldots$ are all finite, so all in $\mathcal{A}$, and their union is the set of even numbers. It is infinite, and its complement, the odd numbers, is infinite too. So the union is not in $\mathcal{A}$, and rule 3 fails. $\blacksquare$
That collection broke because a countable union of finite sets can be infinite. Push the same idea one level up, from finite vs. infinite to countable vs. uncountable, and the countable unions behave.
Let $X$ be uncountable, and let $\mathcal{M} = \{E \subseteq X : E \text{ is countable or } E^c \text{ is countable}\}$. Show that $\mathcal{M}$ is a σ-algebra.
Proof. $X^c = \emptyset$ is countable, so $X \in \mathcal{M}$. The condition "$E$ or $E^c$ is countable" doesn't change when $E$ and $E^c$ trade places, so $\mathcal{M}$ is closed under complements.
Let $A_1, A_2, \ldots \in \mathcal{M}$. If every $A_n$ is countable, then $\bigcup_n A_n$ is a countable union of countable sets, so it is countable. Otherwise some $A_k$ has a countable complement, and $\left(\bigcup_n A_n\right)^c \subseteq A_k^c$ is countable. Either way $\bigcup_n A_n \in \mathcal{M}$. $\blacksquare$
This one is the co-countable σ-algebra, and it's a handy source of counterexamples. (The same proof works for any $X$; when $X$ is countable, it's just $\mathcal{P}(X)$.) Now build some σ-algebras yourself. Every collection you try gets checked against the three rules, and a broken rule points at the exact sets that break it.
Click subsets to put them in $\mathcal{M}$ or take them out.
Did you notice the sizes? Every σ-algebra you found had $2$, $4$, $8$, or $16$ sets, never $6$. That's not a coincidence, and the next section says why. First, pick the real σ-algebra out of a lineup.
Loading practice engine...
Nobody lists a σ-algebra set by set. Instead you name a few sets you care about and ask for the smallest σ-algebra that contains them. The first thing to check is that "smallest" makes sense.
Let $\mathcal{F} \subseteq \mathcal{P}(X)$. There is a unique σ-algebra $\sigma(\mathcal{F})$ on $X$ such that
Proof. Let $\Omega$ be the family of all σ-algebras on $X$ that contain $\mathcal{F}$. It isn't empty, since $\mathcal{P}(X) \in \Omega$. Let $\sigma(\mathcal{F})$ be the collection of sets that belong to every $\mathcal{N} \in \Omega$, that is, $\sigma(\mathcal{F}) = \bigcap_{\mathcal{N} \in \Omega} \mathcal{N}$.
It is a σ-algebra. $X$ is in every $\mathcal{N} \in \Omega$. If $A$ is in every $\mathcal{N}$, so is $A^c$, because each $\mathcal{N}$ is closed under complements. If each $A_n$ is in every $\mathcal{N}$, then $\bigcup_n A_n$ is in every $\mathcal{N}$, because each $\mathcal{N}$ is closed under countable unions.
Rules 1 and 2. $\mathcal{F}$ is inside every $\mathcal{N} \in \Omega$, so it is inside their intersection. And if $\mathcal{N}$ is a σ-algebra containing $\mathcal{F}$, then $\mathcal{N} \in \Omega$, so the intersection sits inside $\mathcal{N}$.
Uniqueness. If $\mathcal{M}'$ also satisfies rules 1 and 2, then rule 2 for $\sigma(\mathcal{F})$ gives $\sigma(\mathcal{F}) \subseteq \mathcal{M}'$, and rule 2 for $\mathcal{M}'$ gives $\mathcal{M}' \subseteq \sigma(\mathcal{F})$. $\blacksquare$
The proposition earns $\sigma(\mathcal{F})$ a name.
For $\mathcal{F} \subseteq \mathcal{P}(X)$, the smallest σ-algebra on $X$ containing $\mathcal{F}$, written $\sigma(\mathcal{F})$, is the σ-algebra generated by $\mathcal{F}$.
Here's the smallest possible case, done by hand.
On $X = \{1, 2, 3, 4\}$, find $\sigma(\{\{1\}\})$.
Any σ-algebra containing $\{1\}$ must also contain its complement $\{2, 3, 4\}$, and $\emptyset$ and $X$. And $\{\emptyset, \{1\}, \{2, 3, 4\}, X\}$ is already a σ-algebra: it contains $X$, complements pair up, and every union of members is a member. So it is the smallest one:
$$\sigma(\{\{1\}\}) = \{\emptyset, \{1\}, \{2, 3, 4\}, X\}.$$
Guessing and checking works when there's one generator. With more, the intersection proof is slick, but it tells you nothing about what's actually inside $\sigma(\mathcal{F})$. On a finite set we can say exactly. Sort the points by which generators contain them.
Let $X$ be finite and $\mathcal{F} = \{F_1, \ldots, F_m\}$. Two points of $X$ lie in the same atom of $\sigma(\mathcal{F})$ when each $F_i$ contains both of them or neither of them. The atoms are the groups of points this sorts $X$ into.
An atom is the finest thing $\sigma(\mathcal{F})$ can see: it can't tell the points inside one atom apart. And that turns out to be the whole story.
Let $X$ be finite, $\mathcal{F} = \{F_1, \ldots, F_m\}$, and let $A_1, \ldots, A_k$ be the atoms of $\sigma(\mathcal{F})$. Then $\sigma(\mathcal{F})$ is exactly the collection of all unions of atoms (the empty union is $\emptyset$). In particular, $\sigma(\mathcal{F})$ has $2^k$ members.
Proof. Let $\mathcal{U}$ be the collection of all unions of atoms.
$\mathcal{U} \subseteq \sigma(\mathcal{F})$. Fix $x \in X$, and for each $i$ let $G_i = F_i$ if $x \in F_i$ and $G_i = F_i^c$ if not. A point agrees with $x$ on every $F_i$ exactly when it lies in $G_1 \cap \cdots \cap G_m$, so that intersection is the atom of $x$. It is built from members of $\mathcal{F}$ by complements and intersections, so it is in $\sigma(\mathcal{F})$. There are finitely many atoms, so every union of atoms is a finite union of members of $\sigma(\mathcal{F})$.
$\mathcal{U}$ is a σ-algebra. The atoms split $X$ into disjoint pieces. $X$ is the union of all of them. The complement of a union of some atoms is the union of the others. A union of unions of atoms is a union of atoms.
$\mathcal{F} \subseteq \mathcal{U}$. Each atom lies inside $F_i$ or misses it entirely (its points all agree on $F_i$), so $F_i$ is the union of the atoms inside it. By the proposition, $\sigma(\mathcal{F}) \subseteq \mathcal{U}$.
So $\sigma(\mathcal{F}) = \mathcal{U}$. The atoms are nonempty and disjoint, so different choices of atoms give different unions, and there are $2^k$ choices. $\blacksquare$
Let's run the theorem on a concrete pair of generators.
Let $X = \{1, 2, 3, 4, 5, 6\}$ and $\mathcal{F} = \{F_1, F_2\}$ with $F_1 = \{1, 2, 3\}$ and $F_2 = \{3, 4\}$. Find the atoms of $\sigma(\mathcal{F})$ and count its members.
Sort the points by the two questions "in $F_1$?" and "in $F_2$?":
That's $4$ atoms, so $\sigma(\mathcal{F})$ has $2^4 = 16$ members. For instance $\{1, 2, 5, 6\} = F_2^c$ and $\{3, 5, 6\} = \{3\} \cup \{5, 6\}$ are in it.
Here is that same example building itself, one rule at a time.
Complements came first, then intersections cut out the atoms, and then the unions filled in the rest. The count comes from the atoms. Now generate your own; the missions get harder.
The last mission is the surprising one. Each generator asks every point one yes-or-no question, and a point's atom is its list of answers. With three generators there are only $2^3 = 8$ possible lists, so three generators can split six points completely, but only if you use them like binary digits. Count one yourself: find the atoms first, and the count is free.
Loading practice engine...
Counting is one thing. Now pick out $\sigma(\mathcal{F})$ itself, set by set. The first step is the same: find the atoms.
Loading practice engine...
Finite sets are where you build intuition, but the σ-algebra that matters most is the one generated by a topology.
Let $(X, \tau)$ be a topological space. The Borel σ-algebra of $X$ is $\mathcal{B}(X) = \sigma(\tau)$, the σ-algebra generated by the open sets. Its members are the Borel sets of $X$.
So every open set is Borel, and so is everything you can build from open sets with complements, countable unions, and countable intersections. That's a lot of sets.
Show that every closed set, every single point, the rationals $\mathbb{Q}$, and every half-open interval $[a, b)$ are Borel sets of $\mathbb{R}$.
A closed set is the complement of an open set, so it is Borel. A single point $\{x\}$ is closed. $\mathbb{Q} = \bigcup_{q \in \mathbb{Q}} \{q\}$ is a countable union of points.
For $[a, b)$: a number $x$ is in every interval $\left(a - \frac{1}{n}, b\right)$ exactly when $a - \frac{1}{n} < x < b$ for every $n$, which means $a \le x < b$. So
$$[a, b) = \bigcap_{n=1}^{\infty} \left(a - \tfrac{1}{n}, b\right),$$
a countable intersection of open sets.
That last one deserves a picture: a countable intersection of open sets that isn't open (or closed).
Notice what just happened to the troublemaker from the top of the page: $\mathbb{Q}$ is a Borel set. Hold that thought. Meanwhile, $\mathcal{B}(\mathbb{R})$ was defined from all open sets, but a much smaller family does the job.
Show that $\mathcal{B}(\mathbb{R}) = \sigma(\{(a, \infty) : a \in \mathbb{R}\})$.
Proof. Write $\mathcal{R} = \sigma(\{(a, \infty) : a \in \mathbb{R}\})$. Each ray $(a, \infty)$ is open, so it is in $\mathcal{B}(\mathbb{R})$, and $\mathcal{B}(\mathbb{R})$ is a σ-algebra. By minimality, $\mathcal{R} \subseteq \mathcal{B}(\mathbb{R})$.
For the other inclusion, $\mathcal{R}$ contains $(-\infty, b] = (b, \infty)^c$, then $(-\infty, b) = \bigcup_{n} \left(-\infty, b - \frac{1}{n}\right]$, then $(a, b) = (a, \infty) \cap (-\infty, b)$. Now let $U \subseteq \mathbb{R}$ be open. For each $x \in U$ there are rationals $p < x < q$ with $(p, q) \subseteq U$. There are only countably many intervals with rational endpoints, and the ones inside $U$ cover $U$, so $U$ is a countable union of open intervals and $U \in \mathcal{R}$. So $\mathcal{R}$ is a σ-algebra containing every open set, and by minimality $\mathcal{B}(\mathbb{R}) = \sigma(\tau) \subseteq \mathcal{R}$. $\blacksquare$
Rays generate everything. Remember that: it's the reason one family of sets will be enough to test measurability at the end of the page.
Is every subset of $\mathbb{R}$ a Borel set? No. A counting argument already says so: there are only as many Borel sets as real numbers, and far more subsets of $\mathbb{R}$. Lebesgue Measure builds a set that isn't even Lebesgue measurable, let alone Borel.
Every set I've ever written down turned out to be Borel. Non-Borel sets are like cryptids: everyone agrees they exist, nobody has a clear photo.
So $\mathcal{B}(\mathbb{R})$ is huge but not everything, which is exactly the right size. Time to put functions on top of it.
A topology tells you which functions are continuous. A σ-algebra tells you which functions are measurable, by the same recipe: preimages of open sets have to land in the collection.
Let $(X, \mathcal{M})$ be a measurable space and $(Y, \tau)$ a topological space. A function $f\colon X \to Y$ is measurable if $f^{-1}(U) \in \mathcal{M}$ for every open set $U \subseteq Y$.
When $X$ is a topological space too, its Borel sets are the natural σ-algebra to use, and that case gets its own name.
Let $X$ and $Y$ be topological spaces. A function $f\colon X \to Y$ is Borel measurable if $f^{-1}(U)$ is a Borel set of $X$ for every open set $U \subseteq Y$.
Every continuous map is Borel measurable: if $f$ is continuous, $f^{-1}(U)$ is open, and open sets are Borel. So the measurable functions include all the continuous ones, and many more. Here's what the definition looks like on a small set.
Let $X = \{1, 2, 3, 4\}$ with $\mathcal{M} = \{\emptyset, \{1, 2\}, \{3, 4\}, X\}$. List functions $X \to \mathbb{R}$ by their values $(f(1), f(2), f(3), f(4))$. Is $f = (5, 5, 0, 0)$ measurable? Is $g = (5, 0, 0, 0)$?
For an open $U \subseteq \mathbb{R}$, $f^{-1}(U)$ depends only on which of $5$ and $0$ are in $U$: it is $\emptyset$, $\{1, 2\}$, $\{3, 4\}$, or $X$. All four are in $\mathcal{M}$, so $f$ is measurable.
For $g$, take $U = (4, 6)$. Then $g^{-1}(U) = \{1\}$, which is not in $\mathcal{M}$. So $g$ is not measurable.
See the pattern? $f$ was constant on $\{1, 2\}$ and on $\{3, 4\}$, the atoms of $\mathcal{M}$, and $g$ split the atom $\{1, 2\}$. On a finite set, that's always the test.
Let $X$ be finite and $\mathcal{M} = \sigma(\mathcal{F})$. A function $f\colon X \to \mathbb{R}$ is measurable if and only if $f$ is constant on each atom of $\mathcal{M}$.
Proof. ($\impliedby$) If $f$ is constant on each atom, then for any open $U$, $f^{-1}(U)$ is the union of the atoms on which the value of $f$ lies in $U$. By the theorem on atoms, it is in $\mathcal{M}$.
($\implies$) Suppose $f$ takes two values $v \neq w$ on one atom $A$, with $f(x) = v$ and $f(y) = w$ for $x, y \in A$. $f$ takes only finitely many values, so some open interval $U$ contains $v$ and no other value of $f$. Then $f^{-1}(U) = \{x' \in X : f(x') = v\}$ contains $x$ but not $y$. It cuts the atom $A$, so it is not a union of atoms, and by the theorem on atoms it is not in $\mathcal{M}$. So $f$ is not measurable. $\blacksquare$
Try it with your hands: give each point a value by dropping it in a column, and watch the preimages.
The third mission is the proposition in disguise: points in one atom have to share a value, so a measurable function on a finite set has at most one value per atom. Now spot the measurable one. Find the atoms first.
Loading practice engine...
Back to the troublemaker from the top of the page. Riemann couldn't integrate it. Measurability has no trouble with it at all.
Let $f\colon \mathbb{R} \to \mathbb{R}$ be $1$ at every rational and $0$ at every irrational. Show that $f$ is Borel measurable.
For an open $U \subseteq \mathbb{R}$, $f^{-1}(U)$ depends only on which of $0$ and $1$ are in $U$:
$\mathbb{Q}$ is Borel (we showed it above), and so is its complement. So every preimage is Borel, and $f$ is Borel measurable, even though it isn't continuous anywhere.
Checking every open set is a chore. The first real theorem says you get much more than open sets for free.
Let $(X, \mathcal{M})$ be a measurable space, $(Y, \tau)$ a topological space, and $f\colon X \to Y$. Then $f$ is measurable if and only if $f^{-1}(B) \in \mathcal{M}$ for every Borel set $B$ of $Y$.
Proof. ($\impliedby$) Open sets are Borel sets.
($\implies$) Let $\mathcal{G} = \{E \subseteq Y : f^{-1}(E) \in \mathcal{M}\}$, the "good sets." It is a σ-algebra on $Y$:
Since $f$ is measurable, every open set is in $\mathcal{G}$, so $\tau \subseteq \mathcal{G}$. By minimality, $\mathcal{B}(Y) = \sigma(\tau) \subseteq \mathcal{G}$, which says $f^{-1}(B) \in \mathcal{M}$ for every Borel set $B$. $\blacksquare$
Here is that proof as a picture: three collections of subsets of $Y$, nested inside each other.
That "good sets" trick is the most-used argument in measure theory: collect the sets where a property holds, show they form a σ-algebra, and let minimality do the rest. Its first payoff is that measurability survives composition.
Let $f\colon (X, \mathcal{M}) \to Y$ be measurable, where $Y$ is a topological space.
Proof. (a) Let $U \subseteq Z$ be open. Then $g^{-1}(U)$ is open in $Y$, since $g$ is continuous, so $(g \circ f)^{-1}(U) = f^{-1}(g^{-1}(U)) \in \mathcal{M}$.
(b) Let $U \subseteq Z$ be open. Then $g^{-1}(U)$ is a Borel set of $Y$, and by the theorem, $f^{-1}(g^{-1}(U)) \in \mathcal{M}$. $\blacksquare$
That proposition does a lot of quiet work. For example:
Let $u\colon X \to \mathbb{R}$ be measurable. Show that $u^2$, $|u|$, and $e^{iu}$ are measurable.
Each is $u$ followed by a continuous map: $t \mapsto t^2$ and $t \mapsto |t|$ from $\mathbb{R}$ to $\mathbb{R}$, and $t \mapsto e^{it}$ from $\mathbb{R}$ to $\mathbb{C}$. By part (a), all three are measurable.
The simplest measurable functions just say "in" or "out." They tie measurable sets and measurable functions together.
Let $E \subseteq X$, and let $f\colon X \to \mathbb{R}$ be $1$ on $E$ and $0$ off $E$. Show that $f$ is measurable if and only if $E \in \mathcal{M}$.
Proof. ($\implies$) $\left(\frac{1}{2}, 2\right)$ is open and $f^{-1}\left(\left(\frac{1}{2}, 2\right)\right) = E$, so $E \in \mathcal{M}$.
($\impliedby$) For an open $U$, $f^{-1}(U)$ is $\emptyset$, $E$, $E^c$, or $X$, depending on which of $1$ and $0$ are in $U$. All four are in $\mathcal{M}$. $\blacksquare$
Next, complex-valued functions. A complex function is a pair of real ones, so we need measurability into the plane, and the key fact is that open sets of the plane are countable unions of rectangles.
Every open set $V \subseteq \mathbb{R}^2$ is a countable union of open rectangles $(a, b) \times (c, d)$ with $a, b, c, d \in \mathbb{Q}$.
Proof. There are countably many rectangles with rational corners, since $\mathbb{Q}^4$ is countable. Let $x = (x_1, x_2) \in V$. Because $V$ is open, the open disc of some radius $r > 0$ about $x$ lies in $V$. Choose rationals $a < x_1 < b$ and $c < x_2 < d$ with $b - a < \frac{r}{2}$ and $d - c < \frac{r}{2}$. Every point $y$ of $(a, b) \times (c, d)$ has $|y_1 - x_1| < \frac{r}{2}$ and $|y_2 - x_2| < \frac{r}{2}$, so its distance from $x$ is less than $\frac{r}{\sqrt{2}} < r$. So this rectangle contains $x$ and lies in $V$. Every point of $V$ is in a rational rectangle inside $V$, so $V$ is the union of the rational rectangles inside $V$: a countable union. $\blacksquare$
Here's the lemma as a picture, including the one point that's easy to worry about.
With the lemma, a pair of measurable functions is a measurable function into the plane.
If $u, v\colon X \to \mathbb{R}$ are measurable, then $f\colon X \to \mathbb{R}^2$, $f(x) = (u(x), v(x))$, is measurable.
Proof. For an open rectangle $R = (a, b) \times (c, d)$, $f(x) \in R$ exactly when $u(x) \in (a, b)$ and $v(x) \in (c, d)$, so $f^{-1}(R) = u^{-1}((a, b)) \cap v^{-1}((c, d)) \in \mathcal{M}$. For an open $V \subseteq \mathbb{R}^2$, the lemma writes $V = \bigcup_i R_i$ with countably many rectangles, so $f^{-1}(V) = \bigcup_i f^{-1}(R_i) \in \mathcal{M}$. $\blacksquare$
The whole proof is one picture: a point lands in the rectangle exactly when it lands in both strips.
$\mathbb{C}$ is $\mathbb{R}^2$ with $x + iy$ standing for $(x, y)$, and it has the same open sets. A function $f\colon X \to \mathbb{C}$ is complex measurable when it is measurable for that topology; a measurable $f\colon X \to \mathbb{R}$ is called real measurable. Everything you'd hope for is true.
Proof. (a) Under $\mathbb{C} = \mathbb{R}^2$, $f$ is the map $x \mapsto (u(x), v(x))$, which is measurable by the proposition.
(b) $u$, $v$, and $|f|$ are $f$ followed by $z \mapsto \operatorname{Re} z$, $z \mapsto \operatorname{Im} z$, and $z \mapsto |z|$, which are continuous maps $\mathbb{C} \to \mathbb{R}$. Compositions with continuous maps are measurable.
(c) First the real case. If $s, t\colon X \to \mathbb{R}$ are measurable, then $x \mapsto (s(x), t(x))$ is measurable into $\mathbb{R}^2$, and $(p, q) \mapsto p + q$, $(p, q) \mapsto p - q$, and $(p, q) \mapsto pq$ are continuous. So $s + t$, $s - t$, and $st$ are measurable. Now write $f = u + iv$ and $g = u' + iv'$; by (b), $u, v, u', v'$ are real measurable. Then
$$f + g = (u + u') + i(v + v'),$$
$$fg = (uu' - vv') + i(uv' + vu'),$$
and each real and imaginary part is built from real measurable functions by sums, differences, and products, so it is measurable. By (a), $f + g$ and $fg$ are complex measurable. $\blacksquare$
So measurable functions form a club you can't leave by adding, multiplying, or taking absolute values. Combined with the Borel-preimage theorem, that answers questions about sets, too.
Let $f\colon X \to \mathbb{C}$ be complex measurable. Show that its zero set $\{x \in X : f(x) = 0\}$ is measurable.
By part (b), $|f|$ is real measurable. The zero set is $|f|^{-1}(\{0\})$, and $\{0\}$ is closed, so it is a Borel set of $\mathbb{R}$. By the Borel-preimage theorem, $|f|^{-1}(\{0\}) \in \mathcal{M}$.
The last section adds the infinities to the picture.
On the next page we'll take sups, infs, and limits of sequences of functions, and those can blow up to $\infty$ or $-\infty$. Rather than throw those points away, we add $\infty$ and $-\infty$ to the real line.
The extended real line is $[-\infty, \infty] = \mathbb{R} \cup \{-\infty, \infty\}$, ordered with $-\infty < x < \infty$ for every real $x$, with the topology whose basis is the sets $[-\infty, b)$, $(a, b)$, and $(a, \infty]$ for real $a$ and $b$.
With this topology, $[-\infty, \infty]$ is compact; it behaves like a closed interval. A function into it is measurable when the preimage of every open set is measurable, and checking every open set is a lot of work. The test says the rays are enough. We'll write $\{f > a\}$ for the set $\{x \in X : f(x) > a\}$ from now on.
Let $(X, \mathcal{M})$ be a measurable space and $f\colon X \to [-\infty, \infty]$. Then $f$ is measurable if and only if $\{f > a\} = f^{-1}((a, \infty]) \in \mathcal{M}$ for every $a \in \mathbb{R}$.
Proof. ($\implies$) Each $(a, \infty]$ is open.
($\impliedby$) Suppose every $\{f > a\}$ is in $\mathcal{M}$.
So the preimage of every basic open set is in $\mathcal{M}$. Now let $V \subseteq [-\infty, \infty]$ be open and $x \in V$. Some basic set $W$ has $x \in W \subseteq V$, and we can move its real endpoints inward to rationals and still contain $x$: for $(a, b)$ with $a < x < b$, pick rationals $a < p < x < q < b$; for $[-\infty, b)$, pick a rational $q$ with $x < q < b$; for $(a, \infty]$, pick a rational $p$ with $a < p < x$. So $V$ is the union of the basic sets with rational endpoints that lie inside $V$. There are only countably many of those, so $f^{-1}(V)$ is a countable union of members of $\mathcal{M}$, and $f$ is measurable. $\blacksquare$
Here's the test in motion. As $a$ slides down, $\{f > a\}$ grows from nothing to everything.
For a continuous $f$, every $\{f > a\}$ is open, which is the boring case. The test earns its keep on functions that hit $\infty$.
Use the test on (a) $f(x) = x^2$ on $\mathbb{R}$, and (b) $g\colon \mathbb{R} \to [-\infty, \infty]$ with $g(x) = \frac{1}{x^2}$ for $x \neq 0$ and $g(0) = \infty$. Both use the Borel sets of $\mathbb{R}$.
(a) If $a < 0$, then $\{f > a\} = \mathbb{R}$. If $a \ge 0$, then $x^2 > a$ means $|x| > \sqrt{a}$, so $\{f > a\} = (-\infty, -\sqrt{a}) \cup (\sqrt{a}, \infty)$. Both are open, so Borel, and $f$ is measurable.
(b) $g$ is positive everywhere (and $g(0) = \infty$), so for $a \le 0$, $\{g > a\} = \mathbb{R}$. For $a > 0$ and $x \neq 0$, $\frac{1}{x^2} > a$ means $|x| < \frac{1}{\sqrt{a}}$; and $x = 0$ is in the set too, since $\infty > a$. So $\{g > a\} = \left(-\frac{1}{\sqrt{a}}, \frac{1}{\sqrt{a}}\right)$, which is open. So $g$ is measurable, value $\infty$ and all.
Your turn on the real line. Each version is one function and one level: find the set of $x$ where the graph sits strictly above the level.
Loading practice engine...
On a finite set, the test turns into a hunt: slide $a$ until $\{f > a\}$ cuts an atom. One bad level is enough to sink a function.
Proving a function is measurable took a check in every stretch between its values, and that's a general shortcut worth writing down.
Testing a function on a finite set. $\{f > a\}$ only changes when $a$ passes a value of $f$. So list the values $v_1 < v_2 < \cdots < v_r$; the only sets to check are $\{f \ge v_2\}, \ldots, \{f \ge v_r\}$ (plus $\emptyset$ and $X$, which always pass). The trap: $\{f > a\}$ and $\{f \ge a\}$ are different sets. At $a = v$, the points where $f = v$ are not in $\{f > a\}$.
Your turn to hunt. Any level that fails counts, so when you type an answer, any $a$ that works is right.
Loading practice engine...
One more use of the test, comparing two functions. The trick is to slip a rational number between them.
Let $f, g\colon X \to [-\infty, \infty]$ be measurable. Show that $\{x : f(x) < g(x)\}$ and $\{x : f(x) = g(x)\}$ are measurable.
Proof. If $f(x) < g(x)$ in $[-\infty, \infty]$, there is a rational $r$ with $f(x) < r < g(x)$ (between two different extended reals there is always a real number, and so a rational one). Conversely, such an $r$ forces $f(x) < g(x)$. So
$$\{f < g\} = \bigcup_{r \in \mathbb{Q}} \left(\{f < r\} \cap \{r < g\}\right).$$
Here $\{f < r\} = f^{-1}([-\infty, r))$ and $\{r < g\} = g^{-1}((r, \infty])$ are preimages of open sets, so they are in $\mathcal{M}$, and the union is countable. So $\{f < g\} \in \mathcal{M}$, and by the same argument $\{g < f\} \in \mathcal{M}$. Finally, $\{f = g\} = X \setminus \left(\{f < g\} \cup \{g < f\}\right) \in \mathcal{M}$. $\blacksquare$
That's the toolkit: σ-algebras, the sets they generate, and functions whose preimages land in them. Next page, we take limits of measurable functions and find they stay measurable.
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, a proof from this page with one step missing.
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; a few types need their answer choices, and they'll say so.
Loading practice engine...
Last, the Spicy Bonus. Every σ-algebra on this page was finite or uncountable. That's not a coincidence either.
Prove that no σ-algebra has countably infinitely many members: every infinite σ-algebra is uncountable.
Proof. Suppose $\mathcal{M}$ is an infinite σ-algebra on $X$ that is countable. For $x \in X$, let $A_x = \bigcap \{A \in \mathcal{M} : x \in A\}$. This is a countable intersection of members of $\mathcal{M}$, so $A_x \in \mathcal{M}$, and $x \in A_x$.
Two of these sets are equal or disjoint. First suppose $y \in A_x$. Then $A_x$ is one of the sets intersected to make $A_y$, so $A_y \subseteq A_x$. If $x \notin A_y$, then $A_x \setminus A_y$ is a member of $\mathcal{M}$ containing $x$, so $A_x \subseteq A_x \setminus A_y$; but $y \in A_x$ and $y \in A_y$, a contradiction. So $x \in A_y$, which gives $A_x \subseteq A_y$, and $A_x = A_y$. Now if $A_x$ and $A_y$ share a point $z$, the first case gives $A_z = A_x$ and $A_z = A_y$, so $A_x = A_y$.
Every member is a union of them. If $A \in \mathcal{M}$ and $x \in A$, then $A_x \subseteq A$; so $A = \bigcup_{x \in A} A_x$.
The distinct sets $A_x$ are nonempty, pairwise disjoint members of $\mathcal{M}$, so there are countably many. If there were only $k$ of them, every member of $\mathcal{M}$ would be a union of some of them, and $\mathcal{M}$ would have at most $2^k$ members, which contradicts $\mathcal{M}$ being infinite. So there are infinitely many: list them as $B_1, B_2, B_3, \ldots$. For each $S \subseteq \mathbb{N}$, the union $B_S = \bigcup_{n \in S} B_n$ is a countable union, so $B_S \in \mathcal{M}$. If $S \neq T$, say $n \in S \setminus T$, then the nonempty set $B_n$ lies in $B_S$ and misses $B_T$, so $B_S \neq B_T$. So $S \mapsto B_S$ is one-to-one from $\mathcal{P}(\mathbb{N})$ into $\mathcal{M}$. But $\mathcal{P}(\mathbb{N})$ is uncountable, so $\mathcal{M}$ is uncountable, a contradiction. $\blacksquare$