Discontinuities of a real function
· 5 min read
Let $f\colon\R\to\R$ be a real function. Then, $f$ is continuous at $a$ if and only if for all $\varepsilon>0,$ there exists a $\delta>0$ so that $f(x)f(a)<\varepsilon$ for all $x$ with $xa<\delta.$ Our task today is to investigate the discontinuities of $f,$ i.e. the set $D(f)$ of points at which $f$ is not continuous. Specifically, we want to answer two questions:

What type of set can $D(f)$ be?

Given any set $A,$ is there a function $f$ that is discontinuous exactly on $A$?
Back and forth
We first need to know what it means for $f$ to be discontinuous at a point. By negating the definition of continuity, we can deduce that
$f$ is discontinuous at $a$ if and only if there exists an $\varepsilon>0$ such that for all $\delta>0,$ we have $f(x)f(a)\ge\varepsilon$ for some $x$ with $xa<\delta.$ (*)
The definition should make sense to you: it says that as we zoom in closer to $a,$ the function $f$ stops getting closer to $f(a)$ at some point, instead staying outside a “barrier” around $f(a).$
Given a set $I,$ the oscillation of $f$ on $I$ is
$\omega(f;I)=\sup\{ f(x)f(y)\colon x,y\in I \}.$The geometric meaning of the oscillation is hopefully clear. Note that oscillations are always nonnegative, and if $J$ is a subset of $I,$ then $\omega(f;J)\le\omega(f;I).$ Thus, as $I$ “shrinks” toward $a,$ the oscillation $\omega(f;I)$ decreases to some nonnegative limit. We can now define the oscillation of $f$ at $a$ by
$\omega_f(a) = \lim_{h\to 0^+} \omega(f; (ah,a+h)).$If $\omega(f;I)$ is how much $f$ “jumps” on the set $I,$ then $\omega_f(a)$ is how much $f$ jumps at $a.$ The definition (*) above can be rewritten into
$f$ is discontinuous at $a$ if and only if there exists an $\varepsilon>0$ such that for all $\delta>0,$ we have $\omega_f(x, (a\delta,a+\delta))\ge\varepsilon.$
We can now conclude that $f$ is discontinuous at $a$ if and only if $\omega_f(a)>0.$
Open sesame
The preceding observation allows us to write $D(f)$ as the set of $a$ for which $\omega_f(a)>0.$ We need one final detail.
Lemma. For any $r>0,$ the set $\{a\colon\omega_f(a)< r\}$ is open.
Proof. Given $a$ such that $\omega_f(a)<r,$ there is a bounded interval $I$ containing $a$ such that $\omega(f;I)<r.$ Consequently, $I$ is a subset of $\{a\colon\omega_f(a)< r\},$ since for any $x\in I,$ we have $\omega_f(x)\le\omega(f; I)<r.$ $\square$
With this lemma, we can finally prove a characterization of $D(f).$
Theorem. $D(f)$ is a countable union of closed sets in $\R.$
Proof. The first part of this characterization is easy enough:
$\begin{align*} D(f) &= \{a\colon \omega_f(a) > 0\} \\ &= \bigcup_{n=1}^\infty \{a\colon \omega_f(a)\ge 1/n\}. \end{align*}$The complement of $\{a\colon \omega_f(a)\ge 1/n\}$ is $\{a\colon \omega_f(a)< 1/n\},$ which is open. Thus, $D(f)$ is a countable union of closed sets. $\square$
This result holds in a general metric space. In a topological space, a countable union of closed sets is called an $F_\sigma$ set.^{1} We now know that $D(f)$ is an $F_\sigma$ set, but is every $F_\sigma$ set a $D(f)$ for some $f$?
The imitation game
The answer to the question above is “yes”: any $F_\sigma$ set in $\R$ is the set of discontinuities for some function $f.$ We shall construct $f$ by trying to follow the characterization in our proof of the major theorem in the previous section.
Theorem. If $E$ is an $F_\sigma$ set in $\R,$ there is some $f\colon\R\to\R$ such that $E=D(f).$
Proof. Let $E=\bigcup_{i=1}^\infty F_i,$ where each $F_i$ is closed. Let $E_1=F_1$ and
$E_n = \left(\bigcup_{i=1}^n F_i\right) \setminus \left(\bigcup_{i=1}^{n1} F_i\right).$Note that the $E_n$ are disjoint, $\bigcup_{n=1}^m E_n = \bigcup_{n=1}^m F_n,$ and $\bigcup_{n=1}^\infty E_n = E.$ Each $E_n$ has a countable dense subset $D_n$ (see later). We now define $f$ on $\R$ as follows:
$f(x) = \begin{cases} 0 & x \in \R\setminus E, \\ 2^{n+1} & x \in D_n, \\ 2^{n} & x\in E_n\setminus D_n. \end{cases}$The function is welldefined since $\R\setminus E$ and the $E_n$ are mutually disjoint. We now consider some $x\in\R.$
Suppose $x\in E,$ then $x\in E_n$ for some $n.$ Consider two possibilities:
 If $x\in E_n\setminus D_n,$ then any open interval containing $x$ contains some $y\in D_n,$ as $D_n$ is dense in $E_n,$ in which case we have $f(x)f(y)=2^{n}.$
 If $x\in D_n,$ any open interval containing $x$ contains a point $y$ outside $D_n,$ since $D_n$ is countable. This point $y$ either lies in $E_n\setminus D_n$ (then $f(y)=2^{n}$), or in $\R\setminus E$ (then $f(y)=0$), or in some $E_k$ different from $E_n,$ in which case we can pick another point in $D_k$ instead ($f(y)=2^{k+1}$).
In any case, we can always find a point $y$ in this interval with $f(x)f(y)\ge 2^{n}.$ Altogether, if $x\in E_n,$ then $\omega_f(x)\ge 2^{n}>0,$ so $f$ is discontinuous at $x.$
Suppose $x\in \R\setminus E.$ For all integer $m>0,$ the set $A_m=\bigcup_{n=1}^m E_n=\bigcup_{n=1}^m F_n$ is closed and does not contain $x.$ For any positive integer $N,$ $\R\setminus A_N$ is open, so there is an open interval $(xr,x+r)$ disjoint from $A_N,$ in which case the interval only contains points in $\R\setminus E$ or in $E_k$ with $k>N.$ Hence, for any $y$ with $xy<r,$ we have $f(x)f(y)\le 2^{N},$ and since $N$ is arbitrary, this means the oscillation of $f$ at $x$ is zero. Thus, $f$ is continuous at $x,$ and we conclude $D(f)=E.$ $\square$
There is one detail we need to work out, and that is each $E_n$ has a countable dense subset, i.e. it is separable. Luckily for us, a subset of a separable metric space is always separable, and $\R$ is indeed separable, so $E_n$ is separable too. This detail will be left an exercise for the reader. After that, it should not be difficult to see that this theorem holds for any separable metric space, not just the reals, and the proof is mostly analogous.
To recap, we answer the two questions put forth at the beginning of the post:

What type of set can $D(f)$ be?
It must be a countable union of closed sets; in other words, an $F_\sigma$ set.

Given any set $A,$ is there a function $f$ that is discontinuous exactly on $A$?
In a separable metric space $M,$ for any $F_\sigma$ set, there is a function $f\colon M\to M$ whose $D(f)$ is that set.