Skip to main content
Logo image

APEX Calculus

Section 5.3 Riemann Sums

In the previous section we defined the definite integral of a function on \([a,b]\) to be the signed area between the curve and the \(x\)-axis. Some areas were simple to compute; we ended the section with a region whose area was not simple to compute. In this section we develop a technique to find such areas.
A fundamental calculus technique is to first answer a given problem with an approximation, then refine that approximation to make it better, then use limits in the refining process to find the exact answer. That is what we will do here.
Consider the region given in Figure 5.3.1, which is the area under \(y=4x-x^2\) on \([0,4]\text{.}\) What is the signed area of this region — i.e., what is \(\int_0^4(4x-x^2)\, dx\text{?}\)
A shaded downward opening parabola in the first quadrant.
A parabola with the equation \(y = 4x -x^2\text{.}\) It is a downward opening parabola lying in the first quadrant. It has a maximum of \((2,4)\text{,}\) and crosses the \(x\)-axis at \(x=0\) and \(x = 4\text{.}\) The area between the curve and the \(x\)-axis is shaded on the interval \([0,4]\text{.}\)
Figure 5.3.1. A graph of \(f(x) = 4x-x^2\text{.}\) What is the area of the shaded region?
We start by approximating. We can surround the region with a rectangle with height and width of 4 and find the area is approximately 16 square units. This is obviously an over-approximation; we are including area in the rectangle that is not under the parabola.
The previously described parabola with a large rectangle containing the shaded area.
The curve shown in Figure 5.3.1, with a rectangle entirely containing the shaded area. The rectangle has a height and width of 4. On the left and right sides of the parabola, area is included in the rectangle which is not shaded. The rectangle clearly contains a greater area than is under the parabola.
Figure 5.3.2. Approximating area under a curve with one rectangle
We have an approximation of the area, using one rectangle. How can we refine our approximation to make it better? The key to this section is this answer: use more rectangles.
Let’s use four rectangles with an equal width of 1. This partitions the interval \([0,4]\) into 4 subintervals, \([0,1]\text{,}\) \([1,2]\text{,}\) \([2,3]\) and \([3,4]\text{.}\) On each subinterval we will draw a rectangle.
There are three common ways to determine the height of these rectangles: the Left Hand Rule, the Right Hand Rule, and the Midpoint Rule. The Left Hand Rule says to evaluate the function at the left-hand endpoint of the subinterval and make the rectangle that height. In Figure 5.3.3, the rectangle drawn on the interval \([2,3]\) has height determined by the Left Hand Rule; it has a height of \(f(2)\text{.}\) (The rectangle is labeled “LHR.”)
The area of a downward opening parabola being approximated by 4 rectangles.
The parabola shown in Figure 5.3.1. The shaded are is being approximated by 4 rectangles of width 1. The left most rectangle has a height of 3 and is labeled "RHR," for "Right Hand Rule." The height of the rectangle is equal to the height of the parabola om the rightmost side, where \(x = 1\text{.}\) The second rectangle has a height of 3.75, and is labeled "MPR," for "Midpoint Rule." The height of the rectangle is equal to the height of the parabola at the center of the rectangle, where \(x=1.5\text{.}\) The third rectangle had a height of 4, and is labeled "LHR," for "Left Hand Rule." The height of the rectangle is given by the height of the parabola on the leftmost side, where \(x = 2\text{.}\) The rightmost rectangle has a height of 2.6, and is labeled "other". The height is given by the height of the parabola at a point slightly to the right of the center of the rectangle.
Figure 5.3.3. Approximating \(\int_0^4(4x-x^2)\, dx\) using rectangles. The heights of the rectangles are determined using different rules.
The Right Hand Rule says the opposite: on each subinterval, evaluate the function at the right endpoint and make the rectangle that height. In the figure, the rectangle drawn on \([0,1]\) is drawn using \(f(1)\) as its height; this rectangle is labeled “RHR.”.
The Midpoint Rule says that on each subinterval, evaluate the function at the midpoint and make the rectangle that height. The rectangle drawn on \([1,2]\) was made using the Midpoint Rule, with a height of \(f(1.5)\text{.}\) That rectangle is labeled “MPR.”
These are the three most common rules for determining the heights of approximating rectangles, but one is not forced to use one of these three methods. The rectangle on \([3,4]\) has a height of approximately \(f(3.53)\text{,}\) very close to the Midpoint Rule. It was chosen so that the area of the rectangle is exactly the area of the region under \(f\) on \([3,4]\text{.}\) (Later you’ll be able to figure how to do this, too.)
The following example will approximate the value of \(\int_0^4 (4x-x^2)\, dx\) using these rules.

Example 5.3.4. Using the Left Hand, Right Hand and Midpoint Rules.

