# Continuous function with finitely many discontinuities is Riemann Integral

After a lecture today, I just wanted to confirm that I understand the proof of the following:
If $f: [a,b] \to \mathbb{R}$ is bounded and continuous and has finitely many discontinuities, $f \in \mathscr{R}$.

Proof:
Let $\{x_1,\ldots x_l\}$ be the set of discontinuities of $f$. Let $\epsilon > 0$. Let $M$ be such that $|f| \leq M$. Let $\delta > 0$ be such that $2(k+2)M\delta < \frac{\epsilon}{2}$. Now, consider the interval $$B= [a,b] \setminus \left( (x_1-\delta, x_1 + \delta) \cup (x_2-\delta, x_2+\delta) \cup \cdots \cup (x_k-\delta, x_k+\delta) \right),$$ clearly $B$ is compact by Heine-Borel. Thus, $f|B :B \to \mathbb{R}$ is uniformly continuous. Thus, there exists $\delta > 0$ so that, if $|x-y| < \delta$, $|f(x) - f(y)| < \frac{\epsilon}{2(b-a)}$. Now, let $n$ be a positive integer such that $\frac{b-a}{n} < \delta$. Consider the partition $$P:= \left\{a=x_0, a+\frac{x_1-\delta-a}{n}, a+2\frac{x_1-\delta}{n}, \ldots x_1- \delta, x_1+\delta, \ldots, x_k+\delta , x_k+\delta+\frac{b-(x_k+\delta)}{n}, \ldots, b \right\}$$ That is, we have two types of intervals. One type is of the form $[x_i - \delta, x_i+\delta]$ while we chop what is between $x_i+\delta$ and $x_{i+1} - \delta$ into $n$ parts. Now here's where I get a bit confused. I suppose we chop this middle piece up even further, although I'm not sure why. Consider the intervals

$$D_i = \left[x_i+\delta+m\left(\frac{x_{i+1} - x_i -2\delta}{n}\right), x_i+\delta+(m+1)\left(\frac{x_{i+1} - x_i -2\delta}{n}\right)\right]$$

Call $\frac{x_{i+1} - x_i -2\delta}{n} =T$. Then, if $y_1,y_2 \in D_k$, then $$|y_1-y_2| \leq T \leq \frac{b-a}{n} < \delta$$.

so that if $y_1,y_2 \in D_i$, the uniform continuity condition holds.

Now, for any $y \in D_i$, $f(y) = f(y) - f(y_1) + f(y_1)$ so that $f(y) \leq \frac{\epsilon}{2(b-a)} + f(y_1)$ for all $y \in D_i$. Thus, $$\sup_{x \in D_i} f(x) \leq \frac{\epsilon}{2(b-a)} + f(y_1)$$ and $$\inf_{x \in D_k} f(x) \geq -\frac{\epsilon}{2(b-a)} + f(y_1)$$. Thus, $$\sup_{x \in D_i} f(x)- \inf_{x \in D_k} f(x) \leq \frac{\epsilon}{(b-a)}.$$ Now, we need show that $U(f,P) - L(f,P) < \epsilon$. Let $M_i = \sup_{x \in \Delta_i} f(x)$ and $m_i$ similarly. We have that

\begin{align} U(f,P) - L(f,P) &= \sum_{P} (M_i-m_i)\Delta_i \\ &= \sum_{[x_i-\delta,x_i+\delta]} (M_i-m_i)\Delta_i + \sum_{D_i} (M_i-m_i)\Delta_i \\&\leq \sum_{[x_i-\delta,x_i+\delta]} 4M\delta + \sum_{D_i} \frac{\epsilon}{(b-a)}\frac{b-a}{n} \\&= 4Mk\delta + (k+1)n\frac{\epsilon}{n} \\&< \epsilon \end{align}

Thus, $f \in \mathscr{R}$.

Now, this proof seems a bit mathemagical to me. I understand that it works, just not why. I see that we construct little intervals around the discontinuities in order to "ignore" them, but I don't see, for example, why we need to create the $D_i$ intervals. Why do we need to chop the interval between the $x_i+\delta$ and $x_{i+1} -\delta$ into $n$ pieces. Why can't we just consider the middle and only the middle? Any insight to the intuition would be greatly appreciated.

It is perhaps easiest to consider the case where $f$ has exactly one discontinuity, say at $x_0 \in (a,b)$. Fix $\epsilon > 0, \delta > 0$ with $\delta$ to be chosen later.
Since $f\lvert_{[a,x_0]}$ is Riemann integrable, there is a partition $P_1$ of $[a,x_0-\delta]$ such that $$U(f,P_1) - L(f,P_1) < \epsilon$$ Similarly, there is a partition $P_2$ of $[x_0+\delta,b]$ such that $$U(f,P_2) - L(f,P_2) < \epsilon$$ Now one would hope that $P:= P_1\cup P_2\cup\{[x_0-\delta,x_0+\delta]\}$ would be a partition of $[a,b]$ which would satisfy $$U(f,P) - L(f,P) < \epsilon \qquad (\ast)$$ Of course, the problem is, one needs to control the term contributed by $[x_0-\delta,x_0+\delta]$. Since $f$ is discontinuous at $x_0$, you cannot control the max and min on this interval, so you just control the width of the interval. ie. If $M > 0$ is such that $|f| \leq M$ on $[a,b]$, then you choose $\delta > 0$ such that $$4M\delta < \epsilon$$ Then, if $M_0$ and $m_0$ denote the $\sup$ and $\inf$ of $f$ over the interval $[x_0-\delta,x_0+\delta]$, then you have $$(M_0 - m_0)(x_0+\delta - (x_0-\delta)) \leq 4M\delta < \epsilon$$ Now you should get $(\ast)$ (with perhaps a $3\epsilon$ instead of $\epsilon$).
• Ahhh, this is rather helpful. So we're 'cheating' by not knowing what values $f$ takes on in the little $2\delta$ interval around $x_0$, but clearly it must remain bounded. This makes sense. What is still odd to me, is the chopping of the interval between the discontinuities into $n$ parts and then looking at each of the $n$ parts, and why this is necessary. – Anthony Peter Apr 2 '15 at 4:18
• The "chopping into $n$ parts" is to just ensure that we can use uniform continuity on each piece - ie. if a piece $[x_i,x_{i+1}]$ has small enough length, then one can control the $M_i - m_i$ term. This is just re-proving the fact that a uniformly continuous function is Riemann integrable. – Prahlad Vaidyanathan Apr 2 '15 at 4:37
Same idea as Prahlad's, here it is anyway: Suppose $|f|\le M$ on $[a,b]$ and $f$ is continuous on $(a,b).$ Suppose $\epsilon>0$ is small. Then $f$ is continuous on $[a+\epsilon,b-\epsilon],$ hence is Riemann integrable (RI) there. So we can partition that interval so that the upper minus lower sum wrt to that partition is $<\epsilon.$ Now enlarge that partition to include $a,b.$ Wrt to this larger partition, the upper minus lower sum is $<2(2M\epsilon) +\epsilon.$ That shows $f$ is RI on $[a,b].$ If you have a finite set $F$ of possible discontinuities, throw $a,b$ into the pot and notice that by the above, $f$ is RI on each subinterval determined by $F.$ That proves $f$ is RI on $[a,b].$