# The Amazing Baire Category Theorem

One of the most fundamental theorems in mathematics is the famous Baire category theorem, which never ceases to amaze me. If you are a modern analysis enthusiast like me you probably know the feeling when you are working on a seemingly difficult problem and the solution appears to elude you every time you think about it, and then all of a sudden, snap! “Oh, I can just use the Baire category theorem.”

This post is dedicated to this feeling.

The Baire category theorem. Let’s waste no time and jump into the heart of the matter right away.

Theorem 1. (Baire) Let $X$ be a complete metric space and let $\{ U_n \}_{n = 1}^{\infty}$ be a collection of open and dense subsets of $X$. Then $U = \cap_{n=1}^{\infty} U_n$ is dense in $X$.

Proof. Let $x_0 \in X$ be an arbitrary element and let $B(x_0,r_0)$ be the open ball with radius $r_0$ and center $x_0$. (In general, we denote $B(x,r) = \{ y \in X: d(x,y) < r \}$.) It is enough to show that $U$ has an element in $B$, since this implies that $U$ is dense in $X$. Since

$U_1$ is dense in $X$, it has a point $x_1$ in $B(x_0, r_0)$, that is $U_1 \cap B(x_0,r_0)$ is nonempty.

$U_1 \cap B(x_0,r_0)$ is an open set, therefore there exists an $r_1 < 1$ such that $B(x_1, r_1) \subseteq U_1 \cap B(x_0,r_0)$. Just like before, since

$U_2$ is dense in $X$, it has a point $x_2$ in $B(x_1, r_1)$, that is $U_1 \cap B(x_1,r_1)$ is nonempty.

$U_2 \cap B(x_1, r_2)$ is again an open set, thus there exists an $r_2 < 1/2$ such that $B(x_2,r_2) \subseteq U_2 \cap B(x_1,r_1)$. We can repeat this process ad infinitum, obtaining a sequence of elements $\{x_n\}_{n=1}^{\infty}$ and a sequence of balls $B(x_n, r_n)$ such that $r_n < 1/n$, $x_{n+1} \in B(x_n, r_n)$ and $B(x_{n+1}, r_{n+1}) \subseteq B(x_n, r_n)$. These properties implies that

$d(x_l, x_k) \leq 2/n$ holds for all $l, k \geq m$,

or in other words, $\{ x_n\}_{n=1}^{\infty}$ is a Cauchy sequence. Our metric space $X$ is complete, therefore it converges to some $x \in X$. Due to its construction, $x \in U \cap B(x_0,r_0)$, where $U = \cap_{n=1}^{\infty} U_n$, and this is what we had to show. $\Box$

This seemingly innocent theorem gives an immensely powerful tool in mathematics. One of its first corollary, also known as Baire category theorem, is an interesting theorem about the structure of complete metric spaces. To state this, we shall need a few definitions.

Definition. Let $E \subset X$ be a subset of the topological space $X$.
(i)  $E$ is nowhere dense if its closure $cl(E)$ contains no nonempty open subset of $X$.
(ii) $E$ is a set of the first category (or a meagre set) if it is a countable union of nowhere dense sets.
(iii) $E$ is a set of the second category if it is not of the first category.

Let’s see some examples first.

Example. (i) In the complete metric space $\mathbb{R}$, the famous Cantor set $C$ is a nowhere dense set, hence it is of the first category. Generalized Cantor sets of positive measure are still nowhere dense.
(ii) The set of rational numbers $\mathbb{Q}$ in $\mathbb{R}$ is of the first category, since it is a countable union of singletons. It is a set of measure zero, which along with the previous example, hints us that measure and category are not very related.

Corollary 1. Let $X$ be a complete metric space. Then $X$ is a set of the second category.

Proof. Suppose that $\{ E_n\}_{n=1}^{\infty}$ is a sequence of sets of the first category and assume indirectly that $\cup_{n=1}^{\infty} E_n = X$. Then $X \setminus cl(E_n)$ is an open and dense set (where $cl(E)$ denotes the closure of $E$). But $\cap_{n=1}^{\infty} X \setminus cl(E_n) = \emptyset$, which is clearly impossible according to Baire’s theorem. $\Box$

This corollary gives us an another interesting example continuing from example (ii).
Example. (iii) The set of irrational numbers $\mathbb{R} \setminus \mathbb{Q}$ is a set of the second category, since $\mathbb{Q} \cup (\mathbb{R} \setminus \mathbb{Q}) = \mathbb{R}$, which is a complete metric space.

