# 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 exactly what we will do here.

Consider the region given in Figure \(\PageIndex{1}\), which is the area under \(y=4x-x^2\) on \([0,4]\). What is the signed area of this region -- i.e., what is \(\int_0^4(4x-x^2)dx\)?

** Figure \(\PageIndex{1}\): **A graph of \(f(x) = 4x-x^2\). 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.

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 4 rectangles of equal width of 1. This *partitions* the interval \([0,4]\) into 4 *subintervals*, \([0,1]\), \([1,2]\), \([2,3]\) and \([3,4]\). 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 \(\PageIndex{2}\), the rectangle drawn on the interval \([2,3]\) has height determined by the Left Hand Rule; it has a height of \(f(2)\). (The rectangle is labeled "LHR.")

** Figure \(\PageIndex{2}\): **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)\). 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)\), 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]\). (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 \(\PageIndex{1}\): 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 \(\PageIndex{3}\) 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.)

**Figure \(\PageIndex{3}\):** Approximating \(\int_0^4(4x-x^2)dx\) using the Left Hand Rule in Example \(\PageIndex{1}\)

Note how in the first subinterval, \([0,1]\), the rectangle has height \(f(0)=0\). We add up the areas of each rectangle (height\(\times\) width) for our Left Hand Rule approximation:

\[\begin{align} f(0)\cdot 1 + f(1)\cdot 1+ f(2)\cdot 1+f(3)\cdot 1 &=\\ 0+3+4+3&= 10. \end{align}\]

Figure \(\PageIndex{4}\) shows 4 rectangles drawn under \(f\) using the Right Hand Rule; note how the \([3,4]\) subinterval has a rectangle of height 0.

**Figure \(\PageIndex{4}\):** Approximating \(\int_0^4(4x-x^2)dx\) using the Right Hand Rule in Example \(\PageIndex{1}\)

In this example, these rectangle seem to be the mirror image of those found in Figure \(\PageIndex{3}\). (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} f(1)\cdot 1 + f(2)\cdot 1+ f(3)\cdot 1+f(4)\cdot 1 &=\\ 3+4+3+0&= 10. \end{align}\]

Figure \(\PageIndex{5}\) shows 4 rectangles drawn under \(f\) using the Midpoint Rule.

**Figure \(\PageIndex{5}\):** Approximating \(\int_0^4(4x-x^2)dx\) using the Midpoint Rule in Example \(\PageIndex{1}\)

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+f(3.5)\cdot 1 &=\\ 1.75+3.75+3.75+1.75&= 11. \end{align}\]

Our three methods provide two approximations of \(\int_0^4(4x-x^2)dx\): 10 and 11.

### 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\), \(a_2\), \(a_3\), \ldots, \(a_9\). Instead of writing

$$a_1+a_2+a_3+a_4+a_5+a_6+a_7+a_8+a_9,$$

we use summation notation and write

**Figure \(\PageIndex{6}\):** Understanding summation notation

The upper case sigma represents the term "sum." The index of summation in this example is \(i\); any symbol can be used. By convention, the index takes on only the integer values between (and including) the lower and upper bounds.

Let's practice using this notation.

Example \(\PageIndex{2}\): Using summation notation

Let the numbers \(\{a_i\}\) be defined as \(a_i = 2i-1\) for integers \(i\), where \(i\geq 1\). So \(a_1 = 1\), \(a_2 = 3\), \(a_3 = 5\), etc. (The output is the positive odd integers). Evaluate the following summations:

$$ 1.\ \sum_{i=1}^6 a_i \qquad\qquad\qquad 2.\ \sum_{i=3}^7 (3a_i-4)\qquad\qquad \qquad 3.\ \sum_{i=1}^4 (a_i)^2$$

**Solution**

- \[ \begin{align} \sum_{i=1}^6 a_i &= a_1+a_2+a_3+a_4+a_5+a_6\\ &= 1+3+5+7+9+11 \\ &= 36.\end{align}\]
- Note the starting value is different than 1: \[\begin{align} \sum_{i=3}^7 a_i &= (3a_3-4)+(3a_4-4)+(3a_5-4)+(3a_6-4)+(3a_7-4) \\ &= 11+17+23+29+35 \\ &= 115. \end{align}\]
- \[ \begin{align} \sum_{i=1}^4 (a_i)^2 &= (a_1)^2+(a_2)^2+(a_3)^2+(a_4)^2\\ &= 1^2+3^2+5^2+7^2 \\ &= 84 \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.

Theorem \(\PageIndex{1}\): Properties of Summations

- \( \sum_{i=1}^n c = c\cdot n\), where \(c\) is a constant.
- \( \sum_{i=m}^n (a_i\pm b_i) = \sum_{i=m}^n a_i \pm \sum_{i=m}^n b_i\)
- \(\sum_{i=m}^n c\cdot a_i = c\cdot\sum_{i=m}^n a_i\)
- \( \sum_{i=m}^j a_i + \sum_{i=j+1}^n a_i = \sum_{i=m}^n a_i\)
- \( \sum_{i=1}^n i = \frac{n(n+1)}2\)
- \( \sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}6\)
- \( \sum_{i=1}^n i^3 = \left(\frac{n(n+1)}2\right)^2\)