Approximate the value of \(\int_0^4 (4x-x^2)\, dx\) using the Left Hand Rule, the Right Hand Rule, and the Midpoint Rule, using 4 equally spaced subintervals.
Solution.
We break the interval \([0,4]\) into four subintervals as before. In Figure 5.3.5.(a) we see 4 rectangles drawn on \(f(x) = 4x-x^2\) using the Left Hand Rule. (The areas of the rectangles are given in each figure.)
Note how in the first subinterval, \([0,1]\text{,}\) the rectangle has height \(f(0)=0\text{.}\) We add up the areas of each rectangle (height× width) for our Left Hand Rule approximation:
\begin{align*} \amp f(0)\cdot 1 + f(1)\cdot 1+ f(2)\cdot 1+f(3)\cdot 1\\ =\amp 0+3+4+3 = 10\text{.} \end{align*}
Figure 5.3.5.(b) shows 4 rectangles drawn under \(f\) using the Right Hand Rule; note how the \([3,4]\) subinterval has a rectangle of height 0.
In this example, these rectangles seem to be the mirror image of those found in Figure 5.3.5.(a). This is because of the symmetry of our shaded region. Our approximation gives the same answer as before, though calculated a different way:
\begin{align*} \amp f(1)\cdot 1 + f(2)\cdot 1+ f(3)\cdot 1+f(4)\cdot 1\\ \amp =3+4+3+0= 10\text{.} \end{align*}
Figure 5.3.5.(c) shows 4 rectangles drawn under \(f\) using the Midpoint Rule.
This gives an approximation of \(\int_0^4(4x-x^2)\, dx\) as:
\begin{align*} f(0.5)\cdot 1 + f(1.5)\cdot 1+ f(2.5)\cdot 1 \amp +f(3.5)\cdot 1\\ \amp =1.75+3.75+3.75+1.75 = 11\text{.} \end{align*}
Our three methods provide two approximations of \(\int_0^4(4x-x^2)\, dx\text{:}\) 10 and 11.
A parabola approximated using the Left Hand Rule.
The parabola in Figure 5.3.1 approximated using 4 strips of width 1. The height of each strip is fiven by the left hand rule. The first strip has a height of 0, and an area of 0. The second strip has a height of 3, and an area of 3. The third strip has a height of 4, and an area of 4. The fourth strip has a height of 3, and an area of 3. Each rectangle touches the curve in the top left corner.
(a) using the Left Hand Rule
A parabola approximated using the Right Hand Rule.
The parabola in Figure 5.3.1 approximated using 4 strips of width 1. The height of each strip is fiven by the right hand rule. The first strip has height of 3, and an area of 3. The second strip has height of 4, and an area of 4. The third strip has height of 3, and an area of 3. The fourth strip has height of 0, and an area of 0. Each rectangle touches the curve in the top right corner.
(b) using the Right Hand Rule
A parabola approximated using the Midpoint Rule
The parabola in Figure 5.3.1 approximated using 4 strips of width 1. The height of each strip is fiven by the Midpoint Rule. The first strip has a height and area of 1.75. The second strip has a height and area of 3.75. The third strip has a height and area of 3.75. The fourth strip has a height and area of 1.75. Each rectangle touches the curve in the top center of the rectangle.
(c) using the Midpoint Rule
Figure 5.3.5. Approximating \(\int_0^4(4x-x^2)\, dx\) in Example 5.3.4

Subsection 5.3.1 Summation Notation

It is hard to tell at this moment which is a better approximation: 10 or 11? We can continue to refine our approximation by using more rectangles. The notation can become unwieldy, though, as we add up longer and longer lists of numbers. We introduce summation notation to ameliorate this problem.
Suppose we wish to add up a list of numbers \(a_1\text{,}\) \(a_2\text{,}\) \(a_3\text{,}\) …, \(a_9\text{.}\) Instead of writing
\begin{equation*} a_1+a_2+a_3+a_4+a_5+a_6+a_7+a_8+a_9\text{,} \end{equation*}
we use summation notation and write \(\sum_{i=1}^9 a_i\text{.}\) The upper case sigma, \(Sigma\) represents the term “sum”. The index (counter) of summation in this example is \(i\text{;}\) any symbol can be used. By convention, the index takes on only the integer values between (and including) the lower and upper bounds. To the right of \(\Sigma\text{,}\) the expression \(a_i\) is called the summand. It tells us what we are summing. This is summarized in Equation (5.3.1).
\begin{equation} \sum_{\underbrace{i=1}_{i \text{-index of summation}}}^{\overbrace{9}^\text{upper bound}} \underbrace{a_i}_\text{summand}\tag{5.3.1} \end{equation}
Let’s practice using this notation.

Example 5.3.6. Using summation notation.

Let the numbers \(\{a_i\}\) be defined as \(a_i = 2i-1\) for integers \(i\text{,}\) where \(i\geq 1\text{.}\) So \(a_1 = 1\text{,}\) \(a_2 = 3\text{,}\) \(a_3 = 5\text{,}\) etc. (The output is the positive odd integers). Evaluate the following summations:
  1. \(\displaystyle \sum_{i=1}^6 a_i \)
  2. \(\displaystyle \sum_{i=3}^7 (3a_i-4) \)
  3. \(\displaystyle \sum_{i=1}^4 (a_i)^2 \)
Solution.
  1. \begin{align*} \sum_{i=1}^6 a_i \amp = a_1+a_2+a_3+a_4+a_5+a_6\\ \amp = 1+3+5+7+9+11\\ \amp = 36\text{.} \end{align*}
  2. Note the starting value is different than 1:
    \begin{align*} \sum_{i=3}^7 (3a_i-4) \amp = (3a_3-4)+(3a_4-4)+(3a_5-4)+(3a_6-4)+(3a_7-4)\\ \amp = 11+17+23+29+35\\ \amp = 115\text{.} \end{align*}
  3. \begin{align*} \sum_{i=1}^4 (a_i)^2 \amp = (a_1)^2+(a_2)^2+(a_3)^2+(a_4)^2\\ \amp = 1^2+3^2+5^2+7^2\\ \amp = 84\text{.} \end{align*}
It might seem odd to stress a new, concise way of writing summations only to write each term out as we add them up. It is. The following theorem gives some of the properties of summations that allow us to work with them without writing individual terms. Examples will follow.

