# Continuous Functions, Discontinuous Supremum

A function $f:\mathbb{R}\to\mathbb{R}$ is said to be **continuous** if the preimage of any open set is open. Analogously, we might say that a function is **measurable** if the preimage of a measurable set is measurable. This is a generalization of the more standard defintions of a measurable function: "$f:\mathbb{R}\to\mathbb{R}$ is measurable if for any $a\in\mathbb{R}$ the set $f^{-1}((a,\infty))=\{x\in\mathbb{R}:f(x)>a\}$ is measurable," or equivalently, "$f$ is measurable if the preimage of a Borel set is an open set."

It's not hard to show that if $\{f_n:\mathbb{R}\to\mathbb{R}\}$ is a sequence of measurable functions, then $\sup_n f_n$, $\inf_n f_n$, $\limsup_n f_n$ and $\liminf_n f_n$ are *also* measurable functions*. But here the analogy between continuity and measurability breaks down. It is **not** true that if each $f_n$ is a continuous function, then $\sup_n f_n$, $\inf_n f_n$, $\limsup_n f_n$ and $\liminf_n f_n$ are continuous as well.

Below is a counterexample (which is *not* as bad as it looks!) - we have a sequence of functions $\{f_n:[0,1]\to[0,1]\}$, each of which is continuous, yet $\sup_n f_n$ is not!

## (Counter)Example

Fix $x\in [0,1]$. For each $n\in\mathbb{N}$ define

I know this looks like a hot mess! But it's not bad at all. The graph of each $f_n$ consists of the four lines which connect $(0,0)$, $(1/(n+1),0)$, $((2n+1)/(2n(n+1)),1)$, $(1/n,0)$ and $(1,0)$, in that order. Or to put it simply,

- $f_n$ forms a triangle centered at $\frac{2n+1}{2n(n+1)}$ and has a base of width $\frac{1}{n(n+1)}$
- the right base point of $f_{n+1}$ equals the left base point of $f_n$
- $f_n(0)=0$ for all $n$

Here's what the first 3 functions look like:

Let $x\in[0,1]$. Clearly each $f_n$ is continuous. We claim $g(x)=\sup\{f_n(x)\}$ is not. Indeed, for each $k\in\mathbb{N}$ let $$x_k=\frac{2k+1}{2k(k+1)}$$ (the value of $x$ when $f_n$ is at its peak) and observe that $\displaystyle{ \lim_{k\to\infty} x_k=0}$. Assuming to the contrary that $g(x)$ *is* continuous, we must have
$$ \lim_{k\to\infty}g(x_k)=g(0). $$
On the right hand side, we have $g(0)=\sup_n\{f_n(0)\}=0$ since $f_n(0)=0$ for all $n$. But on the left hand side, for a fixed $k\in\mathbb{N}$, we see that $g(x_k)=\sup\{f_n(x_k)\}=1$ since
\begin{align*}
f_n(x_k)=\begin{cases} 1, &\text{if $n=k$}\\
0, &\text{if $n\neq k.$}
\end{cases}
\end{align*}
This implies that
$$ 1= \lim_{k\to\infty}g(x_k)=g(0)=0 $$
which is, of course, a contradiction.

*Footnotes:*

* Here's the proof that $\sup_n f_n$ and $\limsup_n f_n$ are measurable: Fix $a\in\mathbb{R}$ and let $g=\sup f_n$ (i.e. for a fixed $x\in \mathbb{R}$, $g(x)=\sup_n\{f_n(x)\}$). We claim $$g^{-1}((a,\infty])=\bigcup_{n=1}^\infty f_n^{-1}((a,\infty]).$$ If this is true, then indeed the function $g$ is measurable since we can express $g^{-1}((a,\infty])$ as a countable union of measurable sets. To prove the claim, notice that $x\in g^{-1}((a,\infty])$ if and only if $g(x)>a$ if and only if $\sup_n\{f_n(x)\}>a$ if and only if $f_n(x)>a$ for some $n$. And this last bit is true if and only if $x\in \bigcup_{n=1}^\infty f_n^{-1}((a,\infty])$.

To see that $\limsup f_n$ is measurable, suppose we have proved that, for any measurable $f_n$, the function $\inf f_n$ is measurable (the proof is very similar to the previous paragraph). Write $$\limsup f_n=\inf_{n\geq1}\sup_{k\geq n}f_k$$ and let $g_n=\sup_{k\geq n}f_k$. By above, we know each $g_n$ is a measurable function, and so by assumption $\inf_n g_n$ -- and hence $\limsup f_n$ -- is measurable.

By letting $h=\inf f_n$ and claiming $h^{-1}([\infty,a))=\bigcup_{n=1}^\infty f_n^{-1}([-\infty,a))$, one can use similar techniques to show that $\inf f_n$ and $\liminf f_n$ are measurable.