Example \(\PageIndex{3}\): Evaluating summations using Theorem\(\PageIndex{1}\)

Revisit Example \(\PageIndex{2}\) and, using Theorem \(\PageIndex{1}\), evaluate

$$\sum_{i=1}^6 a_i = \sum_{i=1}^6 (2i-1).$$

**Solution**

\[\begin{align} \sum_{i=1}^6 (2i-1) & = \sum_{i=1}^6 2i - \sum_{i=1}^6 (1)\\ &= \left(2\sum_{i=1}^6 i \right)- 6 \\ &= 2\frac{6(6+1)}{2} - 6 \\ &= 42-6 = 36 \end{align}\]

We obtained the same answer without writing out all six terms. When dealing with small sizes of \(n\), it may be faster to write the terms out by hand. However, Theorem \(\PageIndex{1}\) is incredibly important when dealing with large sums as we'll soon see.

### Riemann Sums

Consider again \(\int_0^4(4x-x^2)dx\). We will approximate this definite integral using 16 equally spaced subintervals and the Right Hand Rule in Example \(\PageIndex{4}\). Before doing so, it will pay to do some careful preparation.

**Figure \(\PageIndex{7}\):** Dividing \([0,4]\) into 16 equally spaced subintervals.

Figure \(\PageIndex{7}\) shows a number line of \([0,4]\) divided into 16 equally spaced subintervals. We denote \(0\) as \(x_1\); we have marked the values of \(x_5\), \(x_9\), \(x_{13}\) and \(x_{17}\). We could mark them all, but the figure would get crowded. While it is easy to figure that \(x_{10} = 2.25\), in general, we want a method of determining the value of \(x_i\) without consulting the figure. Consider:

So \(x_{10} = x_1 + 9(4/16) = 2.25.\)

If we had partitioned \([0,4]\) into 100 equally spaced subintervals, each subinterval would have length \(\Delta x=4/100 = 0.04\). We could compute \(x_{32}\) as

$$x_{32} = x_1 + 31(4/100) = 1.24.$$

(That was far faster than creating a sketch first.)

Given any subdivision of \([0,4]\), the first subinterval is \([x_1,x_2]\); the second is \([x_2,x_3]\); the \(i^\text{ th}\) subinterval is \([x_i,x_{i+1}]\).

When using the Left Hand Rule, the height of the \(i^\text{ th}\) rectangle will be \(f(x_i)\).

When using the Right Hand Rule, the height of the \(i^\text{ th}\) rectangle will be \(f(x_{i+1})\).

When using the Midpoint Rule, the height of the \(i^\text{ th}\) rectangle will be \( f\left(\frac{x_i+x_{i+1}}2\right)\).

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\):

**Left Hand Rule:** \(\sum_{i=1}^{16} f(x_i)\Delta x\)

**Right Hand Rule:** \(\sum_{i=1}^{16} f(x_{i+1})\Delta x\)