Example 5.3.8. Evaluating summations using Theorem 5.3.7.

Revisit Example 5.3.6 and, using Theorem 5.3.7, evaluate
\begin{equation*} \sum_{i=1}^6 a_i = \sum_{i=1}^6 (2i-1)\text{.} \end{equation*}
Solution.
\begin{align*} \sum_{i=1}^6 (2i-1) \amp = \sum_{i=1}^6 2i - \sum_{i=1}^6 (1)\\ \amp = \left(2\sum_{i=1}^6 i \right)- 6\\ \amp = 2\frac{6(6+1)}{2} - 6\\ \amp = 42-6 = 36 \end{align*}
We obtained the same answer without writing out all six terms. When dealing with small sizes of \(n\text{,}\) it may be faster to write the terms out by hand. However, Theorem 5.3.7 is incredibly important when dealing with large sums as we’ll soon see.

Subsection 5.3.2 Riemann Sums

Consider again \(\int_0^4(4x-x^2)\, dx\text{.}\) We will approximate this definite integral using 16 equally spaced subintervals and the Right Hand Rule in Example 5.3.10. Before doing so, it will pay to do some careful preparation.
A number line between 0 and 4 divided into 16 sections
A number line ranging between 0 and 4. The space between each number is divided into 4 equal sections, giving a total of 16 equal sections. \(x_0\) is written under 0. \(x_4\) is written under 1. \(x_8\) is written under 2. \(x_12\) is written under 3. \(x_16\) is written under 4.
Figure 5.3.9. Dividing \([0,4]\) into 16 equally spaced subintervals
Figure 5.3.9 shows a number line of \([0,4]\) divided, or partitioned, into 16 equally spaced subintervals. We denote \(0\) as \(x_0\text{;}\) we have marked the values of \(x_4\text{,}\) \(x_8\text{,}\) \(x_{12}\) and \(x_{16}\text{.}\) We could mark them all, but the figure would get crowded. While it is easy to figure that \(x_{9} = 2.25\text{,}\) in general, we want a method of determining the value of \(x_i\) without consulting the figure. Consider:
A labeled equation for caclulating values at subintervals
The equation \(x_i = x_0 + i\Delta x\text{,}\) with labels for each component. \(x_0\) is labeled as the starting value. \(i\) is labeled as the numer of subintervals between \(x_0\) and \(x_i\text{.}\) \(\Delta x\) is labeled as the subinterval size.
So \(x_{9} = x_0 + 9(4/16) = 2.25\text{.}\)
If we had partitioned \([0,4]\) into 100 equally spaced subintervals, each subinterval would have length \(\Delta x=4/100 = 0.04\text{.}\) We could compute \(x_{31}\) as
\begin{equation*} x_{31} = x_0 + 31(4/100) = 1.24\text{.} \end{equation*}
(That was far faster than creating a sketch first.)
Given any subdivision of \([0,4]\text{,}\) the first subinterval is \([x_0,x_1]\text{;}\) the second is \([x_1,x_2]\text{;}\) the \(i\)th subinterval is \([x_{i-1},x_{i}]\text{.}\)
When using the Left Hand Rule, the height of the \(i\)th rectangle will be \(f(x_{i-1})\text{.}\)
When using the Right Hand Rule, the height of the \(i\)th rectangle will be \(f(x_{i})\text{.}\)
When using the Midpoint Rule, the height of the \(i\)th rectangle will be \(\ds f\left(\frac{x_{i-1}+x_{i}}2\right)\text{.}\)
Thus approximating \(\int_0^4(4x-x^2)\, dx\) with 16 equally spaced subintervals can be expressed as follows, where \(\Delta x = 4/16 = 1/4\text{:}\)
Left Hand Rule
\(\displaystyle \ds \sum_{i=1}^{16} f(x_{i-1})\Delta x\)
Right Hand Rule
\(\displaystyle \ds \sum_{i=1}^{16} f(x_{i})\Delta x\)
Midpoint Rule
\(\displaystyle \ds \sum_{i=1}^{16} f\left(\frac{x_{i-1}+x_{i}}2\right)\Delta x\)
We use these formulas in the next two examples. The following example lets us practice using the Right Hand Rule and the summation formulas introduced in Theorem 5.3.7.

Example 5.3.10. Approximating definite integrals using sums.

