Skip to content
Topos Uranos

Summary

Many integrals cannot be computed with Barrow’s rule, because the integrand has no elementary antiderivatives, a fact that, for functions such as e−x2e^{-x^2}, is proved in later courses, as the lesson on antiderivatives pointed out, and that no proof in this lesson uses; the integral exists, but its value has to be approximated. Riemann sums with uniform partitions tend to the integral of every integrable function, although slowly: for a Lipschitz function, their error decreases like 1n\frac{1}{n}. This lesson refines them with three rules that, on each subinterval of a uniform partition, replace the function by a simple polynomial and integrate that polynomial exactly: the midpoint rule, with a constant; the trapezoidal rule, with a line; and Simpson’s rule, with a parabola. With a lemma that iterates Cauchy’s mean value theorem, and with no tools other than those of Calculus I and those of the unit on the definite integral, it is proved that their errors are at most (b−a)h224\frac{(b - a) h^2}{24}, (b−a)h212\frac{(b - a) h^2}{12} and (b−a)h4180\frac{(b - a) h^4}{180} times a bound for the second or the fourth derivative, where hh is the width of each subinterval. From this it follows how many subintervals guarantee a given error, how the error decreases when the number of subintervals is doubled, and on which side of the integral each rule lies when that derivative has constant sign. With these tools one computes, with a bounded error, the value 0.9225…0.9225\ldots that was left pending in the lesson on the fundamental theorem of calculus.

Learning objectives

  1. Define the midpoint, trapezoidal and Simpson’s rules with nn equal subintervals, and recognize each one as the exact integral of an interpolating polynomial.
  2. Prove the error bounds of the three rules under their exact differentiability hypotheses, and recognize when they cannot be improved and what happens if those hypotheses fail.
  3. Compute how many subintervals guarantee a given error and explain how the error decreases when the number of subintervals is doubled.
  4. Bracket the value of an integral with no elementary antiderivative between two computable numbers, with the sign of the error and its bound.

Three rules and their polynomials

The lesson on the area problem announced that the sums of rectangles would be refined to approximate integrals whose antiderivatives are not known. By the corollary on Riemann sums with uniform partitions, from the lesson on the Riemann integral, those sums tend to the integral of every integrable function, but the corollary does not say how fast. The proposed problem “An error bound for Lipschitz functions”, from that same lesson, gives a bound for that speed: for sin⁡(x2)\sin\left(x^2\right) on [0,1]\icc{0}{1}, guaranteeing with that bound an error smaller than 11000\frac{1}{1000} required 20012001 subintervals. The reason is that a rectangle of constant height follows a sloping curve poorly. If on each subinterval the function is replaced by a polynomial that follows it more closely (a line or a parabola) and that polynomial is integrated, the error decreases much faster.

DefinitionMidpoint, trapezoidal and Simpson’s rules

Let ff be a function defined on [a,b]\icc{a}{b}, with a<ba < b, and let nn be a natural number. The spacing is h=b−anh = \frac{b - a}{n}; the nodes are xk=a+khx_k = a + kh, for k=0,1,…,nk = 0, 1, \ldots, n, and the midpoints are ck=xk−1+xk2c_k = \frac{x_{k - 1} + x_k}{2}, for k=1,…,nk = 1, \ldots, n. The midpoint rule Rn(f)R_n(f) and the trapezoidal rule Tn(f)T_n(f) are the following numbers:

Rn(f)=h∑k=1nf(ck),Tn(f)=h2∑k=1n(f(xk−1)+f(xk))R_n(f) = h \sum_{k=1}^{n} f(c_k), \qquad T_n(f) = \frac{h}{2} \sum_{k=1}^{n} \left(f(x_{k - 1}) + f(x_k)\right)

If nn is even, Simpson’s rule groups the subintervals in pairs:

Sn(f)=h3∑j=1n/2(f(x2j−2)+4f(x2j−1)+f(x2j))S_n(f) = \frac{h}{3} \sum_{j=1}^{n/2} \left(f(x_{2j - 2}) + 4 f(x_{2j - 1}) + f(x_{2j})\right)

If ff is integrable on [a,b]\icc{a}{b}, the errors of the rules are ER=∫abf−Rn(f)E_R = \int_a^b f - R_n(f), ET=∫abf−Tn(f)E_T = \int_a^b f - T_n(f) and ES=∫abf−Sn(f)E_S = \int_a^b f - S_n(f); when several values of nn are compared, one writes ER(n)E_R(n), ET(n)E_T(n) and ES(n)E_S(n).