**Midpoint Rule:** \(\sum_{i=1}^{16} f\left(\frac{x_i+x_{i+1}}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 \(\PageIndex{1}\)

Example \(\PageIndex{4}\): 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

$$\sum_{i=1}^{16}f(x_{i+1})\Delta x.$$

We have \(\Delta x = 4/16 = 0.25\). Since \(x_i = 0+(i-1)\Delta x\), we have

\[\begin{align}x_{i+1} &= 0 + \big((i+1)-1\big)\Delta x \\ &= i\Delta x \end{align}\]

Using the summation formulas, consider:

\[\begin{align} \int_0^4 (4x-x^2)dx &\approx \sum_{i=1}^{16} f(x_{i+1})\Delta x \\ &= \sum_{i=1}^{16} f(i\Delta x) \Delta x\\ &= \sum_{i=1}^{16} \big(4i\Delta x - (i\Delta x)^2\big)\Delta x\\ &= \sum_{i=1}^{16} (4i\Delta x^2 - i^2\Delta x^3)\\ &= (4\Delta x^2)\sum_{i=1}^{16} i - \Delta x^3 \sum_{i=1}^{16} i^2 \\ &= (4\Delta x^2)\frac{16\cdot 17}{2} - \Delta x^3 \frac{16(17)(33)}6 \\ &= 4\cdot 0.25^2\cdot 136-0.25^3\cdot 1496\\ &=10.625 \end{align}\]

We were able to sum up the areas of 16 rectangles with very little computation. In Figure \(\PageIndex{8}\) 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 \(\PageIndex{31}\); by changing the 16's to 1,000's (and appropriately changing the value of \(\Delta x\)), we can use that equation to sum up 1000 rectangles!

**Figure \(\PageIndex{8}\):** 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 \(\PageIndex{31}\) to save space. Note that \(\Delta x = 4/1000 = 0.004\).

\[\begin{align} \int_0^4 (4x-x^2)dx &\approx \sum_{i=1}^{1000} f(x_{i+1})\Delta x \\&= (4\Delta x^2)\sum_{i=1}^{1000} i - \Delta x^3 \sum_{i=1}^{1000} i^2 \\&= (4\Delta x^2)\frac{1000\cdot 1001}{2} - \Delta x^3 \frac{1000(1001)(2001)}6 \\&= 4\cdot 0.004^2\cdot 500500-0.004^3\cdot 333,833,500\\ &=10.666656 \end{align}\]

Using many, many rectangles, we have a likely good approximation of \(\int_0^4 (4x-x^2) dx\). That is,

$$\int_0^4(4x-x^2)dx \approx 10.666656.$$

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:

- each rectangle has the same width, which we referred to as \(\Delta x\), and
- 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 did not have the same size. We refer to the length of the first subinterval as \(\Delta x_1\), the length of the second subinterval as \(\Delta x_2\), and so on, giving the length of the \(i^\text{ th}\) subinterval as \(\Delta x_i\). Also, one could determine each rectangle's height by evaluating \(f\) at \emph{any} point in the \(i^\text{ th}\) subinterval. We refer to the point picked in the first subinterval as \(c_1\), the point picked in the second subinterval as \(c_2\), and so on, with \(c_i\) representing the point picked in the \(i^\text{ th}\) subinterval. Thus the height of the \(i^\text{ th}\) subinterval would be \(f(c_i)\), and the area of the \(i^\text{ th}\) rectangle would be \(f(c_i)\Delta x_i\).

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 \(\PageIndex{1}\): Riemann Sum

Let \(f\) be defined on the closed interval \([a,b]\) and let \(\Delta x\) be a partition of \([a,b]\), with

$$a=x_1 < x_2 < \ldots < x_n < x_{n+1}=b.$$

Let \(\Delta x_i\) denote the length of the \(i^\text{ th}\) subinterval \([x_i,x_{i+1}]\) and let \(c_i\) denote any value in the \(i^\text{ th}\) subinterval.

The sum

$$\sum_{i=1}^n f(c_i)\Delta x_i$$

is a **Riemann sum** of \(f\) on \([a,b]\).

**Figure \(\PageIndex{9}\):** An example of a general Riemann sum to approximate \(\int_0^4(4x-x^2)dx\)

Figure \(\PageIndex{9}\) shows the approximating rectangles of a Riemann sum of \(\int_0^4(4x-x^2)dx\). 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.

"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 8: Riemann Sum Concepts

Consider \(\int_a^b f(x) dx \approx \sum_{i=1}^n f(c_i)\Delta x_i.\)

- When the \(n\) subintervals have equal length, \(\Delta x_i = \Delta x = \frac{b-a}n.\)
- The \(i^\text{ th}\) term of the partition is \(x_i = a + (i-1)\Delta x\). (This makes \(x_{n+1} = b\).)
- The Left Hand Rule summation is: \(\sum_{i=1}^n f(x_i)\Delta x\).
- The Right Hand Rule summation is: \(\sum_{i=1}^n f(x_{i+1})\Delta x\).
- The Midpoint Rule summation is: \(\sum_{i=1}^n f\left(\frac{x_i+x_{x+1}}{2}\right)\Delta x\).

Let's do another example.

Example \(\PageIndex{5}\): 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 8, we have

$$\Delta x = \frac{3 - (-2)}{10} = 1/2 \quad \text{and} \quad x_i = (-2) + (1/2)(i-1) = i/2-5/2.$$

As we are using the Midpoint Rule, we will also need \(x_{i+1}\) and \(\frac{x_i+x_{i+1}}2\). Since \(x_i = i/2-5/2\), \(x_{i+1} = (i+1)/2 - 5/2 = i/2 -2\). This gives

$$\frac{x_i+x_{i+1}}2 = \frac{(i/2-5/2) + (i/2-2)}{2} = \frac{i-9/2}{2} = i/2 - 9/4.$$

We now construct the Riemann sum and compute its value using summation formulas.

\[\begin{align} \int_{-2}^3 (5x+2)dx &\approx \sum_{i=1}^{10} f\left(\frac{x_i+x_{i+1}}{2}\right)\Delta x \\ &= \sum_{i=1}^{10} f(i/2 - 9/4)\Delta x \\ &= \sum_{i=1}^{10} \big(5(i/2-9/4) + 2\big)\Delta x\\ &= \Delta x\sum_{i=1}^{10}\left[\left(\frac{5}{2}\right)i - \frac{37}{4}\right]\\ &= \Delta x\left(\frac{5}2\sum_{i=1}^{10} (i) - \sum_{i=1}^{10}\left(\frac{37}{4}\right)\right) \\&= \frac12\left(\frac52\cdot\frac{10(11)}{2} - 10\cdot\frac{37}4\right) \\ &= \frac{45}2 = 22.5 \end{align}\]

Note the graph of \(f(x) = 5x+2\) in Figure \(\PageIndex{10}\). 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\); when \(f\) is negative, the area is counted as negative.

**Figure \(\PageIndex{10}\):** Approximating \(\int_{-2}^3 (5x+2)dx\) using the Midpoint Rule and 10 evenly spaced subintervals in Example \(\PageIndex{5}\).

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 \(\PageIndex{6}\): 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 8, we know \(\Delta x = \frac{4-0}{n} = 4/n\). We also find \(x_i = 0 + \Delta x(i-1) = 4(i-1)/n\). The Right Hand Rule uses \(x_{i+1}\), which is \(x_{i+1} = 4i/n\).

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 &\approx \sum_{i=1}^n f(x_{i+1})\Delta x \\ &= \sum_{i=1}^n f\left(\frac{4i}{n}\right) \Delta x \\ &= \sum_{i=1}^n \left[4\frac{4i}n-\left(\frac{4i}n\right)^2\right]\Delta x\\ &= \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 \\ &= \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 \\ &= \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} &\left(\text{recall $\Delta x = 4/n$}\right)\\ &=\frac{32(n+1)}{n} - \frac{32(n+1)(2n+1)}{3n^2} &\text{(now simplify)} \\ &= \frac{32}{3}\left(1-\frac{1}{n^2}\right) \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