Now let’s see some interesting applications of the Baire category theorem. First we study strangely behaving functions, not so strangely behaving functions and finally a classical theorem from functional analysis.

Nowhere differentiable everywhere continuous functions. A few hundred years ago, mathematicians did not thought about functions as the way we do. The calculus of Newton and Leibniz have brought the rise of differential equations, which played a crucial role in the development of mathematics. Physicists and mathematicians have studied celestial mechanics and all sorts of dynamical systems, where everything was beautiful and infinitely many times differentiable. However, the rise of real analysis brought some, at least at that time, very weird functions. Nowhere continuous functions. Everywhere continuous but nowhere differentiable functions. Functions continuous only at the irrationals. Not everyone were pleased with this, for example the famous Charles Hermite said straight out that

I turn away with fright and horror from this lamentable evil of functions which do not have derivatives.

A few years after Hermite’s time, it turned out that basically most continuous functions are nowhere differentiable. The following theorem with its proof is due to Banach.

Theorem 2. (Banach) Let $(C([0,1]), | \cdot |_\infty)$ be the Banach space of continuous functions with the supremum norm. Then the set

$E = \{ f \in C([0,1]): f \text{ has a finite right-sided derivative at least in one point}\}$

is a set of the first category in $C([0,1])$.

Proof. Define the set

$E_n = \{ f \in C([0,1]) | \exists x \in [0,1-1/n]: |f(x) - f(x + h)| \leq n h \text{ }\forall h \in (0,1-x) \}$.

It is clear that $E \subseteq \cup_{n=1}^{\infty} E_n$. (This union is actually way larger than the class of continuous functions posessing a finite right-sided derivative somewhere.) All we have to show that $E_n$ is nowhere dense, which will imply that $E$ is of the first category. To do this, first we show that $E_n$ is closed and then we will see that it does not contain nonempty open sets.

$E_n$ is closed: Let $\{ f_k \}_{k=1}^{\infty} subset E_n$ be a convergent sequence, assume that it converges to some $f \in C([0,1])$. Our goal is to show that $f \in E_n$ holds. $f_k \in E_n$ means that there is an $x_k \in [0,1-1/n]$ such that

$|f(x_k) - f(x_k + h)| \leq n h$

holds for all $h \in (0,1 - x_k)$. By replacing $\{ f_k \}$ with a subsequence if necessary, we can assume that $x_k to x$ for some $x \in [0,1-1/n]$. This way, we have

$|f(x) - f(x+h)| \leq |f(x) - f_k(x)| + |f_k(x) - f_k(x_k)|$

$+ |f_k(x_k) - f_k(x_k + h)| + |f_k(x_k + h) - f_k(x + h)|$

$+ |f_k(x+h) - f(x + h)|$.

This means that for every $\epsilon > 0$, we have

$|f(x) - f(x + h)| \leq n h + \epsilon$

if $k$ is large enough. Since $\epsilon$ was arbitrary, this implies that $f \in E_n$ , therefore $E_n$ is closed.

There is no nonempty open set in $E_n$: Let $f \in C([0,1])$ and let $\epsilon > 0$ be arbitrary. We will show that there is a $g \in C([0,1]) \setminus E_n$ such that $| f - g |_\infty < \epsilon$. Since every continuous function can be approximated with a piecewise linear continuous function with arbitrary precision, we can find such a function $l(x)$ such that $| f - l |_\infty < \epsilon /2$. Suppose that $M$ is the maximum absolute value of the slopes of $l(x)$.

Now define the so-called tent function $\phi(x) = \min\{ x - \lfloor x \rfloor, 1 - x + \lfloor x \rfloor \}$, where $\lfloor x \rfloor$ denotes the lower integer part of $x$.

By scaling the tent function, we obtain rapidly oscillating functions taking arbitrarily small value.

Adding a properly scaled tent function to our piecewise linear function $l(x)$ will result in a function which is continuous, still close to $f(x)$ but its right-hand differences can be arbitrary large. To make this argument more precise, let $m \in \mathbb{N}$ be an integer so large such that

$\epsilon m > 2(n + M)$,

where $M$ is the maximum absolute value of the one-sided derivatives of $l$, and define

