In real analysis, the Riemann sum of functions is a specific kind of approximation calculated from a finite sum. The Riemann sum of functions is used for the definition of Riemann integrability which has applications in calculating “the area under a curve”, “the length of a curve”, and “the solid of revolution”.

#### Definition of the Riemann sum of functions with respect to the tagged partitions

Let \(f: [a,b] \rightarrow \mathbb{R}\) be a bounded function and \(P = \{x_i\}_{i=0}^{n}\) with \(\{c_i\}_{i=1}^{n}\) be a tagged partition of the interval \([a,b]\). The Riemann sum of the function \(f\) with respect to the tagged partition \(P\) is $$ \mathcal{R}(P,f) = \sum_{i=1}^{n} f(c_i) \Delta x_i.$$ Set $$M_i = \sup_{x \in [x_{i-1},x_i]} f(x)$$ and $$m_i = \inf_{x \in [x_{i-1},x_i]} f(x).$$ The upper and lower Darboux sums of \(f\) relative to the tagged partition \(P\) are $$\mathcal{U}(P,f) = \sum_{i=1}^{n} M_i \Delta x_i$$ and $$\mathcal{L}(P,f) = \sum_{i=1}^{n} m_i \Delta x_i,$$ respectively.

**Result**. If a function over a bounded and closed interval is a bounded function, then all upper and lower Darboux sums relative to all tagged partitions are bounded above and below.

Proof. Let \(f\) be bounded and \(m \leq f(x) \leq M\) for all \(x \in [a,b]\). For any tagged partition \(P\), it is easy to show that $$m(b-a) \leq $$ $$\mathcal{L}(P,f) \leq $$ $$\mathcal{R}(P,f) \leq $$ $$\mathcal{U}(P,f) \leq $$ $$M(b-a).$$

Based on above result, one may give the following definition:

#### Definition of the upper and lower Riemann integrals

Let \( f: [a,b] \rightarrow \mathbb{R} \) be a bounded function. We define the lower and upper Riemann integrals to be $$\underline{\int_{a}^{b}} f(x) \, \mathrm{d}x = \sup_{P} \mathcal{L}(P,f)$$ and $$\overline{\int_{a}^{b}} f(x) \, \mathrm{d}x = \inf_{P} \mathcal{U}(P,f),$$ respectively.

**Example**. Let \(D\) be Dirichlet function: $$ D(x) =

\begin{cases}

1 & \text{if $x \in \mathbb{Q}$} \\

0 & \text{otherwise}

\end{cases}.$$ Compute the lower and upper Riemann integrals over the interval \([a,b]\), where \(a\) and \(b\) are real numbers with \(a < b \).

Let \(P\) be a partition of \([a,b]\). Since any subinterval \([x_{k-1} , x_k]\) contains both rational and irrational numbers, we have $$m_k = 0$$ and $$M_k = 1.$$ This implies that $$\mathcal{L}(P,f) = 0 $$ and $$\mathcal{U}(P,f) = 1.$$ So, we have the following: $$\underline{\int_{a}^{b}} D(x) \, \mathrm{d}x = 0 $$ and $$ \overline{\int_{a}^{b}} f(x) \, \mathrm{d}x = 1.$$