Approximate \(\int_0^4(4x-x^2)\, dx\) using the Right Hand Rule and summation formulas with 16 and 1000 equally spaced intervals.
Solution.
Using the formula derived before, using 16 equally spaced intervals and the Right Hand Rule, we can approximate the definite integral as
\begin{equation*} \sum_{i=1}^{16}f(x_{i})\Delta x\text{.} \end{equation*}
We have \(\Delta x = 4/16 = 0.25\text{.}\) Since \(x_i = 0+i\Delta x\text{,}\) we have
\begin{equation*} x_{i} = 0 + i\Delta x = i\Delta x\text{.} \end{equation*}
Using the summation formulas, consider:
\begin{align} \int_0^4 (4x-x^2)\, dx \amp \approx \sum_{i=1}^{16} f(x_{i})\Delta x\notag\\ \amp = \sum_{i=1}^{16} f(i\Delta x) \Delta x\notag\\ \amp = \sum_{i=1}^{16} \big(4i\Delta x - (i\Delta x)^2\big)\Delta x\notag\\ \amp = \sum_{i=1}^{16} (4i\Delta x^2 - i^2\Delta x^3)\notag\\ \amp = (4\Delta x^2)\sum_{i=1}^{16} i - \Delta x^3 \sum_{i=1}^{16} i^2\tag{5.3.2}\\ \amp = (4\Delta x^2)\frac{16\cdot 17}{2} - \Delta x^3 \frac{16(17)(33)}6\notag\\ \amp = 4\cdot 0.25^2\cdot 136-0.25^3\cdot 1496\notag\\ \amp =10.625\notag \end{align}
We were able to sum up the areas of 16 rectangles with very little computation. In Figure 5.3.11 the function and the 16 rectangles are graphed. While some rectangles over-approximate the area, other under-approximate the area (by about the same amount). Thus our approximate area of 10.625 is likely a fairly good approximation.
Notice Equation (5.3.2); by replacing 16 by 1,000 (and appropriately changing the value of \(\Delta x\)), we can use that equation to sum up 1000 rectangles!
A parabola approximated using 16 equal subintervals.
The parabola in Figure 5.3.1 approximated using 16 strips of equal width. The height of each strips are given by the Right Hand Rule. On the left side the area of the rectangles is slightly greater than the area of the parabola. On the right side the area of the rectangles is slightly less than the area of the parabola.
Figure 5.3.11. Approximating \(\int_0^4(4x-x^2)\, dx\) with the Right Hand Rule and 16 evenly spaced subintervals
We do so here, skipping from the original summand to the equivalent of Equation (5.3.2) to save space. Note that \(\Delta x = 4/1000 = 0.004\text{.}\)
\begin{align*} \int_0^4 (4x-x^2)\, dx \amp \approx \sum_{i=1}^{1000} f(x_{i})\Delta x\\ \amp = (4\Delta x^2)\sum_{i=1}^{1000} i - \Delta x^3 \sum_{i=1}^{1000} i^2\\ \amp = (4\Delta x^2)\frac{1000\cdot 1001}{2} - \Delta x^3 \frac{1000(1001)(2001)}6\\ \amp =10.666656 \end{align*}
Using many, many rectangles, we have a likely good approximation of \(\int_0^4 (4x-x^2)\dx\text{.}\) That is,
\begin{equation*} \int_0^4(4x-x^2)\, dx \approx 10.666656\text{.} \end{equation*}
Before the above example, we stated what the summations for the Left Hand, Right Hand and Midpoint Rules looked like. Each had the same basic structure, which was:
  1. each rectangle has the same width, which we referred to as \(\Delta x\text{,}\) and
  2. each rectangle’s height is determined by evaluating \(f\) at a particular point in each subinterval. For instance, the Left Hand Rule states that each rectangle’s height is determined by evaluating \(f\) at the left hand endpoint of the subinterval the rectangle lives on.
One could partition an interval \([a,b]\) with subintervals that do not have the same size. We refer to the length of the \(i\)th subinterval as \(\Delta x_i\text{.}\) Also, one could determine each rectangle’s height by evaluating \(f\) at any point \(c_i\) in the \(i\)th subinterval. Thus the height of the \(i\)th subinterval would be \(f(c_i)\text{,}\) and the area of the \(i\)th rectangle would be \(f(c_i)\Delta x_i\text{.}\) These ideas are formally defined below.

Definition 5.3.12. Partition.

A partition \(\Delta x\) of a closed interval \([a,b]\) is a set of numbers \(x_0\text{,}\) \(x_1\text{,}\) \(\ldots\) \(x_{n}\) where
\begin{equation*} a=x_0 \lt x_1 \lt \ldots \lt x_{n-1} \lt x_{n}=b\text{.} \end{equation*}
The length of the \(i\)th subinterval, \([x_{i-1},x_{i}]\text{,}\) is \(\Delta x_i = x_{i}-x_{i-1}\text{.}\) If \([a,b]\) is partitioned into subintervals of equal length, we let \(\Delta x\) represent the length of each subinterval.
The size of the partition, denoted \(\norm{\Delta x}\text{,}\) is the length of the largest subinterval of the partition.
Summations of rectangles with area \(f(c_i)\Delta x_i\) are named after mathematician Georg Friedrich Bernhard Riemann, as given in the following definition.

Definition 5.3.13. Riemann Sum.

Let \(f\) be defined on a closed interval \([a,b]\text{,}\) let \(\Delta x\) be a partition of \([a,b]\) as given in Definition 5.3.12, and let \(c_i\) denote any value in the \(i\)th subinterval.
The sum
\begin{equation*} \sum_{i=1}^n f(c_i)\Delta x_i \end{equation*}
is a Riemann sum of \(f\) on \([a,b]\text{.}\)
Figure 5.3.14 shows the approximating rectangles of a Riemann sum of \(\int_0^4(4x-x^2)\, dx\text{.}\) While the rectangles in this example do not approximate well the shaded area, they demonstrate that the subinterval widths may vary and the heights of the rectangles can be determined without following a particular rule.
A parabola approximated by 3 rectangles of different width
The parabola in Figure 5.3.1 approximated using 3 rectangles of different width. The height of each rectangle is not given by any particular rule. The left most strip has a width of 2, and a height of around 0.95. This height is given by a point at around \(x=0.3\text{.}\) The center strip has a width of 2.5. It has a height of around 2.8, given by a point at around \(x=3.2\text{.}\) The right strip has a width of 0.5. It has a height of around 0.8, given by a point around \(x=3.8\text{.}\)
Figure 5.3.14. An example of a general Riemann sum to approximate \(\int_0^4(4x-x^2)\, dx\)
“Usually” Riemann sums are calculated using one of the three methods we have introduced. The uniformity of construction makes computations easier. Before working another example, let’s summarize some of what we have learned in a convenient way.