$$\int_0^4 (4x-x^2)dx \approx \frac{32}{3}\left(1-\frac{1}{10^2}\right) = 10.56.$$

Recall how earlier we approximated the definite integral with 4 subintervals; with \(n=4\), 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\). (The actual answer is \(10.666666666656\).)

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 \textit{calculus}. For any \textit{finite} \(n\), we know that

$$\int_0^4 (4x-x^2)dx \approx \frac{32}{3}\left(1-\frac{1}{n^2}\right).$$

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\), we get the *exact area* described by \(\int_0^4 (4x-x^2)dx\). That is,

\[\begin{align} \int_0^4 (4x-x^2)dx &= \lim_{n\rightarrow \infty} \frac{32}{3}\left(1-\frac{1}{n^2}\right) \\ &= \frac{32}{3}\left(1-0\right)\\ &= \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\). 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 \(\PageIndex{7}\): Approximating definite integrals with a formula, using sums

Find a formula that approximates \(\int_{-1}^5 x^3dx\) 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 8, we have \(\Delta x = \frac{5-(-1)}{n} = 6/n\). We have \(x_i = (-1) + (i-1)\Delta x\); as the Right Hand Rule uses \(x_{i+1}\), we have \(x_{i+1} = (-1) + i\Delta x\).

The Riemann sum corresponding to the Right Hand Rule is (followed by simplifications):

