When a rate of change is a simple function (piecewise constant), we can
compute the definite integral as a summation of the increments.
Each increment is the product of the rate of change times the width of the subinterval in the partition.
When a rate of change is not simple (varying), we can approximate the total change
by using simple functions that are either above or below the true rate.
If we can make these approximations as good as we desire, then there is a limiting value
and that value is defined as the definite integral.

The approximations to the definite integral using simple functions are called Riemann sums.
In this section, we will learn how to create Riemann sums using a uniform partition.
The Riemann sum will depend on the number of increments.
The definite integral will be the limit of this sum as the number of increments goes to infinity.

Subsection4.2.2Uniform Partitions

Recall that a partition \(P\) of an interval \([a,b]\) is an increasing, finite sequence
\(P = (x_0, x_1, \ldots, x_n)\) with \(x_0=a\) and \(x_n=b\) and \(x_{k-1} \lt x_{k}\).
Adjacent terms in the sequence define subintervals, \(I_k = [x_{k-1}, x_{k}]\),
which has a width increment of size \(\Delta x_k = x_{k} - x_{k-1}\).
A uniform partition of an interval \([a,b]\) is a partition in which all increments are the same size.

Definition4.2.1Uniform Partition

The uniform partition of an interval \([a,b]\) of size \(n\)
is the partition with increments
\begin{equation*} \Delta x = \frac{b-a}{n} \end{equation*}
and partition points defined by the arithmetic sequence
\begin{equation*}x_k = a + k \cdot \Delta x, \quad k=0, 1, \ldots, n. \end{equation*}
The \(k\)th subinterval is \(I_k = [a+(k-1)\Delta x, a+k \Delta x]\).

The definition of the uniform partition suggests the basic steps required
to create such a partition.

Identify the interval \([a,b]\) and the size of partition \(n\).

Compute the partition increment size \begin{equation*}\Delta x = \frac{b-a}{n},\end{equation*}
which is the total width of the interval divided by the number of subintervals.

Create the partition points by using an arithmetic sequence with initial value
\(x_0=a\) and increment size \(\Delta x\) (just calculated).

Example4.2.2

Find the uniform partition of \([1,4]\) of size \(n=8\).

The interval uses \(a=1\), \(b=4\) and \(n=8\).
Consequently we can compute
\begin{equation*} \Delta x = \frac{b-a}{n} = \frac{4-1}{8} = \frac{3}{8}. \end{equation*}
Next, we define the partition points,
\begin{equation*} x_k = a + k \Delta x = 1 + k \cdot \frac{3}{8} = 1 + \frac{3}{8} k. \end{equation*}
In particular, the partition includes the points shown in the table below.

\(k\)

\(x_k\)

0

\(1\)

1

\(1+\frac{3}{8} = 1 \frac{3}{8}\)

2

\(1+\frac{6}{8} = 1 \frac{6}{8}\)

3

\(1+\frac{9}{8} = 2 \frac{1}{8}\)

4

\(1+\frac{12}{8} = 2 \frac{4}{8}\)

5

\(1+\frac{15}{8} = 2 \frac{7}{8}\)

6

\(1+\frac{18}{8} = 3 \frac{2}{8}\)

7

\(1+\frac{21}{8} = 3 \frac{5}{8}\)

8

\(1+\frac{24}{8} = 4\)

One of the tasks required in computing Riemann sums will involve evaluating a function
at these partition points. This is yet another example of the importance of
composition of functions in that we replace the independent variable (input) of the
function with a formula for the partition point of interest.

Example4.2.3

Evaluate \(f(x_k)\) where \(f(x) = x^2\) and \(x_k\) is a point
in the uniform partition of \([1,4]\) of size \(n\).

We start by defining the partition. The interval \([1,4]\) means that
\(a=1\) and \(b=4\), as in the previous example. However, the size of the partition \(n\)
is not specified, so we use the variable itself to compute the increment size,
\begin{equation*}\Delta x = \frac{b-a}{n} = \frac{4-1}{n} = \frac{3}{n}. \end{equation*}
Once the increment is known, we can define the partition points which is
an arithmetic sequence with \(x_0=1\) and increments \(\Delta x\) to define
\begin{equation*}x_k = 1 + k \Delta x = 1+ k \cdot \frac{3}{n} = 1 + \frac{3k}{n}. \end{equation*}

