The Riemann Integral

[under construction]
Step functions
Definition. A function $f:[a,b]\to \R$ is called a step function if it is piecewise constant, i.e. if there are numbers \[ a=x_0 \lt x_1\lt x_2 \lt \cdots \lt x_{N-1} \lt x_N=b \] such that $f$ is constant on each half open interval $[x_{i-1}, x_{i})$ with $1\leq i \leq N$. For a step function we define the integral to be \[ \int_a^b f(x) dx = \sum _{i=1}^{N} f(x_{i-1}) \bigl(x_{i} - x_{i-1}\bigr). \] The collection of numbers $\{x_0, x_1, x_2, \ldots x_N\}$ are called a partition for the step function $f$.

In this definition we have to take into account that a step function $f$ might be defined using different partitions, and show that the integral does not depend on which partition is used to compute it.

Lemma.  If $f$ and $g$ are step functions on an interval $[a,b]$ with $f(x)\leq g(x)$ for all $x\in[a,b]$, then \[ \int_a^b f(x) dx \leq \int_a^b g(x) dx \]
Definition of the integral

Let $f:[a, b] \to \R$ be a bounded function, i.e. there is an $M\in\R$ such that $|f(x)| \leq M$ for all $x\in[a,b]$.

Upper and Lower integrals. The lower integral of the function $f$ on the interval $[a,b]$ is, by definition, \[ L(f, a, b) = \sup \left\{\int_a^b s(x)\,dx \mid s \text{ is a step function with } s\leq f \right\} \] Similarly, the upper integral of $f$ is defined to be \[ U(f, a, b) = \inf \left\{\int_a^b t(x)\,dx \mid t \text{ is a step function with } t\geq f \right\} \]
Lemma.  For any bounded function $f:[a,b]\to\R$ we have $L(f, a, b) \leq U(f, a, b)$.
Let $t(x)$ be a step function on $[a,b]$ with $t(x)\ge f(x)$ for all $x\in[a,b]$. If $s$ is any step function with $s(x)\leq f(x)$ for all $x\in [a,b]$, then $s(x)\leq t(x)$ for all $x\in[a,b]$, and hence \[ \int_a^b s(x)dx \leq \int_a^b t(x)dx. \] This implies that the integral of $t(x)$, is an upper bound for the integrals of all step functions $s\leq f$. Hence \[ \int_a^bt(x)dx \geq \sup \Bigl\{\int_a^b s(x) \mid \text{$s$ is a step function with }s\leq f\Bigr\} = L(f, a,b). \] Thus the integral of any step function $t$ with $t\geq f$ is bounded from below by $L(f, a, b)$. It follows that the greatest lower bound for $\int_a^b t(x)dx$ with $t\geq f$ satisfies \[ L(f,a,b) \leq \inf\left\{\int_a^b t(x)\,dx \mid t \text{ is a step function with } t\geq f \right\} =U(f, a, b). \]
Definition. The function $f$ is said to be Riemann integrable if its lower and upper integral are the same. When this happens we define \[ \int_a^b f(x)\, dx = L(f, a, b) = U(f, a, b). \]
A criterion for Riemann integrability.  A function $f:[a,b]\to\R$ is Riemann integrable if for every $\epsilon\gt0$ there exist step functions $s, t:[a,b]\to\R$ for which \[ \forall x\in [a,b]:\quad s(x) \leq f(x) \leq t(x) \] and \[ \int_a^b t(x)\, dx - \int _a^b s(x)\,dx \lt \epsilon \] holds.
Theorem. If $f:[a,b] \to \R$ is continuous, then $f$ is Riemann integrable.
Let $\epsilon\gt0$ be given. Since $f$ is continuous, it is also uniformly continuous, and therefore there is a $\delta\gt0$ such that \[ \left| f(x) - f(y) \right| \lt \frac{\epsilon}{b-a} \] whenever $|x-y|\lt \delta$.

For any large integer $N$ we consider an equally spaced partition $x_k = a + kh$, with $h=(b-a)/N$, and $k=0, 1, \dots, N$. We choose $N$ so large that \[ \frac{b-a}N \lt \delta. \] The function $f$ is continuous on any of the intervals $[x_{k-1}, x_k]$, and therefore there are points $c_k, d_k\in[x_{k-1}, x_k]$ where $f$ attains its minimum and maximum, respectively, i.e.  we have \[ f(c_k) \leq f(x) \leq f(d_k) \text{ for all }x\in[x_{k-1}, x_k]. \] We now define two step functions $s, t:[a,b]\to\R$ by specifying that on each interval $[x_{k-1}, x_k)$ one has $s(x) = f(c_k)$ and $t(x) = f(d_k)$. Then it follows that for all $x\in[x_{k-1}, x_k)$ one has \[ s(x) \leq f(x) \leq t(x). \] Since $|c_k-d_k|\leq (b-a)/N \lt \delta$, we know that for any $x\in[x_{k-1}, x_k)$ \[ t(x) - s(x) = f(d_k)-f(c_k)\lt \frac\epsilon{b-a}. \] This holds for each interval $[x_{k-1}, x_k)$ ($k=1, 2, \dots, N$) and thus we have shown $0\leq t(x) - s(x) \lt \epsilon/(b-a)$ for all $x\in[a, b]$.

We can then compare the integrals of $t$ and $s$: since $t\leq s+\epsilon/(b-a)$ we have \[ \int_a^b t(x) dx \leq \int_a^b \Bigl(s(x)+\frac\epsilon{b-a}\Bigr) dx = \int_a^b s(x) dx + \epsilon. \]