\[\begin{align}\int_{-1}^5 x^3dx &\approx \sum_{i=1}^n f(x_{i+1})\Delta x \\ &= \sum_{i=1}^n f(-1+i\Delta x)\Delta x \\ &= \sum_{i=1}^n (-1+i\Delta x)^3\Delta x \\&= \sum_{i=1}^n \big((i\Delta x)^3 -3(i\Delta x)^2 + 3i\Delta x -1\big)\Delta x \quad \text{\scriptsize (now distribute $\Delta x$)} \\ &= \sum_{i=1}^n \big(i^3\Delta x^4 - 3i^2\Delta x^3 + 3i\Delta x^2 -\Delta x\big) \quad \text{\scriptsize (now split up summation)}\\ &= \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 \\ &= \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 \\ \text{(use $\Delta x = 6/n$)}\\ &= \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 \\ \text{(now do a sizable amount of algebra to simplify)}\\ &=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 \(\PageIndex{11}\). Using \(n=100\) gives an approximation of \(159.802\).

**Figure \(\PageIndex{11}\):** Approximating \(\int_{-1}^5 x^3dx\) using the Right Hand Rule and 10 evenly spaced subintervals.

Now find the exact answer using a limit:

$$\int_{-1}^5 x^3dx = \lim_{n\to\infty} \left(156 + \frac{378}n + \frac{216}{n^2}\right) = 156.$$

### Limits of Riemann Sums

We have used limits to evaluate exactly given definite limits. Will this always work? We will show, given not--very--restrictive conditions, that yes, it will always work.

The previous two examples demonstrated how an expression such as

$$\sum_{i=1}^n f(x_{i+1})\Delta x$$

can be rewritten as an expression explicitly involving \(n\), such as \(32/3(1-1/n^2)\).

Viewed in this manner, we can think of the summation as a function of \(n\). 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\), let:

- \(S_L(n) = \sum_{i=1}^n f(x_i)\Delta x\), the sum of equally spaced rectangles formed using the Left Hand Rule,
- \(S_R(n) = \sum_{i=1}^n f(x_{i+1})\Delta x\), the sum of equally spaced rectangles formed using the Right Hand Rule, and
- \( S_M(n) = \sum_{i=1}^n f\left(\frac{x_i+x_{i+1}}{2}\right)\Delta x\), the sum of equally spaced rectangles formed using the Midpoint Rule.

Recall the definition of a limit as \(n\to\infty\): \(\lim_{n\to\infty}S_L(n) = K\) if, given any \(\epsilon>0\), there exists \(N>0\) such that

$$\left|S_L(n)-K\right| < \epsilon \quad \text{when}\quad n\geq N.$$

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\). 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)\), where \(c_i\) is any point in the \(i^\text{ th}\) subinterval, as discussed before Riemann Sums where defined in Definition \(\PageIndex{1}\).

The theorem goes on to state that the rectangles do not need to be of the same width. Using the notation of Definition \(\PageIndex{1}\), let \(\Delta x_i\) denote the length of the \(i^\text{ th}\) subinterval in a partition of \([a,b]\). Now let \(||\Delta x||\) represent the length of the largest subinterval in the partition: that is, \(||\Delta x||\) is the largest of all the \(\Delta x_i\)'s. If \(||\Delta x||\) is small, then \([a,b]\) must be partitioned into many subintervals, since all subintervals must have small lengths. "Taking the limit as \(||\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

$$\lim_{||\Delta x||\to 0}\sum_{i=1}^nf(c_i)\Delta x_i$$

as "the limit of the sum 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]\).

Theorem \(\PageIndex{2}\): Definite Integrals and the Limit of Riemann Sums

Let \(f\) be continuous on the closed interval \([a,b]\) and let \(S_L(n)\), \(S_R(n)\) and \(S_M(n)\) be defined as before. Then:

- \( \lim_{n\to\infty} S_L(n) = \lim_{n\to\infty} S_R(n) = \lim_{n\to\infty} S_M(n) = \lim_{n\to\infty}\sum_{i=1}^n f(c_i)\Delta x\),
- \( \lim_{n\to\infty}\sum_{i=1}^n f(c_i)\Delta x = \int_a^b f(x)dx$, and %$ \lim_{n\to\infty} S_L(n) = \int_a^b f(x)dx\).
- \( \lim_{\|\Delta x\|\to 0} \sum_{i=1}^n f(c_i)\Delta x_i = \int_a^b f(x)dx\).

We summarize what we have learned over the past few sections here.

- Knowing the "area under the curve" can be useful. One common example is: the area under a velocity curve is displacement.
- We have defined the definite integral, \(\int_a^b f(x)dx\), to be the signed area under \(f\) on the interval \([a,b]\).
- 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.

### Contributors

Gregory Hartman (Virginia Military Institute). Contributions were made by Troy Siemers and Dimplekumar Chalishajar of VMI and Brian Heinold of Mount Saint Mary's University. This content is copyrighted by a Creative Commons Attribution - Noncommercial (BY-NC) License. http://www.apexcalculus.com/

Integrated by Justin Marshall.