Monotone functions are continuous except countably many points. If function is Riemann integrable it has only a finite number of discontinuity points. So how monotone functions are Riemann integrable on closed interval always?
Real Analysis – Why Monotone Functions Are Riemann Integrable on a Closed Interval
integrationreal-analysis
Related Solutions
I will try to explain the counterexample provided in ParamanandSingh's math overflow link. We will need a few prerequisites but they're hopefully not too advanced.
Null Set/Measure Zero Set: A null set $N \subset \mathbb{R}$, also called a measure zero set, is a set that can be convered by a countable union of intervals with arbitrarily small total length. See this wikipedia link.
Measure zero here anticipates the Lebesgue measure for the reals. The Lebesgue measure assigns 'length' to sets of the real line in the natural/expected way. There's technicalities involved, but all we'll really need from it is that the measure of an interval with endpoints $a<b$ is $(b-a)$.
Lebesgue Criterion (for Riemann integrability): A bounded function on a compact interval is Riemann-integrable if and only if its set of discontinuities has measure zero. See this wikipedia link.
This criterion characterizes how 'small' a function's set of discontinuities needs to be for that function to be Riemann-integrable. It is a standard (though not trivial) result with many proofs lying around; no measure theory is needed!
Cantor and Fat Cantor Sets: The standard, ternary Cantor set has measure zero; see this wikipedia link. There are Cantor sets with positive measure; for instance, the Smith-Volterra-Cantor set.
We can deduce these using lenghts of intervals! Let $C$ be the ternary Cantor set.
At the first step, we delete an interval of length $1/3$ from $C_0=[0,1]$, obtaining $C_1$. At the second step, we delete two intervals, each of which has length $1/9$, from $C_1$, obtaining $C_2$. More generally, at the $n$-th step we delete $2^{n-1}$ intervals, each of which has length $3^{-n}$, from $C_{n-1}$, obtaining $C_n$.
Thus, the total length deleted this way is $$\sum_{n=1}^{\infty}\frac{1}{2}{\left(\frac{2}{3}\right)}^n=\frac{1}{2}\frac{\frac23}{1-\frac23}=1$$
which is the length of $[0,1]$, the interval we began with. It follows that the ternary Cantor set $C$ -- what remains after all deletions -- has measure zero.
Calculations for the Smith-Volterra-Cantor set $S$ are similar. At the $n$-th step, $2^{n-1}$ intervals, each of which has length $2^{-2n}$, are deleted from $S_{n-1}$, obtaining $S_n$. Therefore, the total length deleted this way is $$\sum_{n=1}^{\infty}\frac{1}{2}\frac{2^n}{2^{2n}}=\frac{1}{2}\sum_{n=1}^{\infty}\frac{1}{2^n}=\frac{1}{2}\frac{\frac12}{1-\frac12}=\frac12$$ The measure of $S$ is simply $1$ (the measure of $[0,1]$, the interval we began with) minus $\frac12$ (the total measure of what we discarded), that is, $S$ has measure $\frac12$. In particular, it has positive measure and is not a null set.
Now that we have the prerequisites, let's dive onto the counterexample. First, let $f:[0,1]\longrightarrow \mathbb{R}$ be the characteristic function of the ternarcy Cantor set $C$, that is:
\begin{equation} f(x)=\left\{\begin{array}{ll}1&\text{if $x \in C$}\\0&\text{if $x \notin C$}\\\end{array}\right. \end{equation}
Notice that $f$ has discontinuities precisely on $C$; a good way to see this is to notice that at each step in the construction of $C$, $f$ is defined to be $0$ on the deleted intervals (so it is clearly continuous in their interior) It follows by the Lebesgue Criterion that $f$ is Riemann-integrable.
Finally, we will define a monotone increasing function $g:[0,1] \longrightarrow \mathbb{R}$ that maps the Smith-Volterra-Cantor set $S$ to $C$. We will obtain $g$ as the limit of a sequence of functions.
Let $S_0=C_0=[0,1]$, let $S_n$ be what remains in the construction of $S$ after $n$ steps, and similarly for $C_n$. Notice that each of $S_n$ and $C_n$ is a disjoint union of $2^n$ closed non-degenerate intervals; we may describe each of them by its collection of $2^{n+1}$ endpoints. For instance, in the obvious notation $C_0=S_0\sim\{0,1\}$, $C_1\sim\left\{0,\frac13,\frac23,1\right\}$ and $S_1\sim\left\{0,\frac38,\frac58,1\right\}$.
Define $g_n:[0,1]\longrightarrow\mathbb{R}$ as follows. Let $S_n\sim\{s_k\}$, where $k$ ranges from $1$ to $2^{n+1}$ and the $s_k$ are increasing. Similarly, let $C_n\sim \{c_k\}$. For all $k=1,\dots,2^{n+1}$ put $g_n(s_k)=c_k$, and extend it to all of $[0,1]$ linearly. In other words, $g_n$ fits the $i$-th interval in $S_n$ into the $i$-th interval in $C_n$, and fills in the blanks with linear pieces. It's easy to see that $g_n$ is increasing (and continuous!) for all $n$.
It's not too hard to see that $g_n$ converges pointwise for all $x \in [0,1]$; we define $g$ to be this limit function. It follows immediately that $g$ is increasing and maps $S$ to $C$. (It's a bit of work, but one can show that the convergence $g_n\to g$ is actually uniform, so that $g$ is indeed continuous!)
At last, the composition $f\circ g$ has $S$ for its set of discontinuities. Since $S$ has positive measure, it follows by the Lebesgue criterion that $f\circ g$ is not Riemann-integrable, which concludes the proof.
No, try to show that the function (which is clearly not continuous) $$ f(x) = \begin{cases} 0,& x \neq 0,\\ 1,& x=1 \end{cases} $$ is Riemann integrable on $[-1,1]$.
Best Answer
Suppose $f$ is nondecreasing. For any partition $a = x_0 < x_1 \ldots < x_n = b$ of your interval $[a,b]$, any Riemann sum is between the left Riemann sum $L = \sum_{j=1}^n f(x_{j-1})(x_j - x_{j-1})$ and the right Riemann sum $R = \sum_{j=1}^n f(x_{j})(x_j - x_{j-1})$. The difference between them is at most $(f(b) - f(a)) \delta$ where $\delta = \max_j (x_j - x_{j-1})$.
Proof without words: