## Oscillation and continuity

Let \(S \subset {\mathbb{R}}^n\) be a set and \(f \colon S \to {\mathbb{R}}\) a function. Instead of just saying that \(f\) is or is not continuous at a point \(x \in S\), we we need to be able to quantify how discontinuous \(f\) is at a function is at \(x\). For any \(\delta > 0\) define the oscillation of \(f\) on the \(\delta\)-ball in subset topology that is \(B_S(x,\delta) = B_{{\mathbb{R}}^n}(x,\delta) \cap S\) as \[o(f,x,\delta) := {\sup_{y \in B_S(x,\delta)} f(y)} - {\inf_{y \in B_S(x,\delta)} f(y)} = \sup_{y_1,y_2 \in B_S(x,\delta)} \bigl(f(y_1)-f(y_2)\bigr) .\] That is, \(o(f,x,\delta)\) is the length of the smallest interval that contains the image \(f\bigl(B_S(x,\delta)\bigr)\). Clearly \(o(f,x,\delta) \geq 0\) and notice \(o(f,x,\delta) \leq o(f,x,\delta')\) whenever \(\delta < \delta'\). Therefore, the limit as \(\delta \to 0\) from the right exists and we define the *oscillation* of a function \(f\) at \(x\) as \[o(f,x) := \lim_{\delta \to 0^+} o(f,x,\delta) = \inf_{\delta > 0} o(f,x,\delta) .\]

\(f \colon S \to {\mathbb{R}}\) is continuous at \(x \in S\) if and only if \(o(f,x) = 0\).

First suppose that \(f\) is continuous at \(x \in S\). Then given any \(\epsilon > 0\), there exists a \(\delta > 0\) such that for \(y \in B_S(x,\delta)\) we have \(\left\lvert {f(x)-f(y)} \right\rvert < \epsilon\). Therefore if \(y_1,y_2 \in B_S(x,\delta)\) then \[f(y_1)-f(y_2) = f(y_1)-f(x)-\bigl(f(y_2)-f(x)\bigr) < \epsilon + \epsilon = 2 \epsilon .\] We take the supremum over \(y_1\) and \(y_2\) \[o(f,x,\delta) = \sup_{y_1,y_2 \in B_S(x,\delta)} \bigl(f(y_1)-f(y_2)\bigr) \leq 2 \epsilon .\] Hence, \(o(x,f) = 0\).

On the other hand suppose that \(o(x,f) = 0\). Given any \(\epsilon > 0\), find a \(\delta > 0\) such that \(o(f,x,\delta) < \epsilon\). If \(y \in B_S(x,\delta)\) then \[\left\lvert {f(x)-f(y)} \right\rvert \leq \sup_{y_1,y_2 \in B_S(x,\delta)} \bigl(f(y_1)-f(y_2)\bigr) = o(f,x,\delta) < \epsilon. \qedhere\]

[prop:seclosed] Let \(S \subset {\mathbb{R}}^n\) be closed, \(f \colon S \to {\mathbb{R}}\), and \(\epsilon > 0\). The set \(\{ x \in S : o(f,x) \geq \epsilon \}\) is closed.

Equivalently we want to show that \(G = \{ x \in S : o(f,x) < \epsilon \}\) is open in the subset topology. As \(\inf_{\delta > 0} o(f,x,\delta) < \epsilon\), find a \(\delta > 0\) such that \[o(f,x,\delta) < \epsilon\] Take any \(\xi \in B_S(x,\nicefrac{\delta}{2})\). Notice that \(B_S(\xi,\nicefrac{\delta}{2}) \subset B_S(x,\delta)\). Therefore, \[o(f,\xi,\nicefrac{\delta}{2}) = \sup_{y_1,y_2 \in B_S(\xi,\nicefrac{\delta}{2})} \bigl(f(y_1)-f(y_2)\bigr) \leq \sup_{y_1,y_2 \in B_S(x,\delta)} \bigl(f(y_1)-f(y_2)\bigr) = o(f,x,\delta) < \epsilon .\] So \(o(f,\xi) < \epsilon\) as well. As this is true for all \(\xi \in B_S(x,\nicefrac{\delta}{2})\) we get that \(G\) is open in the subset topology and \(S \setminus G\) is closed as is claimed.

## The set of Riemann integrable functions

We have seen that continuous functions are Riemann integrable, but we also know that certain kinds of discontinuities are allowed. It turns out that as long as the discontinuities happen on a set of measure zero, the function is integrable and vice versa.

Let \(R \subset {\mathbb{R}}^n\) be a closed rectangle and \(f \colon R \to {\mathbb{R}}\) a bounded function. Then \(f\) is Riemann integrable if and only if the set of discontinuities of \(f\) is of measure zero (a null set).

Let \(S \subset R\) be the set of discontinuities of \(f\). That is \(S = \{ x \in R : o(f,x) > 0 \}\). The trick to this proof is to isolate the bad set into a small set of subrectangles of a partition. There are only finitely many subrectangles of a partition, so we will wish to use compactness. If \(S\) is closed, then it would be compact and we could cover it by small rectangles as it is of measure zero. Unfortunately, in general \(S\) is not closed so we need to work a little harder.

For every \(\epsilon > 0\), define \[S_\epsilon := \{ x \in R : o(f,x) \geq \epsilon \} .\] By \(S_\epsilon\) is closed and as it is a subset of \(R\) which is bounded, \(S_\epsilon\) is compact. Furthermore, \(S_\epsilon \subset S\) and \(S\) is of measure zero. Via there are finitely many open rectangles \(S_1,S_2,\ldots,S_k\) that cover \(S_\epsilon\) and \(\sum V(S_j) < \epsilon\).

The set \(T = R \setminus ( S_1 \cup \cdots \cup S_k )\) is closed, bounded, and therefore compact. Furthermore for \(x \in T\), we have \(o(f,x) < \epsilon\). Hence for each \(x \in T\), there exists a small closed rectangle \(T_x\) with \(x\) in the interior of \(T_x\), such that \[\sup_{y\in T_x} f(y) - \inf_{y\in T_x} f(y) < 2\epsilon.\] The interiors of the rectangles \(T_x\) cover \(T\). As \(T\) is compact there exist finitely many such rectangles \(T_1, T_2, \ldots, T_m\) that covers \(T\).

Now take all the rectangles \(T_1,T_2,\ldots,T_m\) and \(S_1,S_2,\ldots,S_k\) and construct a partition out of their endpoints. That is construct a partition \(P\) with subrectangles \(R_1,R_2,\ldots,R_p\) such that every \(R_j\) is contained in \(T_\ell\) for some \(\ell\) or the closure of \(S_\ell\) for some \(\ell\). Suppose we order the rectangles so that \(R_1,R_2,\ldots,R_q\) are those that are contained in some \(T_\ell\), and \(R_{q+1},R_{q+2},\ldots,R_{p}\) are the rest. In particular, we have \[\sum_{j=1}^q V(R_j) \leq V(R) \qquad \text{and} \qquad \sum_{j=q+1}^p V(R_j) \leq \epsilon .\] Let \(m_j\) and \(M_j\) be the inf and sup over \(R_j\) as before. If \(R_j \subset T_\ell\) for some \(\ell\), then \((M_j-m_j) < 2 \epsilon\). Let \(B \in {\mathbb{R}}\) be such that \(\left\lvert {f(x)} \right\rvert \leq B\) for all \(x \in R\), so \((M_j-m_j) < 2B\) over all rectangles. Then \[\begin{split} U(P,f)-L(P,f) & = \sum_{j=1}^p (M_j-m_j) V(R_j) \\ & = \left( \sum_{j=1}^q (M_j-m_j) V(R_j) \right) + \left( \sum_{j=q+1}^p (M_j-m_j) V(R_j) \right) \\ & \leq \left( \sum_{j=1}^q 2\epsilon V(R_j) \right) + \left( \sum_{j=q+1}^p 2 B V(R_j) \right) \\ & \leq 2 \epsilon V(R) + 2B \epsilon = \epsilon (2V(R)+2B) . \end{split}\] Clearly, we can make the right hand side as small as we want and hence \(f\) is integrable.

For the other direction, suppose that \(f\) is Riemann integrable over \(R\). Let \(S\) be the set of discontinuities again and now let \[S_k := \{ x \in R : o(f,x) \geq \nicefrac{1}{k} \}.\] Fix a \(k \in {\mathbb{N}}\). Given an \(\epsilon > 0\), find a partition \(P\) with subrectangles \(R_1,R_2,\ldots,R_p\) such that \[U(P,f)-L(P,f) = \sum_{j=1}^p (M_j-m_j) V(R_j) < \epsilon\] Suppose that \(R_1,R_2,\ldots,R_p\) are order so that the interiors of \(R_1,R_2,\ldots,R_{q}\) intersect \(S_k\), while the interiors of \(R_{q+1},R_{q+2},\ldots,R_p\) are disjoint from \(S_k\). If \(x \in R_j \cap S_k\) and \(x\) is in the interior of \(R_j\) so sufficiently small balls are completely inside \(R_j\), then by definition of \(S_k\) we have \(M_j-m_j \geq \nicefrac{1}{k}\). Then \[\epsilon > \sum_{j=1}^p (M_j-m_j) V(R_j) \geq \sum_{j=1}^q (M_j-m_j) V(R_j) \geq \frac{1}{k} \sum_{j=1}^q V(R_j)\] In other words \(\sum_{j=1}^q V(R_j) < k \epsilon\). Let \(G\) be the set of all boundaries of all the subrectangles of \(P\). The set \(G\) is of measure zero (see ). Let \(R_j^\circ\) denote the interior of \(R_j\), then \[S_k \subset R_1^\circ \cup R_2^\circ \cup \cdots \cup R_q^\circ \cup G .\] As \(G\) can be covered by open rectangles arbitrarily small volume, \(S_k\) must be of measure zero. As \[S = \bigcup_{k=1}^\infty S_k\] and a countable union of measure zero sets is of measure zero, \(S\) is of measure zero.