Key Idea 5.3.15. Riemann Sum Concepts.

Consider \(\ds \int_a^b f(x) \, dx \approx \sum_{i=1}^n f(c_i)\Delta x_i\text{.}\)
  1. When the \(n\) subintervals have equal length, \(\ds \Delta x_i = \Delta x = \frac{b-a}n\text{.}\)
  2. The \(i\)th term of an equally spaced partition is \(x_i = a + i\Delta x\text{.}\) (Thus \(x_0=a\) and \(x_{n} = b\text{.}\))
  3. The Left Hand Rule summation is: \(\ds \sum_{i=1}^n f(x_{i-1})\Delta x\text{.}\)
  4. The Right Hand Rule summation is: \(\ds \sum_{i=1}^n f(x_{i})\Delta x\text{.}\)
  5. The Midpoint Rule summation is: \(\ds \sum_{i=1}^n f\left(\frac{x_{i-1}+x_{i}}{2}\right)\Delta x\text{.}\)
Let’s do another example.

Example 5.3.16. Approximating definite integrals with sums.

Approximate \(\int_{-2}^3 (5x+2)\, dx\) using the Midpoint Rule and 10 equally spaced intervals.
Solution.
Following Key Idea 5.3.15, we have
\begin{equation*} \Delta x = \frac{3 - (-2)}{10} = 1/2 \text{ and } x_i = (-2) + (1/2)(i) = i/2-2\text{.} \end{equation*}
As we are using the Midpoint Rule, we will also need \(x_{i-1}\) and \(\ds \frac{x_{i-1}+x_{i}}2\text{.}\) Since \(x_i = i/2-2\text{,}\)\(x_{i-1} = (i-1)/2 - 2 = i/2 -5/2\text{.}\) This gives
\begin{equation*} \frac{x_{i-1}+x_{i}}2 = \frac{(i/2-5/2) + (i/2-2)}{2} = \frac{i-9/2}{2} = i/2 - 9/4\text{.} \end{equation*}
We now construct the Riemann sum and compute its value using summation formulas.
\begin{align*} \int_{-2}^3 (5x+2)\, dx \amp \approx \sum_{i=1}^{10} f\left(\frac{x_{i-1}+x_{i}}{2}\right)\Delta x\\ \amp = \sum_{i=1}^{10} f(i/2 - 9/4)\Delta x\\ \amp = \sum_{i=1}^{10} \big(5(i/2-9/4) + 2\big)\Delta x\\ \amp = \Delta x\sum_{i=1}^{10}\left[\left(\frac{5}{2}\right)i - \frac{37}{4}\right]\\ \amp = \Delta x\left(\frac{5}2\sum_{i=1}^{10} (i) - \sum_{i=1}^{10}\left(\frac{37}{4}\right)\right)\\ \amp = \frac12\left(\frac52\cdot\frac{10(11)}{2} - 10\cdot\frac{37}4\right)\\ \amp = \frac{45}2 = 22.5 \end{align*}
The area under a line approximated with 10 even subintervals.
The graph \(5x + 2\text{,}\) plotted from \(x = -2\) to \(x = 3\text{.}\) The line begins in the third quadrant and crosses the \(x\)-axis at \(x = -\frac{2}{5}\text{.}\) The line crosses the \(y\)-axis at \(y=2\text{.}\) The area between the line and the \(x\)-axis is shaded. 10 rectangles of equal width are approximating the shaded area. The height of each rectangle is given by the Midpoint Rule.
Figure 5.3.17. Approximating \(\int_{-2}^3 (5x+2)\, dx\) using the Midpoint Rule and 10 evenly spaced subintervals in Example 5.3.16
Note the graph of \(f(x) = 5x+2\) in Figure 5.3.17. The regions whose area is computed by the definite integral are triangles, meaning we can find the exact answer without summation techniques. We find that the exact answer is indeed 22.5. One of the strengths of the Midpoint Rule is that often each rectangle includes area that should not be counted, but misses other area that should. When the partition size is small, these two amounts are about equal and these errors almost “cancel each other out.” In this example, since our function is a line, these errors are exactly equal and they do cancel each other out, giving us the exact answer.
Note too that when the function is negative, the rectangles have a “negative” height. When we compute the area of the rectangle, we use \(f(c_i)\Delta x\text{;}\) when \(f\) is negative, the area is counted as negative.
Notice in the previous example that while we used 10 equally spaced intervals, the number “10” didn’t play a big role in the calculations until the very end. Mathematicians love to abstract ideas; let’s approximate the area of another region using \(n\) subintervals, where we do not specify a value of \(n\) until the very end.

Example 5.3.18. Approximating definite integrals with a formula, using sums.