$g(x) = l(x) + \frac{\epsilon}{2} \phi(m x)$.

It is easy to see that $| f - g |_\infty < \epsilon$ and $g in C([0,1]) \setminus E_n$.

Now we have that $E_n$ is nowhere dense, therefore $E \subseteq \cup_{n=1}^{\infty} E_n$ is of the first category, and this is what we had to show. $\Box$

Since $(C([0,1]), | \cdot |_\infty)$ is a complete metric space, it follows that there exists a nowhere differentiable everywhere continuous function. Banach’s theorem is one of the simplest method to show an existence of such function, moreover it shows not only existence, it also gives that differentiable functions are in the minority among continuous functions.

Explicit examples were given by Weierstrass. Let $0 < a 1 + 3\pi/2$. Then the function

$f(x) = \sum_{n=0}^{\infty} a^n \cos (b^n \pi x)$

is everywhere continuous but nowhere differentiable.

Continuity set of functions. Let $f: \mathbb{R} \to \mathbb{R}$ be a real function. We have seen some interesting examples regarding the connection of continuity and differentiability, and now we shall study the set of continuity. There exists nowhere continuous functions, for example the famous Dirichlet function defined as

$D(x) = \begin{cases} 1 & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q} \end{cases}$

Another famous example is the Thomae function (which is also attributed to Riemann sometimes) defined as

$T(x) = \begin{cases} 1 & \text{if } x = 0 \\ 1/q & \text{if } x = p/q \in \mathbb{Q}, \text{ } \gcd(p,q) = 1 \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}. \end{cases}$

Considering the properties of the rational numbers it is easy to see that Thomae’s function is discontinuous at the rationals and continuous at the irrationals. The question is, is there a function which is continuous only at the rationals?

To give a description of the continuity set of a function, we need to introduce two classes of sets.

Definition. Let $X$ be a topological space and let $E$ be a subset of $X$.
(i) $E$ is called a $G_\delta$ set, if it is the countable intersection of open sets.
(ii) $E$ is called an $F_\sigma$ set, if it is the countable union of closed sets.

Example. (i) The set of rationals is an $F_\sigma$ set, since it is the countable union of singleton sets.
(ii) The set of irrationals is a $G_\delta$ set, since $\mathbb{R} \setminus \mathbb{Q} = \cap_{x \in \mathbb{Q}} \Big( (-\infty,x) \cup (x, \infty) \Big)$.

Theorem 3. Let $f: \mathbb{R} \to \mathbb{R}$ be a real function. Then the set

$C_f = \{ x \in \mathbb{R}: f \text{ is continuous at } x \}$

is a $G_\delta$ subset of the real line.

Proof. Define the function

$\omega_f(x_0) = \lim_{\delta \to 0} \Big(\sup_{x \in (x_0-\delta, x_0 + \delta)} f(x) - \inf_{x \in (x_0-\delta, x_0 + \delta)} f(x) \Big)$.

We call $\omega_f$ the oscillation of $f$. It is easy to see that for every $\epsilon > 0$, the set

$\{ x: \omega_f(x) < \epsilon \}$

is open. Moreover, it is also easy to see that

$C_f = \cap_{n=1}^{\infty} \{ x: \omega_f(x) < 1/n \}$,

which gives us that the continuity set $C_f$ is indeed a $G_\delta$ set. $\Box$

The Baire category theorem gives that the set of rationals is not a $G_\delta$ set. Indeed if it were, it would follow that the set of irrationals is an $F_\sigma$ set, that is $\mathbb{R} \setminus \mathbb{Q} = \cup_{n=1}^{\infty} E_n$ where each $E_n$ is closed. This implies that

$\mathbb{R} = \mathbb{Q} \cup E_1 \cup E_2 \cup \dots$

from which, since $\mathbb{Q}$ is of the first category, the Baire category theorem gives that at least one of the $E_n$‘s contains a nonempty open set but this is impossible, because their union is the set of irrationals.

This gives that there is no function which is continuous only at the rationals. The converse of Theorem 3 is also true, that is for every $G_\delta$ set there is a function which is continuous only at that set.

Limits of continuous functions. If $\{ f_n\}_{n=1}^{\infty}$ is a pointwise convergent sequence of continuous functions with $\lim_{n to \infty} f_n(x) = f(x)$, then $f$ need not be continuous, as the example $f_n : [-1,1] \to \mathbb{R}, text{ } f_n(x) = (1-x^2)^n$ shows. In this case,