Once the formula for the partition point is known, we use composition with \(f(x)=x^2\)
and then expand the formula.
\begin{align*}
f(x_k) &= f(1+\frac{3k}{n}) \\
&= [1+\frac{3k}{n}]^2 \\
&= (1+\frac{3k}{n})(1+\frac{3k}{n}) \\
&= 1 + \frac{6k}{n} + \frac{9k^2}{n^2}.
\end{align*}

From this section, you should be able to write down the formula for the points
in a uniform partition of an interval whether the size of the partition is given
as a specific number or as an unspecified value.
Using this formula, you should also be able to use that formula to evaluate a
function at the partition points.

Subsection4.2.3Uniform Riemann Sums

Recall that a simple function is a piecewise function that is constant
on each subinterval defined by the partition.
We know how to compute the accumulated change (definite integral) for every simple function.
Suppose that we had any function \(f(x)\) representing a rate of change of some quantity \(Q\)
and we wanted to determine the resulting increment of change
\begin{equation*}Q(b)-Q(a) = \int_{a}^{b} f(x) \, dx \end{equation*}
as \(x\) changes from \(x=a\) to \(x=b\).
A Riemann sum approximates this definite integral by approximating
the function \(f(x)\) by a simple function defined on a partition of \([a,b]\).

A Riemann sum involves two steps: specifying the partition and choosing the simple function
defined on the partition.
The most common choice for a partition is a uniform partition.
The simple function is defined by choosing a constant function value on each resulting subinterval.
A Riemann sum requires that we choose the value to match the true function \(f(x)\)
at some point within the closed subinterval \([x_{k-1},x_k]\).
Different rules for how to choose the point define some common methods.

Left-Hand Rule

The simple function uses the value at the left end point, \(f(x_{k-1})\).

Right-Hand Rule

The simple function uses the value at the right end point, \(f(x_{k})\).

Mid-Point Rule

The simple function uses the value at the midpoint of the interval, \(f(\frac{x_{k-1}+x_{k}}{2})\).

Trapezoid Rule

The simple function uses the average of the values at the end-points, \(\frac{f(x_{k-1})+f(x_{k})}{2}\).

Lower-Sum Rule

The simple function uses the minimum value of the function on the subinterval, \(\min(f(x) : x \in [x_{k-1},x_k])\).

Upper-Sum Rule

The simple function uses the maximum value of the function on the subinterval, \(\max(f(x) : x \in [x_{k-1},x_k])\).

The left-hand rule and the right-hand rule are the simplest rules to work with algebraically.
We will focus on practicing using those rules.
The trapezoid rule typically is a much better approximation and is preferred when using a computer.
The lower-sum and upper-sum rules provide error bounds on our approximation.
The lower-sum always underestimates the definite integral; the upper-sum always overestimates the value.
If we know both the lower-sum and upper-sum, then the true value must be between them.

To compute a Riemann sum using a particular choice of simple function, we usually
do not define the approximating simple function separately. We just compute the
approximating definite integral based on that simple function. For clarity, our
first example will define the function directly.

Example4.2.4

Approximate \(\displaystyle \int_{2}^{5} x^2 dx\) using the left-hand rule
with a uniform partition of size \(n=4\).

The first step is to define the partition. Our interval is \([a,b] = [2,5]\).
Consequently, the increment size of the partition will be
\begin{equation*}\Delta x = \frac{5-2}{4} = \frac{3}{4}. \end{equation*}
The partition points are defined by
\begin{equation*} x_k = 2 + \frac{3k}{4}, \quad k=0, 1, 2, 3, 4. \end{equation*}
In particular, the partition is defined by the sequence
\begin{equation*} x = (2, 2.75, 3.5, 4.25, 5). \end{equation*}

The second step is to define the simple function, \(\mathcal{L}_f(x)\). Using the left-hand rule
means that we will use the value of \(f(x) = x^2\) on each subinterval \([x_{k-1},x_k]\)
by the value of \(f(x_{k-1})\).
\begin{equation*}\mathcal{L}_f(x) = \begin{cases}
f(2) = 2^2 = 4, & 2 \lt x \lt 2.75, \\
f(2.75) = 2.75^2 = 7.5625, & 2.75 \lt x \lt 3.5, \\
f(3.5) = 3.5^2 = 12.25, & 3.5 \lt x \lt 4.25, \\
f(4.25) = 4.25^2 = 18.0625, & 4.25 \lt x \lt 5.
\end{cases}\end{equation*}
A graph of \(y=f(x)\) and the approximating simple function \(y=\mathcal{L}_f(x)\) is shown below.
The shaded region corresponds to the definite integral represented by the Riemann sum.