Revisit \(\int_0^4(4x-x^2)\, dx\) yet again. Approximate this definite integral using the Right Hand Rule with \(n\) equally spaced subintervals.
Solution.
Using Key Idea 5.3.15, we know \(\Delta x = \frac{4-0}{n} = 4/n\text{.}\) We also find \(x_i = 0 + i\Delta x = 4i/n\text{.}\)
We construct the Right Hand Rule Riemann sum as follows. Be sure to follow each step carefully. If you get stuck, and do not understand how one line proceeds to the next, you may skip to the result and consider how this result is used. You should come back, though, and work through each step for full understanding.
\begin{align*} \int_0^4(4x-x^2)\, dx \amp \approx \sum_{i=1}^n f(x_{i})\Delta x\\ \amp = \sum_{i=1}^n f\left(\frac{4i}{n}\right) \Delta x\\ \amp = \sum_{i=1}^n \left[4\frac{4i}n-\left(\frac{4i}n\right)^2\right]\Delta x\\ \amp = \sum_{i=1}^n \left(\frac{16\Delta x}{n}\right)i - \sum_{i=1}^n \left(\frac{16\Delta x}{n^2}\right)i^2\\ \amp = \left(\frac{16\Delta x}{n}\right)\sum_{i=1}^n i - \left(\frac{16\Delta x}{n^2}\right)\sum_{i=1}^n i^2\\ \amp = \left(\frac{16\Delta x}{n}\right)\cdot \frac{n(n+1)}{2} - \left(\frac{16\Delta x}{n^2}\right)\frac{n(n+1)(2n+1)}{6}\\ \amp =\frac{32(n+1)}{n} - \frac{32(n+1)(2n+1)}{3n^2} (\text{ recall } \Delta x = 4/n)\\ \amp = \frac{32}{3}\left(1-\frac{1}{n^2}\right) \text{ (after simplifying) } \end{align*}
The result is an amazing, easy to use formula. To approximate the definite integral with 10 equally spaced subintervals and the Right Hand Rule, set \(n=10\) and compute
\begin{equation*} \int_0^4 (4x-x^2)\, dx \approx \frac{32}{3}\left(1-\frac{1}{10^2}\right) = 10.56\text{.} \end{equation*}
Recall how earlier we approximated the definite integral with 4 subintervals; with \(n=4\text{,}\) the formula gives 10, our answer as before.
It is now easy to approximate the integral with 1,000,000 subintervals! Hand-held calculators will round off the answer a bit prematurely giving an answer of \(10.66666667\text{.}\) (The actual answer is \(10.666666666656\text{.}\))
We now take an important leap. Up to this point, our mathematics has been limited to geometry and algebra (finding areas and manipulating expressions). Now we apply calculus. For any finite \(n\text{,}\) we know that
\begin{equation*} \int_0^4 (4x-x^2)\, dx \approx \frac{32}{3}\left(1-\frac{1}{n^2}\right)\text{.} \end{equation*}
Both common sense and high-level mathematics tell us that as \(n\) gets large, the approximation gets better. In fact, if we take the limit as \(n\rightarrow \infty\text{,}\) we get the exact area described by \(\int_0^4 (4x-x^2)\, dx\text{.}\) That is,
\begin{align*} \int_0^4 (4x-x^2)\, dx \amp = \lim_{n\rightarrow \infty} \frac{32}{3}\left(1-\frac{1}{n^2}\right)\\ \amp = \frac{32}{3}\left(1-0\right)\\ \amp = \frac{32}{3} = 10.\overline{6} \end{align*}
This is a fantastic result. By considering \(n\) equally-spaced subintervals, we obtained a formula for an approximation of the definite integral that involved our variable \(n\text{.}\) As \(n\) grows large — without bound — the error shrinks to zero and we obtain the exact area.
This section started with a fundamental calculus technique: make an approximation, refine the approximation to make it better, then use limits in the refining process to get an exact answer. That is precisely what we just did.
Let’s practice this again.

Example 5.3.19. Approximating definite integrals with a formula, using sums.

Find a formula that approximates \(\int_{-1}^5 x^3\, dx\) using the Right Hand Rule and \(n\) equally spaced subintervals, then take the limit as \(n\to\infty\) to find the exact area.
Solution.
Following Key Idea 5.3.15, we have \(\Delta x = \frac{5-(-1)}{n} = 6/n\text{.}\) We have \(x_i = (-1) + i\Delta x\text{,}\) which is the right endpoint of the \(i\)th subinterval.
The Riemann sum corresponding to the Right Hand Rule is (followed by simplifications):
\begin{align*} \int_{-1}^5 x^3\, dx \amp \approx \sum_{i=1}^n f(x_{i})\Delta x\\ \amp = \sum_{i=1}^n f(-1+i\Delta x)\Delta x\\ \amp = \sum_{i=1}^n (-1+i\Delta x)^3\Delta x\\ \amp = \sum_{i=1}^n \big((i\Delta x)^3 -3(i\Delta x)^2 + 3i\Delta x -1\big)\Delta x \text{ (now distribute \(\Delta x\)) }\\ \amp = \sum_{i=1}^n \big(i^3\Delta x^4 - 3i^2\Delta x^3 + 3i\Delta x^2 -\Delta x\big) \text{ (now split up summation) }\\ \amp = \Delta x^4 \sum_{i=1}^ni^3 -3\Delta x^3 \sum_{i=1}^n i^2+ 3\Delta x^2 \sum_{i=1}^n i - \sum_{i=1}^n \Delta x\\ \amp = \Delta x^4 \left(\frac{n(n+1)}{2}\right)^2 -3\Delta x^3 \frac{n(n+1)(2n+1)}{6}+ 3\Delta x^2 \frac{n(n+1)}{2} - n\Delta x\\ \end{align*}
(use \(\Delta x = 6/n\))
\begin{align*} \amp = \frac{1296}{n^4}\cdot\frac{n^2(n+1)^2}{4} - 3\frac{216}{n^3}\cdot\frac{n(n+1)(2n+1)}{6} + 3\frac{36}{n^2}\frac{n(n+1)}2 -6\\ \end{align*}
(now do a sizable amount of algebra to simplify)
\begin{align*} \amp =156 + \frac{378}n + \frac{216}{n^2} \end{align*}
Once again, we have found a compact formula for approximating the definite integral with \(n\) equally spaced subintervals and the Right Hand Rule. Using 10 subintervals, we have an approximation of \(195.96\) (these rectangles are shown in Figure 5.3.20). Using \(n=100\) gives an approximation of \(159.802\text{.}\)
A cubic graph approximated using 10 subintervals and the Right Hand Rule.
The curve begins at \(x=-1\text{,}\) at which point the curve is close to the \(x\)-axis. The curve increases to the right, ending at \(x=5\text{,}\) at which point the curve has a value of 125. The area under the curve is approsimated by 10 rectangles of equal width. The height of each rectangle is given by the Right Hand Rule. The left of each rectangle includes some unshaded area, so each rectangle overestimates the area under the curve.
Figure 5.3.20. Approximating \(\int_{-1}^5 x^3\, dx\) using the Right Hand Rule and 10 evenly spaced subintervals
Now find the exact answer using a limit:
\begin{equation*} \int_{-1}^5 x^3\, dx = \lim_{n\to\infty} \left(156 + \frac{378}n + \frac{216}{n^2}\right) = 156\text{.} \end{equation*}