The midpoint rule is the Riemann sum of the uniform partition with the midpoints, and the trapezoidal rule is the average of the Riemann sums with the left endpoints and with the right endpoints: Tn(f)=h2(f(x0)+2f(x1)+⋯+2f(xn−1)+f(xn))T_n(f) = \frac{h}{2} \left(f(x_0) + 2f(x_1) + \cdots + 2f(x_{n - 1}) + f(x_n)\right). In Simpson’s rule, the weights of the nodes are h3\frac{h}{3} times 1,4,2,4,…,2,4,11, 4, 2, 4, \ldots, 2, 4, 1. The names of the first two come from the polynomials they integrate; the third bears the name of Thomas Simpson, whose story was told in the introduction to the unit.

PropositionEach rule integrates an interpolating polynomial

Let ff be a function defined on [a,b]\icc{a}{b}, with a<ba < b, and let nn, hh, xkx_k and ckc_k be as in the definition. Then, for each kk, the term h f(ck)h \, f(c_k) is the integral on [xk−1,xk]\icc{x_{k - 1}}{x_k} of the constant f(ck)f(c_k), and the term h2(f(xk−1)+f(xk))\frac{h}{2} \left(f(x_{k - 1}) + f(x_k)\right) is the integral of a polynomial of degree at most one whose graph passes through the points of the curve at the two endpoints. If nn is even, for each jj, Simpson’s term is the integral on [x2j−2,x2j]\icc{x_{2j - 2}}{x_{2j}} of a polynomial of degree at most two whose graph passes through the points of the curve at x2j−2x_{2j - 2}, x2j−1x_{2j - 1} and x2jx_{2j}. The figure shows, with n=4n = 4, the rectangles with the height of the midpoint, the trapezoids under the chords and the two Simpson parabolas.

Proof

  1. ∫xk−1xkf(ck) dx=[f(ck) x]xk−1xk=h f(ck)\int_{x_{k - 1}}^{x_k} f(c_k) \, \mathrm{d}x = \left[ f(c_k) \, x \right]_{x_{k - 1}}^{x_k} = \resaltar{h \, f(c_k)}

    By Barrow’s rule for continuous functions, from the lesson on the fundamental theorem of calculus, with the antiderivative f(ck) xf(c_k) \, x of the constant, the integral of the constant on a subinterval of width hh is, if f(ck)>0f(c_k) > 0, the area of a rectangle.

  2. Lk(x)=f(xk−1)+f(xk)−f(xk−1)h (x−xk−1)→∫xk−1xkLk=h f(xk−1)+h2(f(xk)−f(xk−1))=h2(f(xk−1)+f(xk))L_k(x) = f(x_{k - 1}) + \frac{f(x_k) - f(x_{k - 1})}{h} \, (x - x_{k - 1}) \rightarrow \int_{x_{k - 1}}^{x_k} L_k = h \, f(x_{k - 1}) + \frac{h}{2} \left(f(x_k) - f(x_{k - 1})\right) = \resaltar{\frac{h}{2} \left(f(x_{k - 1}) + f(x_k)\right)}

    The polynomial LkL_k below takes the value f(xk−1)f(x_{k - 1}) at xk−1x_{k - 1} and f(xk)f(x_k) at xkx_k. By the corollary on the derivative of a polynomial and of a rational function, from the lesson on differentiation rules, an antiderivative of it is f(xk−1) (x−xk−1)+f(xk)−f(xk−1)2h (x−xk−1)2f(x_{k - 1}) \, (x - x_{k - 1}) + \frac{f(x_k) - f(x_{k - 1})}{2h} \, (x - x_{k - 1})^2, and Barrow’s rule for continuous functions gives the integral, which is, if both values are positive, the area of the trapezoid.

  3. Qj(x)=f(c)+f(c+h)−f(c−h)2h (x−c)+f(c+h)−2f(c)+f(c−h)2h2 (x−c)2→∫c−hc+hQj=2h f(c)+h3(f(c+h)−2f(c)+f(c−h))=h3(f(c−h)+4f(c)+f(c+h))Q_j(x) = f(c) + \frac{f(c + h) - f(c - h)}{2h} \, (x - c) + \frac{f(c + h) - 2f(c) + f(c - h)}{2h^2} \, (x - c)^2 \rightarrow \int_{c - h}^{c + h} Q_j = 2h \, f(c) + \frac{h}{3} \left(f(c + h) - 2f(c) + f(c - h)\right) = \resaltar{\frac{h}{3} \left(f(c - h) + 4 f(c) + f(c + h)\right)}

    Let c=x2j−1c = x_{2j - 1}, so that x2j−2=c−hx_{2j - 2} = c - h and x2j=c+hx_{2j} = c + h. The polynomial QjQ_j below takes the value f(c)f(c) at cc, and at c+hc + h and c−hc - h it takes the value f(c)±f(c+h)−f(c−h)2+f(c+h)−2f(c)+f(c−h)2f(c) \pm \frac{f(c + h) - f(c - h)}{2} + \frac{f(c + h) - 2f(c) + f(c - h)}{2}, which is f(c+h)f(c + h) and f(c−h)f(c - h). By Barrow’s rule for continuous functions, the integral of (x−c)(x - c) on [c−h,c+h]\icc{c - h}{c + h} is 00 and that of (x−c)2(x - c)^2 is 2h33\frac{2h^3}{3}, with the antiderivatives (x−c)22\frac{(x - c)^2}{2} and (x−c)33\frac{(x - c)^3}{3}.

