When I was taught integration, my teacher told me that when we divide the area into strips with sufficiently small widths, the error will decrease to zero. However, there was still some confusion in my mind: when the widths of each strip decrease to infinitesimally small, the total area will approach the actual area under the original function, but since we have infinitely many strips, isn't it a $\gdef\mydef{\gdef}\mydef\s#1{\left(#1\right)}\mydef\m#1{\left[#1\right]}\mydef\b#1{\left\{#1\right\}}0 \cdot \infty$ model? How can we irresponsibly assert this $0 \cdot \infty = 0$?
Partition
We call two intervals almost-disjoint if they have at most one common point.
Let $I$ be a nonempty, closed interval in $\mathbb R$. A partition of $I$ is a collection of nonempty intervals $\b{I_1, \ldots, I_n}$ of almost-disjoint, closed intervals whose union is $I$.
A partition of the interval $\m{a, b}$ can be represented by a collection of points $\b{x_i}_{i = 0}^n$ for some $n$ such that
$$ a = x_0 < x_1 < \cdots < x_n = b, $$
then, $\b{I_k = \m{x_{k - 1}, x_k}}_{k = 1}^n$ will be the corresponding partition.
Upper and Lower Riemann Sums
For a bounded function $f : \m{a, b} \to \mathbb R$. Define
$$ m = \inf\limits_I f \qquad M = \sup\limits_I f \qquad m_k = \inf\limits_{I_k} f \qquad M_k = \sup\limits_{I_k} f. $$
For a given partition $\newcommand\mpar{\b{I_1, \ldots, I_n}}P = \mpar$ of $I = \m{a, b}$. Define the lower Riemann sum of $f$ with respect to $P$ as
$$ \mydef\mlrs#1{L\s{f, #1}}\mlrs P := \sum\limits_{k = 1}^n m_k\left|I_k\right|, $$
and the upper Riemann sum of $f$ with respect to $P$ as
$$ \mydef\murs#1{U\s{f, #1}}\murs P := \sum\limits_{k = 1}^n M_k\left|I_k\right|. $$
Basic Estimation
Note that $\sum_{k = 1}^n \left|I_k\right| = \left|I\right| = b - a$ and $m \leq m_k \leq M_k \leq M$ for $1 \leq k \leq n$.
We have
$$ m\s{b - a} \leq \mlrs P \leq \murs P \leq M\s{b - a}. $$
Upper and Lower Riemann Integrals
Let $I = \m{a, b}$.
Let $\mathcal P$ be the set of all the partitions of $I$.
For a bounded function $f : \m{a, b} \to \mathbb R$. Define the lower Riemann integral of $f$ as
$$ L\s f := \sup\limits_{P \in \mathcal P} \mlrs P, $$
and the upper Riemann integral of $f$ as
$$ U\s f := \inf\limits_{P \in \mathcal P} \murs P. $$
It seems justified that $L\s f$ be the largest possible approximation from below, and $U\s f$ be the counterpart from above.
Riemann Integrability
For a bounded function $f : \m{a, b} \to \mathbb R$. It is Riemann integrable if and only if $L\s f = U\s f$, and its integral by
$$ \int_a^b f = \int_a^b f\s x \mathrm dx = L\s f = U\s f. $$
An unbounded function on $\m{a, b}$ is not Riemann integrable on $\m{a, b}$.
Example 1
Determine whether the following function is Riemann integrable in $\m{0, 1}$.
$$ g\s x = \begin{cases}1 & 0 < x \leq 1 \\ 0 & x = 0\end{cases} \quad . $$
For our partition $P$, let $I_k = \m{\s{k - 1} / n, k / n}$.
For $I_1$, $m_k = 0$, $M_k = 1$.
For $I_k$, $2 \leq k \leq n$, $m_k = 1$, $M_k = 1$.
Hence,
$$ L\s{g, P} = \sum\limits_{k = 1}^n m_k \left|I_k\right| = 1 - \frac 1n. $$
And,
$$ U\s{g, P} = \sum\limits_{k = 1}^n M_k \left|I_k\right| = 1. $$
When $n \to \infty$, $\mlrs P = \murs P = 1$.
Note that
$$ L\s{g, P} \leq L\s g \leq U\s g \leq U\s{g, P}, $$
so, of course,
$$ L\s g = U\s g = 1. $$
Example 2
Determine whether the following function is Riemann integrable in $\m{0, 1}$.
$$ \mydef\foo{\chi_{\mathbb Q}}\foo\s x = \begin{cases}1 & x \in \mathbb Q \\ 0 & x \notin \mathbb Q\end{cases} \quad . $$
For any partition $P = \mpar$, without loss of generality, $\left|I_k\right| > 0$, for $1 \leq k \leq n$.
Consider $m_k$ and $M_k$.
Lemma 1
Let $a < b$, $a, b \in \mathbb R$, there exist at least one rational number and one irrational number in $\m{a, b}$.
By Lemma 1, we know $m_k = 0$ and $M_k = 1$. Hence,
$$ L\s{\foo, P} = \sum\limits_{k = 1}^n m_k\left|I_k\right| = 0\left|I\right| = 0, $$
and
$$ U\s{\foo, P} = \sum\limits_{k = 1}^n M_k\left|I_k\right| = 1\left|I\right| = 1. $$
Therefore, we know $0 = L\s{\foo} \neq U\s{\foo} = 1$, so it is not Riemann integrable.
Refinement
A partition $Q = \b{J_1, \ldots, J_l}$ of $\m{a, b}$ is a refinement of a partition $P = \mpar$ if every interval $I_k$ in $P$ is the union of one or more intervals $J_k$ from the partition $Q$.
Theorem 1
Let $f : \m{a, b} \to \mathbb R$ be a bounded function and $P$ and $Q$ partitions of $\m{a, b}$, with $Q$ a refinement of $P$. Then
$$ \mlrs P \leq \mlrs Q \leq \murs Q \leq \murs P. $$
Proof.
Let $P = \mpar$ and $Q = \b{J_1, \ldots, J_n}$. And
$$ m_n = \inf\limits_{I_n} f \qquad M_n = \sup\limits_{I_n} \qquad m_k' = \inf\limits_{J_k} \qquad M_k' = \sup\limits_{J_k} f. $$
Since $Q$ is a refinement of $P$, $J_k$ will be the union of several $I_n$, say
$$ J_k = \bigcup\limits_{t = a_k}^{b_k} I_t, $$
with $\left|J_k\right| = \sum_{t = a_k}^{b_k}\left|I_t\right|$. Which implies that, for all $a_k \leq n \leq b_k$:
$$ m_n \leq m_k' \qquad M_k' \leq M_n. $$
Now consider Riemann sums.
$$ \mlrs P = \sum\limits_{k = 1}^n m_k \left|I_k\right| = \sum\limits_{k = 1}^l\sum\limits_{t = a_k}^{b_k}m_t \left|I_t\right| \leq \sum\limits_{k = 1}^l\sum\limits_{t = a_k}^{b_k}m_k' \left|I_t\right| = \sum\limits_{k = 1}^l m_k' \left|J_k\right| = \mlrs Q, $$
And
$$ \murs Q = \sum\limits_{k = 1}^l M_k' \left|J_k\right| = \sum\limits_{k = 1}^l\sum\limits_{t = a_k}^{b_k}M_k' \left|I_t\right| \leq \sum\limits_{k = 1}^l\sum\limits_{t = a_k}^{b_k} M_t \left|I_t\right| = \sum\limits_{k = 1}^n M_k \left|I_k\right| = \murs P. $$
$\square$
Theorem 2
Let $f : \m{a, b} \to \mathbb R$ be a bounded function and $P$, $Q$ two partitions of $\m{a, b}$. Then
$$ \mlrs P \leq \murs Q. $$
Proof.
We can construct a refinement $R$ of both $P$ and $Q$ (e.g. the partition of the union of all endpoints of $P$ and $Q$). By Theorem 1, we have
$$ \mlrs P \leq \mlrs R \leq \murs R \leq \murs Q, $$
which means
$$ \mlrs P \leq \murs Q. $$
$\square$
Theorem 3
Let $f : \m{a, b} \to \mathbb R$ be a bounded function. Then $f$ is integrable if and only if for every $\varepsilon > 0$, there exists a partition $P$ of $\m{a, b}$ such that
$$ \murs P - \mlrs P < \varepsilon. $$
Proof.
By the properties of $\inf$ and $\sup$, we can definitely find two partitions $P_1$ and $P_2$ such that
$$ \murs{P_1} < U\s f + \frac{\varepsilon}2, $$
and
$$ \mlrs{P_2} > L\s f - \frac{\varepsilon}2. $$
Now, we construct a refinement $P$ of both $P_1$ and $P_2$ (e.g. the partition of the union of all endpoints of $P_1$and$P_2$). By Theorem 1, we know
$$ \mlrs{P_2} \leq \mlrs P \leq \murs P \leq \murs{P_1}. $$
Combine with the former inequalities, we have
$$ \murs P \leq \murs{P_1} < U\s f + \frac{\varepsilon}2, $$
and
$$ \mlrs P \geq \mlrs{P_2} > L\s f - \frac{\varepsilon}2. $$
Since if $f$ is integrable, then $U\s f = L\s f$:
$$ \begin{aligned} \murs P - U\s f + L\s f - \mlrs P &< 2 \cdot \frac{\varepsilon}2\\ \murs P - \mlrs P &< \frac{\varepsilon}2. \end{aligned} $$
$\square$
Theorem 4
Let $f : \m{a, b} \to \mathbb R$ be a bounded function. Then $f$ is integrable if and only if there exists a sequence of partitions $P_n$ such that
$$ \lim\limits_{n \to \infty} \murs{P_n} - \mlrs{P_n} = 0. $$
Proof.
$\square$