Subsection 5.3.3 Limits of Riemann Sums

We have used limits to evaluate given definite integrals. Will this always work? It can be shown, given not-very-restrictive conditions, that yes, it will always work — this is the content of Theorem 5.3.21 below.
The previous two examples demonstrated how an expression such as
\begin{equation*} \sum_{i=1}^n f(x_{i})\Delta x \end{equation*}
can be rewritten as an expression explicitly involving \(n\text{,}\) such as \(32/3(1-1/n^2)\text{.}\)
Viewed in this manner, we can think of the summation as a function of \(n\text{.}\) An \(n\) value is given (where \(n\) is a positive integer), and the sum of areas of \(n\) equally spaced rectangles is returned, using the Left Hand, Right Hand, or Midpoint Rules.
Given a definite integral \(\int_a^b f(x)\, dx\text{,}\) let:
  • \(\ds S_L(n) = \sum_{i=1}^n f(x_{i-1})\Delta x\text{,}\) the sum of equally spaced rectangles formed using the Left Hand Rule,
  • \(\ds S_R(n) = \sum_{i=1}^n f(x_{i})\Delta x\text{,}\) the sum of equally spaced rectangles formed using the Right Hand Rule, and
  • \(\ds S_M(n) = \sum_{i=1}^n f\left(\frac{x_{i-1}+x_{i}}{2}\right)\Delta x\text{,}\) the sum of equally spaced rectangles formed using the Midpoint Rule.
Recall the definition of a limit as \(n\to\infty\text{:}\) \(\lim\limits_{n\to\infty}S_L(n) = K\) if, given any \(\varepsilon \gt 0\text{,}\) there exists \(N \gt 0\) such that
\begin{equation*} \abs{S_L(n)-K} \lt \varepsilon \text{ when } n\geq N\text{.} \end{equation*}
The following theorem states that we can use any of our three rules to find the exact value of a definite integral \(\int_a^b f(x)\, dx\text{.}\) It also goes two steps further. The theorem states that the height of each rectangle doesn’t have to be determined following a specific rule, but could be \(f(c_i)\text{,}\) where \(c_i\) is any point in the \(i\)th subinterval, as discussed before Riemann Sums were defined in Definition 5.3.13.
The theorem goes on to state that the rectangles do not need to be of the same width. Using the notation of Definition 5.3.12, let \(\Delta x_i\) denote the length of the \(i\)th subinterval in a partition of \([a,b]\) and let \(\norm{\Delta x}\) represent the length of the largest subinterval in the partition: that is, \(\norm{\Delta x}\) is the largest of all the \(\Delta x_i\text{.}\) If \(\norm{\Delta x}\) is small, then \([a,b]\) must be partitioned into many subintervals, since all subintervals must have small lengths. “Taking the limit as \(\norm{\Delta x}\) goes to zero” implies that the number \(n\) of subintervals in the partition is growing to infinity, as the largest subinterval length is becoming arbitrarily small. We then interpret the expression
\begin{equation*} \lim_{\norm{\Delta x}\to 0}\sum_{i=1}^nf(c_i)\Delta x_i \end{equation*}
as “the limit of the sum of the areas of rectangles, where the width of each rectangle can be different but getting small, and the height of each rectangle is not necessarily determined by a particular rule.” The theorem states that this Riemann Sum also gives the value of the definite integral of \(f\) over \([a,b]\text{.}\)
We summarize what we have learned over the past few sections here.
  • Knowing the “area under the curve” can be useful. One common example: the area under a velocity curve is displacement.
  • We have defined the definite integral, \(\int_a^b f(x)\, dx\text{,}\) to be the signed area under \(f\) on the interval \([a,b]\text{.}\)
  • While we can approximate a definite integral many ways, we have focused on using rectangles whose heights can be determined using the Left Hand Rule, the Right Hand Rule and the Midpoint Rule.
  • Sums of rectangles of this type are called Riemann sums.
  • The exact value of the definite integral can be computed using the limit of a Riemann sum. We generally use one of the above methods as it makes the algebra simpler.
We first learned of derivatives through limits then learned rules that made the process simpler. We know of a way to evaluate a definite integral using limits; in the next section we will see how the Fundamental Theorem of Calculus makes the process simpler. The key feature of this theorem is its connection between the indefinite integral and the definite integral.

Exercises 5.3.4 Exercises

