TITLE: Is my proof correct? If $f$ has a finite number of discontinuities on $[a, b]$, then it is integrable on $[a, b]$
QUESTION [5 upvotes]: Question:
Suppose a function $f(x)$ over the interval $[a, b]$ is bounded and has only a finite number of discontinuous points on $[a, b]$.  I intend to prove that it must be integrable on $[a, b]$.
Is my proof below correct?
My Answer (Is it correct?):
Since $f(x)$ has only a finite number of discontinuous points, call these points $p_1, p_2, ..., p_n$.  Now let $r$ be some number greater than $0$ such that for all $\epsilon > 0$, $2r < \frac{\epsilon}{4M}$.  Now let 
$M_i =$ sup$_{x \in [p_i - r, p_i +r]}f(x)$ and $m_i =$ inf$_{x \in [p_i - r, p_i +r]}f(x)$. Then $M_i - m_i \leq 2M$.
Now then $f$ must be continuous on each interval $[a, p_1 - r], [p_1 + r, p_2 - r], ...,[p_n + r, b]$ and thus $f$ must be integrable on each one of these intervals.  Therefore there exist partitions $P_1, P_2,..., P_{N+1}$ of each of these intervals such that $U(P_k, f) - L(P_k, f) < \frac{\epsilon}{2(N + 1)}$. $U(P_k, f)$ and $L(P_k, f)$ are the upper and lower sums of $f$ over their respective partitions.
Let $P$ be the partition given by the $P_1 \cup P_2 \cup ... \cup P_{N+1}$.
Then $U(P, f) - L(P, f) = U(P_1, f) - L(P_1, f) + U(P_2, f) - L(P_2, f) + ... U(P_{N + 1}, f) - L(P_{N + 1}, f) + M_1 - m_1 + M_2 - m_2 + ... M_N - m_N < 2M(\frac{\epsilon}{4M}) + \frac{\epsilon}{2(N + 1)}(N + 1) = \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$.
Thus for all $\epsilon > 0$, there exists a partition $P$ of $[a, b]$ such that $U(f, P) - L(f, P) < \epsilon$.
Therefore $f(x)$ is integrable over $[a, b]$.
Is this proof correct ?

REPLY [4 votes]: You have the correct approach. Just clean up a few details.
You are trying to show that given any $\epsilon > 0$, there exists a partition $P_\epsilon$ such that $U(P_\epsilon,f) - L(P_\epsilon,f) < \epsilon$.  
First define $M$,
$$M := \sup_{x \in [a,b]} |f(x)|.$$
Then it follows that for $i = 1, 2, \ldots, n$ we have
$$M_i - m_i \leqslant 2M,$$ 
and the contribution to the difference in upper and lower sums from intervals $[p_i - r, p_i +r]$ is
$$\sum_{i=1}^n(M_i - m_i)[p_i + r - (p_i-r)] \leqslant 4Mnr.$$
Don't choose $r < \epsilon/4M$ for any $\epsilon$. For a given $\epsilon > 0,$ choose a particular $r = r(\epsilon)$ such that $r < \epsilon/ (8Mn)$ and $[p_i-r,p_i+r] \subset (a,b).$
Choose partitions $P_k$ of the other $n+2$ intervals needed to cover $[a,b]$ such that
$$U(P_k,f)-L(P_k,f) < \frac{\epsilon}{2(n+2)}.$$
Also you are proving this for $p_i \in (a,b)$. The same argument applies with some slight modification if $p_1 = a$ or $p_n = b.$