Theorem. If $f:[a, b]\to\R$ is monotone (increasing or decreasing) then $f$ is Riemann integrable.
Example. The function \[ f(x) = \begin{cases} 0 & x\in\Q \\ 1 & x\in \R\setminus\Q \end{cases} \] is not Riemann integrable on the interval $[0,1]$.
Fundamental theorems

All the properties of the integral that are familiar from calculus can be proved. For example, if a function $f:[a,b]\to\R$ is Riemann integrable on the interval $[a,c]$ and also on the interval $[c,b]$, then it is integrable on the whole interval $[a,b]$ and one has \[ \int _a^b f(x)\,dx = \int _a^c f(x)\,dx + \int _c^b f(x)\,dx . \] The most important properties are the “fundamental theorems of calculus”, which deal with the relation between a Riemann integrable function $f:[a,b]\to\R$ and its improper integral \[ F(x) = \int_a^x f(t)\,dt. \]

Fundamental Theorem of Calculus–I. If $f$ is Riemann integrable on the interval $[a,b]$, and if $f$ is continuous at some $x\in (a, b)$, then $F$ is differentiable at $x$, and $F'(x) = f(x)$.
Fundamental Theorem of Calculus–II. If a continuous function $F:[a, b]\to\R$ is differentiable at every $x\in(a, b)$, and if its derivative $F'$ is a Riemann integrable function, then \[ F(b) -F(a) = \int_a^b F'(x)\, dx. \]
Let $f(x) = F'(x)$. We will show that
\[ L(f, a, b) \leq F(b) - F(a)\leq U(f, a, b). \tag{$*$} \]
Since $f$ is Riemann–integrable, we have
$\displaystyle L(f, a, b) = U(f, a, b)= \int_a^b f(x) dx$
so that $(*)$ implies the theorem.

To prove the first inequality in $(*)$ we will show that $F(b)-F(a)$ is an upper bound for all integrals $\int_a^b s(x)dx$ of step functions $s:[a,b]\to\R$ with $s(x)\leq f(x)$ for all $x\in [a,b]$. Since $L(f, a, b)$ is the least upper bound of all such integrals, we must have $L(f, a, b)\leq F(b)-F(a)$.

Let $s\leq f$ be a step function, and assume that $a=x_0\lt x_1\lt\cdots \lt x_n=b$ are its partition points. Then, by definition,

\[ \int_a^b s(x) dx = \sum_{k=1}^n s(x_{k-1}) \bigl(x_k-x_{k-1}\bigr). \]
Applying the Mean Value Theorem to the function $F$ on the interval $[x_{k-1}, x_k]$, we find that there is a $c_{k}\in (x_{k-1}, x_k)$ with \[ \frac{F(x_k) - F(x_{k-1})}{x_k-x_{k-1}} = F'(c_k) = f(c_k). \] Since $s(x)\leq f(x)$ for all $x\in [a,b]$ and since $s$ is constant on $[x_{k-1}, x_k)$, we have \[ \frac{F(x_k) - F(x_{k-1})}{x_k-x_{k-1}} = f(c_k) \geq s(c_k) = s(x_{k-1}). \] which implies an estimate for the terms that define $\int_a^b s(x)dx$: \[ s(x_{k-1}) \bigl(x_k-x_{k-1}\bigr) \leq F(x_k) - F(x_{k-1}). \] Hence \[ \int_a^b s(x) dx \leq \sum _{k=1}^n F(x_k) - F(x_{k-1}) = F(b)-F(a). \]

The arguments also show that $F(b)-F(a) \leq \int_a^b t(x) dx$ for any step function $t:[a,b]to\R$ with $t(x)\geq f(x)$ for all $x\in [a,b]$.

A calculus example.  The function $F(x) = \tfrac13x^3$ is continuous on $[0,1]$; it is also differentiable, and its derivative $f(x) = F'(x) = x^2$ is Riemann integrable because it is continuous as we proved above. Therefore we have \[ \int_0^1 x^2 dx = F(1) - F(0) = \frac13. \]
Examples where the Fundamental theorem does not apply.  The Fundamental Theorem is often summarized by saying that the “integral of the derivative is the original function,” and similarly, that “the derivative of the integral is the original function.” The following two examples show that the hypotheses in the theorems are really needed.

A non integrable derivative. There exist everywhere differentiable functions whose derivative is not Riemann integrable. For example, \[ F(x) = \begin{cases}\displaystyle\frac{x^2}{2} \sin \frac\pi{x^2} & (x\neq 0) \\[3px] \qquad0 & (x=0)\end{cases} \] has derivative

$\displaystyle F'(x) = -\frac{\pi}{x} \cos \frac\pi{x^2} + x \sin\frac\pi{x^2},\qquad$ and $\quad F'(0)=0$,
which is not bounded for $x$ near $0$. Therefore this function is not Riemann integrable on the interval $[0,1]$, and the right hand side in the Fundamental Theorem \[ F(1) - F(0) \stackrel?= \int _0^1 F'(x)dx \] is not defined.

A non differentiable integral. There exist Riemann integrable functions $f:[a,b]\to\R$ for which \[ F(x) = \int_a^x f(t)dt \] is not differentiable at all $x\in (a, b)$. One such example is the function \[ f(x) = \begin{cases} -1 & (x\lt0) \\ +1 & x\geq0 \end{cases} \] for which \[ \int_{-1}^x f(u) du = -1+|x|, \] which is not differentiable at $x=0$.