Terms and Concepts

1.
A fundamental calculus technique is to use to refine approximations to get an exact answer.
2.
What is the upper bound in the summation \(\sum\limits_{i=8}^{20} ({40i-80})\text{?}\)
3.
This section approximates definite integrals using what geometric shape?
4.
  • True
  • False
A sum using the Right Hand Rule is an example of a Riemann Sum.

Problems

Exercise Group.
Write out each term of the summation and compute the sum.
5.
\(\sum\limits_{i=2}^{5} i^2\)
6.
\(\sum\limits_{i=-3}^{2} \left({2i-2}\right)\)
7.
\(\sum\limits_{i=-2}^{1} {\sin\mathopen{}\left(\frac{\pi i}{2}\right)}\)
8.
\(\sum\limits_{i=1}^{7} {9}\)
9.
\(\sum\limits_{i=1}^{5} {\frac{1}{i}}\)
10.
\(\sum\limits_{i=1}^{7} {\left(-1\right)^{i}i}\)
11.
\(\sum\limits_{i=1}^{5} \left({\frac{1}{i}-\frac{1}{i+1}}\right)\)
12.
\(\sum\limits_{i=1}^{5} {\left(-1\right)^{i}\cos\mathopen{}\left(\pi i\right)}\)
Exercise Group.
Write the sum in summation notation.
13.
\({3+6+9+12}\)
14.
\({1+2+5+10+17+26}\)
15.
\({{\frac{1}{4}}+{\frac{2}{5}}+{\frac{3}{6}}+{\frac{4}{7}}}\)
16.
\({1-e+e^{2}-e^{3}+e^{4}}\)
Exercise Group.
Evaluate the summation using Theorem 5.3.7.
17.
\(\sum\limits_{i=1}^{7} {8}\)
18.
\(\sum\limits_{i=1}^{26} {i}\)
19.
\(\sum\limits_{i=1}^{11} \left({2i^{2}-i}\right)\)
20.
\(\sum\limits_{i=1}^{19} \left({5i^{3}+7}\right)\)
21.
\(\sum\limits_{i=1}^{12} \left({-4i^{3}-7i^{2}-10i+7}\right)\)
22.
\(\sum\limits_{i=1}^{8} \left({i^{3}-9i^{2}+4i+7}\right)\)
23.
\(1+2+3+\cdots+84+85\)
24.
\(1+4+9+\cdots+361+400\)
Exercise Group.
Theorem 5.3.7 states \(\sum\limits_{i=1}^na_i = \sum\limits_{i=1}^k a_i + \sum\limits_{i=k+1}^n a_i\text{,}\) so \(\sum\limits_{i=k+1}^na_i = \sum\limits_{i=1}^n a_i - \sum\limits_{i=1}^k a_i\text{.}\) Use this fact, along with other parts of Theorem 5.3.7, to evaluate the summation.
25.
\(\sum\limits_{i=9}^{21} {i}\)
26.
\(\sum\limits_{i=16}^{27} {i^{3}}\)
27.
\(\sum\limits_{i=7}^{13} {7}\)
28.
\(\sum\limits_{i=7}^{15} {4i^{3}}\)
Exercise Group.
In the following exercises, a definite integral \(\ds \int_a^b f(x) \, dx\) is given.
  1. Graph \(f(x)\) on \([a,b]\text{.}\)
  2. Add to the sketch rectangles using the provided rule.
  3. Approximate \(\ds \int_a^b f(x) \, dx\) by summing the areas of the rectangles.
29.
\(\ds \int_{-3}^3 x^2\, dx\text{,}\) with \(6\) rectangles using the Left Hand Rule.
30.
\(\ds \int_{0}^2 (5-x^2)\, dx\text{,}\) with \(4\) rectangles using the Midpoint Rule.
31.
\(\ds \int_{0}^\pi \sin(x) \, dx\text{,}\) with \(6\) rectangles using the Right Hand Rule.
32.
\(\ds \int_{0}^3 2^x\, dx\text{,}\) with \(5\) rectangles using the Left Hand Rule.
33.
\(\ds \int_{1}^2 \ln(x) \, dx\text{,}\) with \(3\) rectangles using the Midpoint Rule.
34.
\(\ds \int_{1}^9 \frac1x\, dx\text{,}\) with \(4\) rectangles using the Right Hand Rule.
Exercise Group.
A definite integral is given below. As demonstrated in Examples 5.3.18 and 5.3.19, do the following:
  1. Find a formula to approximate the definite integral using \(n\) subintervals and the provided rule.
  2. Evaluate the formula using \(n=10\text{,}\) \(100\text{,}\) and \(1000\text{.}\)
  3. Find the limit of the formula, as \(n\to \infty\text{,}\) to find the exact value of the definite integral.
35.
\(\ds \int_{0}^1 x^3\, dx\text{,}\) using the Right Hand Rule.
36.
\(\ds \int_{-2}^{1} 4x^2\, dx\text{,}\) using the Right Hand Rule.
37.
\(\ds \int_{-2}^{4} \left({3x-1}\right)\, dx\text{,}\) using the Midpoint Rule.
38.
\(\ds \int_{2}^{6} \left({2x^{2}+1}\right)\, dx\text{,}\) using the Left Hand Rule.
39.
\(\ds \int_{-11}^{11} \left({4-x}\right)\, dx\text{,}\) using the Left Hand Rule.
40.
\(\ds \int_{0}^{1} \left({x^{3}-x^{2}}\right)\, dx\text{,}\) using the Left Hand Rule.