$\lim_{n to \infty} f_n(x) = \begin{cases} 1 & text{if } x=0 \\ 0 & \text{otherwise} \end{cases}$

which, albeit not continuous at $0$, not very wild. What can we say about pointwise limits of continuous functions? For René-Louis Baire, study of such functions was the principal motivation for the famous Baire category theorem. He introduced categories of functions which we now call Baire-$\omega$ categories. On a complete metric space the Baire-0 functions are the continuous functions, the Baire-1 functions are the functions which can be obtained as the pointwise limits of continuous functions, the Baire-2 functions are the functions which can be obtained as the pointwise limit of Baire-1 functions and it goes like this ad infinitum. (To be more precise, it goes way beyond ad infinitum, but this is not our concern now.)

Theorem 4. Let $f_n: \mathbb{R} \to \mathbb{R}$ be a pointwise convergent sequence of continuous functions with limit $f(x) = \lim_{n \to \infty} f_n(x)$. Then the discontinuity set of $f$

$D_f = \{ x: f \text{ is not continuous at } x \}$

is a set of the first category.

Proof. Let $\epsilon > 0$ and define the sets

$F_\epsilon = \{ x: \omega(x) \geq 5 \epsilon \}$.

Since $D_f = \cup_{n=1}^{infty} F_{1/n}$, it is enough to show that $F_\epsilon$ is nowhere dense. $F_\epsilon$ is closed, therefore we need to show that if $I$ is a closed interval of the real line, then $I \cap (\mathbb{R} \setminus F_\epsilon)$ is nonempty. To do this, define the sets

$E_n = \cap_{i,j \geq n} \{ x: |f_i(x) - f_j(x)| \geq \epsilon \}$.

Since its complement is open, $E_n$ is closed and since the sequence of functions $f_n$ converges pointwise, $\mathbb{R} = cup_{n=1}^{\infty} E_n$. If $I$ is a closed interval on the real line, then, since $I = \cup_{n=1}^{\infty} (E_n \cap I)$, the Baire category theorem implies that there is an $n_0$ such that $E_{n_0} \cap I$ contains an open interval $J$. This means that

$|f_i(x) - f_j(x)| \leq \epsilon$

holds for all $x \in J$, which by letting $i \to \infty$ and selecting $j = n$ yields that $|f(x) - f_n(x)| \leq \epsilon$ on $J$. For every $x_0 \in J$, the continuity of $f_n$ implies that if $x$ is close enough to $x_0$, we have

$|f_n(x_0) - f_n(x)| \leq \epsilon$.

Using the triangle inequality, this implies that $\omega_f(x_0) \leq 4 epsilon$, that is $x_0 \in I \cap (\mathbb{R} \setminus F_\epsilon)$, and this is what we had to show. $\Box$

This theorem also shows that the Dirichlet function

$D(x) = \begin{cases} 1 & \text{if } x in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q} \end{cases}$

cannot be obtained as the pointwise limit of continuous functions. However, as the formula

$D(x) = \lim_{m \to \infty} \Big( \lim_{n to \infty} (\cos(m! \pi x))^{2n} \Big)$

shows, it can be obtained as the pointwise limit of Baire-1 functions, hence it is a Baire-2 function.

Zero derivatives. It is easy to see that if $f: \mathbb{C} \to \mathbb{C}$ is a polynomial, then its derivatives of sufficiently high order are zero. The Baire category theorem gives a surprising and simple converse.

Proposition 1. Let $f: \mathbb{C} \to \mathbb{C}$ be an entire function and suppose that for every $a \in \mathbb{C}$ there is an $n$ (depending from $a$) such that $f^{(n)}(a) = 0$, where $f^{(n)}$ denotes the $n$-th derivative of $f$. Then $f$ is a polynomial.

Proof. Define the sets

$E_n = \{ z \in \mathbb{C}: f^{(n)}(z) = 0 \}$.

Since $\mathbb{C} = \cup_{n=1}^{\infty} E_n$ is a complete metric space, the Baire category theorem implies that for some $n_0$ the set $E_{n_0}$ contains a nonempty open set $U$. That is, $f^{(n_0)}(z) = 0$ for all $z \in U$, which, since $f(z)$ is entire, implies that $f$ is a polynomial of degree at most $n_0$. $\Box$

