Learning Outcomes
- Approximate the value of a definite integral by using the midpoint and trapezoidal rules
The Midpoint Rule
Earlier in this text we defined the definite integral of a function over an interval as the limit of Riemann sums. In general, any Riemann sum of a function [latex]f\left(x\right)[/latex] over an interval [latex]\left[a,b\right][/latex] may be viewed as an estimate of [latex]{\displaystyle\int }_{a}^{b}f\left(x\right)dx[/latex]. Recall that a Riemann sum of a function [latex]f\left(x\right)[/latex] over an interval [latex]\left[a,b\right][/latex] is obtained by selecting a partition
and a set
The Riemann sum corresponding to the partition [latex]P[/latex] and the set [latex]S[/latex] is given by [latex]\displaystyle\sum _{i=1}^{n}f\left({x}_{i}^{*}\right)\Delta {x}_{i}[/latex], where [latex]\Delta {x}_{i}={x}_{i}-{x}_{i - 1}[/latex], the length of the ith subinterval.
The midpoint rule for estimating a definite integral uses a Riemann sum with subintervals of equal width and the midpoints, [latex]{m}_{i}[/latex], of each subinterval in place of [latex]{x}_{i}^{*}[/latex]. Formally, we state a theorem regarding the convergence of the midpoint rule as follows.
The Midpoint Rule
Assume that [latex]f\left(x\right)[/latex] is continuous on [latex]\left[a,b\right][/latex]. Let n be a positive integer and [latex]\Delta x=\frac{b-a}{n}[/latex]. If [latex]\left[a,b\right][/latex] is divided into [latex]n[/latex] subintervals, each of length [latex]\Delta x[/latex], and [latex]{m}_{i}[/latex] is the midpoint of the ith subinterval, set
Then [latex]\underset{n\to \infty }{\text{lim}}{M}_{n}={\displaystyle\int }_{a}^{b}f\left(x\right)dx[/latex].
As we can see in Figure 1, if [latex]f\left(x\right)\ge 0[/latex] over [latex]\left[a,b\right][/latex], then [latex]\displaystyle\sum _{i=1}^{n}f\left({m}_{i}\right)\Delta x[/latex] corresponds to the sum of the areas of rectangles approximating the area between the graph of [latex]f\left(x\right)[/latex] and the x-axis over [latex]\left[a,b\right][/latex]. The graph shows the rectangles corresponding to [latex]{M}_{4}[/latex] for a nonnegative function over a closed interval [latex]\left[a,b\right][/latex].
Example: Using the Midpoint Rule with [latex]{M}_{4}[/latex]
Use the midpoint rule to estimate [latex]{\displaystyle\int }_{0}^{1}{x}^{2}dx[/latex] using four subintervals. Compare the result with the actual value of this integral.
Example: Using the Midpoint Rule with [latex]{M}_{6}[/latex]
Use [latex]{M}_{6}[/latex] to estimate the length of the curve [latex]y=\frac{1}{2}{x}^{2}[/latex] on [latex]\left[1,4\right][/latex].
try it
Use the midpoint rule with [latex]n=2[/latex] to estimate [latex]{\displaystyle\int }_{1}^{2}\frac{1}{x}dx[/latex].
The Trapezoidal Rule
We can also approximate the value of a definite integral by using trapezoids rather than rectangles. In Figure 2, the area beneath the curve is approximated by trapezoids rather than by rectangles.
The trapezoidal rule for estimating definite integrals uses trapezoids rather than rectangles to approximate the area under a curve. To gain insight into the final form of the rule, consider the trapezoids shown in Figure 2. We assume that the length of each subinterval is given by [latex]\Delta x[/latex]. First, recall that the area of a trapezoid with a height of h and bases of length [latex]{b}_{1}[/latex] and [latex]{b}_{2}[/latex] is given by [latex]\text{Area}=\frac{1}{2}h\left({b}_{1}+{b}_{2}\right)[/latex]. We see that the first trapezoid has a height [latex]\Delta x[/latex] and parallel bases of length [latex]f\left({x}_{0}\right)[/latex] and [latex]f\left({x}_{1}\right)[/latex]. Thus, the area of the first trapezoid in Figure 2 is
The areas of the remaining three trapezoids are
Consequently,
After taking out a common factor of [latex]\frac{1}{2}\Delta x[/latex] and combining like terms, we have
Generalizing, we formally state the following rule.
The Trapezoidal Rule
Assume that [latex]f\left(x\right)[/latex] is continuous over [latex]\left[a,b\right][/latex]. Let n be a positive integer and [latex]\Delta x=\frac{b-a}{n}[/latex]. Let [latex]\left[a,b\right][/latex] be divided into [latex]n[/latex] subintervals, each of length [latex]\Delta x[/latex], with endpoints at [latex]P=\left\{{x}_{0},{x}_{1},{x}_{2}\ldots ,{x}_{n}\right\}[/latex]. Set
Then, [latex]\underset{n\to \text{+}\infty }{\text{lim}}{T}_{n}={\displaystyle\int }_{a}^{b}f\left(x\right)dx[/latex].
Before continuing, let’s make a few observations about the trapezoidal rule. First of all, it is useful to note that
That is, [latex]{L}_{n}[/latex] and [latex]{R}_{n}[/latex] approximate the integral using the left-hand and right-hand endpoints of each subinterval, respectively. In addition, a careful examination of Figure 3 leads us to make the following observations about using the trapezoidal rules and midpoint rules to estimate the definite integral of a nonnegative function. The trapezoidal rule tends to overestimate the value of a definite integral systematically over intervals where the function is concave up and to underestimate the value of a definite integral systematically over intervals where the function is concave down. On the other hand, the midpoint rule tends to average out these errors somewhat by partially overestimating and partially underestimating the value of the definite integral over these same types of intervals. This leads us to hypothesize that, in general, the midpoint rule tends to be more accurate than the trapezoidal rule.
Example: Using the Trapezoidal Rule
Use the trapezoidal rule to estimate [latex]{\displaystyle\int }_{0}^{1}{x}^{2}dx[/latex] using four subintervals.
Watch the following video to see the worked solution to Example: Using the Trapezoidal Rule
For closed captioning, open the video on its original page by clicking the Youtube logo in the lower right-hand corner of the video display. In YouTube, the video will begin at the same starting point as this clip, but will continue playing until the very end.
You can view the transcript for this segmented clip of “3.6.1” here (opens in new window).
try it
Use the trapezoidal rule with [latex]n=2[/latex] to estimate [latex]{\displaystyle\int }_{1}^{2}\frac{1}{x}dx[/latex].
Candela Citations
- 3.6.1. Authored by: Ryan Melton. License: CC BY: Attribution
- Calculus Volume 2. Authored by: Gilbert Strang, Edwin (Jed) Herman. Provided by: OpenStax. Located at: https://openstax.org/books/calculus-volume-2/pages/1-introduction. License: CC BY-NC-SA: Attribution-NonCommercial-ShareAlike. License Terms: Access for free at https://openstax.org/books/calculus-volume-2/pages/1-introduction