The Riemann sum is the definite integral of the approximating simple function.
Notice how the limits of the integral correspond to the interval \([2,5]\)
while the limits of the sum correspond to counting the subintervals in the partition.
\begin{align*}
\int_2^5 \mathcal{L}_f(x) \, dx & = \sum_{k=1}^{4} f(x_{k-1}) \Delta x \\
&= f(2) \cdot \frac{3}{4} + f(2.75) \cdot \frac{3}{4} + f(3.5) \cdot \frac{3}{4} + f(4.25) \cdot \frac{3}{4} \\
&= 4(0.75) + 7.5625(0.75) + 12.25(0.75) + 18.0625(0.75) \\
&= 31.40625
\end{align*}

In usual practice, the only steps we really need are identifying the partition,
determining the value of the function on each subinterval, and then computing the Riemann sum,
which corresponds to the definite integral of the simple function. Writing down
the piecewise formula for the simple function is not actually necessary.
A table often makes the computation simpler.

Example4.2.5

Use a Riemann sum with the right-hand rule and a uniform partition of size \(n=5\)
to approximate \(\displaystyle \int_0^2 \frac{1}{x+1} dx\).

Start by identifying the partition. First determine the increment size,
\begin{equation*}\Delta x = \frac{2-0}{5} = \frac{2}{5} = 0.4. \end{equation*}
Use the increment size to find the partition,
\begin{equation*} x= (0, 0.4, 0.8, 1.2, 1.6, 2.0). \end{equation*}
Once the partition is identified, calculate the value of the integrand function
\(f(x) = \displaystyle \frac{1}{x+1}\) at the right endpoint of each subinterval.
The table below summarizes these computations.

\(k\) (index)

\([x_{k-1}, x_k]\) (interval)

\(f(x_k)\) (value)

\(1\)

\([0,0.4]\)

\(f(0.4) = \frac{1}{1.4} \approx 0.7143 \)

\(2\)

\([0.4,0.8]\)

\(f(0.8) = \frac{1}{1.8} \approx 0.5556 \)

\(3\)

\([0.8,1.2]\)

\(f(1.2) = \frac{1}{2.2} \approx 0.4546 \)

\(4\)

\([1.2,1.6]\)

\(f(1.6) = \frac{1}{2.6} \approx 0.3846 \)

\(5\)

\([1.6,2]\)

\(f(2) = \frac{1}{3} \approx 0.3333 \)

Knowing the constant values on each subinterval, if we called the simple function
using the right endpoint \(\mathcal{R}_f(x)\), then we have the Riemann sum
\begin{align*}
\int_{0}^{2} \mathcal{R}_f(x) \, dx &= \sum_{k=1}^{5} f(x_k) \Delta x \\
&\approx 0.7143(0.4) + 0.5556(0.4) + 0.4546(0.4) + 0.3846(0.4) + 0.3333(0.4) \\
&\approx 0.9770
\end{align*}
The graph below shows the original function \(y=f(x)\) and the simple function
\(y=\mathcal{R}_f(x)\) that was used in the Riemann sum.

The previous two examples illustrated very specific Riemann sums, where
the size of the partition was specified as a small number. In order to
compute definite integrals using limits of Riemann sums, we need to
find an explicit formula for a Riemann sum involving a partition of unspecified size \(n\).

The basic steps for these problems are as follows.

Create a formula for the partition with increment
\begin{equation*}\Delta x = \frac{b-a}{n}\end{equation*}
and partition points defined by an arithmetic sequence
\begin{equation*} x_k = a + k \, \Delta x. \end{equation*}

Evaluate the integrand function \(f(x)\) at the appropriate choice,
usually at an end point such as \(f(x_{k-1})\) (left) or \(f(x_k)\) (right),
and expand the formula as necessary.

Write down the Riemann sum using summation notation. Apply the properties of summation
and the summation formulas to find an explicit formula for the Riemann sum
in terms of \(n\). The typical representation of the Riemann sum uses the form
\begin{equation*} \sum_{k=1}^{n} f(x_k^*) \Delta x, \end{equation*}
where \(f(x_k^*)\) is the function value chosen for the \(k\)th subinterval
of the partition depending on which rule is chosen.