What if we study infinitely many times differentiable real functions $f: \mathbb{R} to \mathbb{R}$? The proof what we have just seen fails, because on the real line the class of analytic functions and the class of infinitely many times differentiable functions is not the same. Most importantly, if two infinitely many times differentiable functions coincide on some open set, they are not necessarily the same. However, the real version of Proposition 1 holds.

Theorem 5. Let $f: \mathbb{R} \to \mathbb{R}$ be an infinitely many times differentiable function and suppose that for every $a \in \mathbb{R}$ there is an $n$ (depending from $a$) such that $f^{(n)}(a) = 0$. Then $f$ is a polynomial. $\Box$

The principle of uniform boundedness. Functional analysis has three fundamental theorems, whose importance can not be overstated. These are the Banach-Steinhaus theorem, the open mapping theorem and the Hahn-Banach theorem. In a traditional functional analysis course the first two is done with the aid of the Baire category theorem. We shall see the Banach-Steinhaus theorem (a.k.a. the uniform boundedness principle) now.

Theorem 6. (Banach-Steinhaus) Let $X$ be a Banach space and let $Y$ be a normed vector space. Let $\{ T_\gamma \}_{\gamma \in \Gamma}$ be a collection of bounded linear transformations $T_\gamma : X \to Y$, where $\Gamma$ is an arbitrary set. Then either there exists an $M \in \mathbb{R}$ such that

$\sup_{\gamma \in \Gamma} | T_\gamma | \leq M$,

or there is a dense set $E \subseteq X$ such that

$sup_{\gamma \in \Gamma} | T_\gamma x | = \infty$

holds for all $x \in E$.

Proof. Suppose that the collection of transformations is not uniformly bounded in norm and define the set

$E = \{ x \in X: \sup_{\gamma \in \Gamma} | T_\gamma x | = \infty \}$.

Our goal is to show that this set is dense in our metric space. In order to do that, let

$E_n = \{ x \in X: \sup_{\gamma \in \Gamma} | T_\gamma x | > n \}$.

Since $\cap_{n=1}^{\infty} E_n = E$, it is enough to show that $E_n$ is open and dense, from which the Baire theorem implies the denseness of $E$.

$E_n$ is open: Let $x_0 \in E_n$. By definition, there is a $\gamma_0 in \Gamma$ such that $| T_{\gamma_0} x_0 | > n$. Since the function $x \to | T_{\gamma_0} x |$ is continuous, for every $\epsilon > 0$ there is a $\delta > 0$ such that

$| T_{\gamma_0} x| > | T_{\gamma_0} x_0 | - \varepsilon > n$

holds for all $x \in B(x_0, \delta)$ if $\epsilon > 0$ is small enough, which implies the openness of $E_n$.
(Or, to summarize this reasoning in a more compact way, we can just say that “the supremum of continuous functions is lower semicontinuous”.)

$E_n$ is dense in $X$: Let $x in X$ be arbitrary and let $B(x, r)$ be an open ball containing $x$. We need to show that $E_n \cap B(x, r)$ is nonempty. There are two cases.
(i) If $\sup_{\gamma \in \Gamma} | T_\gamma x | > n$ holds, then we are done.
(ii) If not, then, since $sup_{\gamma in \Gamma} | T_\gamma | = \infty$, there is a $\gamma_0$ and an $x_0$, such that $| x_0 | < r/2$ and

$| T_{\gamma_0} x_0 |/| x_0 | > 4n/r$.

This implies that $| T_{\gamma_0} x_0 | > 2n$, but then the reverse triangle inequality implies

$| T_{\gamma_0}(x + x_0) | \geq \Big| | T_{\gamma_0}x| - | T_{\gamma_0}x_0 | \Big| > n$.

Therefore $x + x_0 \in B(x, r) \cap E_n$, which, since $x$ and $r$ were arbitrary, implies that $E_n$ is dense in $X$, and this is what we had to show. $\Box$

It is worth to note that the Banach-Steinhaus theorem basically says that a collection of transformations behaves in an extreme way regarding their bound. Either they are uniformly bounded or they are very much unbounded.

Bibliography.
[1] John C. Oxtoby, Measure and Category, second edition, Springer-Verlag, 1980
[2] Walter Rudin, Real and Complex Analysis, third edition, McGraw-Hill, 1987