The three rules are related: the nodes of the partition into 2n2n subintervals are the nodes and the midpoints of the partition into nn subintervals.

PropositionRelations among the three rules

Let ff be a function defined on [a,b]\icc{a}{b}, with a<ba < b, and let nn be a natural number. Then:

T2n(f)=Tn(f)+Rn(f)2,S2n(f)=Tn(f)+2Rn(f)3=4T2n(f)−Tn(f)3T_{2n}(f) = \frac{T_n(f) + R_n(f)}{2}, \qquad S_{2n}(f) = \frac{T_n(f) + 2 R_n(f)}{3} = \frac{4 T_{2n}(f) - T_n(f)}{3}

If, moreover, ff is integrable on [a,b]\icc{a}{b}, then Rn(f)R_n(f), Tn(f)T_n(f) and S2n(f)S_{2n}(f) tend to ∫abf\int_a^b f.

Proof

  1. h4(f(xk−1)+2f(ck)+f(xk)),h6(f(xk−1)+4f(ck)+f(xk))\frac{h}{4} \left(f(x_{k - 1}) + 2 f(c_k) + f(x_k)\right), \qquad \frac{h}{6} \left(f(x_{k - 1}) + 4 f(c_k) + f(x_k)\right)

    Let hh, xkx_k and ckc_k be those of the partition into nn subintervals. The partition into 2n2n subintervals has spacing h2\frac{h}{2}, and its nodes are, in order, x0,c1,x1,c2,…,cn,xnx_0, c_1, x_1, c_2, \ldots, c_n, x_n. On subinterval kk of the partition into nn subintervals, the two trapezoids of width h2\frac{h}{2} and Simpson’s term with spacing h2\frac{h}{2} are the following:

  2. T2n(f)=12Tn(f)+12Rn(f),S2n(f)=13Tn(f)+23Rn(f)=4T2n(f)−Tn(f)3T_{2n}(f) = \frac{1}{2} T_n(f) + \frac{1}{2} R_n(f), \qquad S_{2n}(f) = \frac{1}{3} T_n(f) + \frac{2}{3} R_n(f) = \resaltar{\frac{4 T_{2n}(f) - T_n(f)}{3}}

    Summing over kk, the first gives half of Tn(f)T_n(f) plus half of Rn(f)R_n(f), and the second, one third of Tn(f)T_n(f) plus two thirds of Rn(f)R_n(f); solving the first equality as Rn(f)=2T2n(f)−Tn(f)R_n(f) = 2 T_{2n}(f) - T_n(f), one obtains the last one.

  3. Rn(f)→∫abf,Tn(f)→∫abf,S2n(f)→13∫abf+23∫abf=∫abfR_n(f) \to \int_a^b f, \qquad T_n(f) \to \int_a^b f, \qquad S_{2n}(f) \to \frac{1}{3} \int_a^b f + \frac{2}{3} \int_a^b f = \resaltar{\int_a^b f}

    If ff is integrable, the corollary on Riemann sums with uniform partitions, with any point of each subinterval, shows that the sums with the midpoints, with the left endpoints and with the right endpoints tend to the integral. By the theorem stating that the limit theorems hold for sequences, from the lesson on sequences and their limit, so do the average of the last two, Tn(f)T_n(f), and the combination S2n(f)S_{2n}(f).

The three rules therefore converge for every integrable function. The question is how fast, and that depends on the derivatives of the function.