To find the actual definite integral, take a limit of the explicit formula as \(n \to \infty\).
That is, the definite integral is computed as
\begin{equation*} \int_{a}^{b} f(x) dx = \lim_{n \to \infty} \sum_{k=1}^{n} f(x_k^*) \Delta x, \end{equation*}

Example4.2.6

Use a Riemann sum with the right-hand rule and a uniform partition of size \(n\)
to approximate \(\displaystyle \int_{-1}^{5} (5-2x) dx\).

To find the partition of the interval \([a,b]=[-1,5]\), we compute the partition increment size
\begin{equation*} \Delta x = \frac{5--1}{n} = \frac{6}{n}.\end{equation*}
The partition points are defined using an arithmetic sequence
\begin{equation*} x_k = -1 + k \cdot \frac{6}{n} = -1 + \frac{6k}{n}. \end{equation*}
The partition defines the \(k\)th subinterval \([x_{k-1}, x_k]\)
such that the right-hand rule will evaluate the integrand \(f(x)=5-2x\)
at the point \(x_k\),
\begin{align*}
f(x_k) &= 5-2x_k = 5-2(-1+\frac{6k}{n}) \\
&= 5+2-\frac{12k}{n} = 7 - \frac{12k}{n}
\end{align*}

The Riemann sum is equal to the sum of increments computed as the integrand function (rate)
times the partition increment width. That is, if we use the function \(\mathcal{R}_f(x)\)
as the simple function using the right-hand end points of the intervals, then the
Riemann sum is
\begin{equation*} \int_{-1}^{5} \mathcal{R}_f(x) dx = \sum_{k=1}^{n} f(x_k) \cdot \Delta x. \end{equation*}
Using the value we found above and \(\Delta x = \frac{6}{n}\), this gives
\begin{align*}
\int_{-1}^{5} \mathcal{R}_f(x) dx &= \sum_{k=1}^{n} (7-\frac{12k}{n}) \cdot \frac{6}{n} \\
& = \sum_{k=1}^{n} (\frac{42}{n} - \frac{72k}{n^2}) \\
& \overset{\hbox{Linearity}}{=} \frac{1}{n} \sum_{k=1}^{n} 42 - \frac{72}{n^2} \sum_{k=1}^{n} k \\
& = \frac{1}{n} \cdot (42n) - \frac{72}{n^2} \cdot \frac{n(n+1)}{2} \\
& = 42 - \frac{36(n+1)}{n}
\end{align*}
This final formula is the value of the Riemann sum using the right-hand rule.

The limit of the Riemann sum is the value of the actual definite integral of interest.
That is, for this problem, we have
\begin{align*}
\int_{-1}^{5} (5-2x) dx &= \lim_{n \to \infty} [42 - \frac{36(n+1)}{n}] \\
&= \lim_{n \to \infty} [42 - 36 \cdot \frac{n(1+\frac{1}{n})}{n}] \\
&= 42 - 36 \cdot 1 = 6.
\end{align*}

Because the graph \(y=f(x)\) (shown below) is linear, we can compute the corresponding
signed area using the area of triangles and compare our calculation.
The graph crosses the axis when \(f(x)=0\) which occurs at \(x=2.5\).
So we split the definite integral into two pieces,
\begin{equation*} \int_{-1}^{5} f(x) dx = \int_{-1}^{2.5} f(x) dx + \int_{2.5}^{5} f(x) dx. \end{equation*}
The first region on interval \([-1,2.5]\) is a triangle above the axis with height 7 and width 3.5
so that the area of the region is \(\frac{1}{2}(7)(3.5) = 12.25\).
The second region on interval \([2.5, 5]\) is a triangle below the axis with height 5
(since \(f(5)=-5\)) and base width \(5-2.5=2.5\).
The area of the second triangle is \(\frac{1}{2}(5)(2.5) = 6.25\) but
corresponds to a signed area of \(-6.25\) (because below the axis).
So
\begin{equation*} \int_{-1}^{5} f(x) dx = 12.25 + -6.25 = 6. \end{equation*}
Thus, the limit of the Riemann sum exactly agrees with the geometric calculation of total signed area.