Tutorials › AP Calculus › Trapezoidal Error Bounds and Subdivision Choice

Numerical and BC Integration Methods · Tutorial 514 of 999

Trapezoidal Error Bounds and Subdivision Choice

Use a bound on the second derivative to estimate the trapezoidal rule’s maximum error and select a sufficient subdivision count.

Advanced 9 min read

What You'll Learn

  • State the conditions needed for the composite trapezoidal error bound.
  • Use a bound on the absolute second derivative to estimate maximum error.
  • Derive the error bound from the linear interpolation error on each subinterval.
  • Solve the error inequality for a sufficient number of equal subintervals.
  • Distinguish a guaranteed error bound from the actual error.
  • Identify why rounding a subdivision count down may not meet the requested tolerance.

From a Trapezoidal Estimate to an Error Guarantee

The composite trapezoidal rule approximates a definite integral by adding the areas of trapezoids across equal subintervals. The estimate itself is useful, but it does not say how far the estimate could be from the exact integral. A second-derivative bound supplies a guaranteed maximum error, provided the function satisfies the required conditions.

That guarantee also answers a practical question: how many subintervals should be used to make the error no greater than a chosen tolerance? The key is that the bound decreases in proportion to the square of the number of subintervals.

Definition: Let \(f\) be a function on \([a,b]\), and divide that interval into \(n\) equal subintervals of width \(h=(b-a)/n\). The composite trapezoidal estimate is \(T_n=\frac{h}{2}\left[f(a)+2\sum_{i=1}^{n-1}f(a+ih)+f(b)\right]\). The actual error is the difference between the exact integral and this estimate, \(\int_a^b f(x)\,dx-T_n\); its absolute error is the absolute value of that difference.

The Composite Trapezoidal Error Bound

Suppose \(f\) has a continuous second derivative on \([a,b]\), and suppose a number \(K\) is known such that \(|f''(x)|\le K\) throughout the interval. Then the composite trapezoidal rule satisfies the following bound:

Theorem: Under those conditions, for every positive integer \(n\), \(\left|\int_a^b f(x)\,dx-T_n\right|\le \frac{K(b-a)^3}{12n^2}\).

The value \(K\) must be an upper bound for the absolute value of the second derivative everywhere on the interval, not merely at the endpoints or at a few sample points. A larger valid \(K\) still gives a valid error bound, although it may require more subintervals to meet a requested tolerance.

Because the bound contains \(n^2\) in the denominator, doubling the number of equal subintervals divides the guaranteed maximum error by four. The bound also depends strongly on the interval length: with \(K\) fixed, its numerator includes \((b-a)^3\).

Why the Bound Works

On each small subinterval, the trapezoidal rule integrates the straight line joining the function’s endpoint values. The difference between the function and that line is controlled by the second derivative. Adding the resulting local bounds gives a bound for the whole interval.

1
Consider one subinterval.
Write its endpoints as \(u\) and \(v\), with \(v-u=h\), and let \(L(x)\) be the line through \((u,f(u))\) and \((v,f(v))\). The trapezoid’s area is \(\int_u^v L(x)\,dx\).
2
Bound the interpolation difference.
For an interior point \(x\), the interpolation remainder gives \(f(x)-L(x)=\frac{f''(\xi)}{2}(x-u)(x-v)\) for some \(\xi\) between \(u\) and \(v\). Thus \(|f(x)-L(x)|\le \frac{K}{2}(x-u)(v-x)\).
3
Integrate the local bound.
Integrating the nonnegative product gives \(\int_u^v (x-u)(v-x)\,dx=h^3/6\). Therefore the absolute error on this subinterval is at most \(Kh^3/12\).
4
Add the local bounds.
There are \(n\) subintervals, so the total absolute error is at most \(nKh^3/12\). Substituting \(h=(b-a)/n\) gives \(K(b-a)^3/(12n^2)\).

For completeness, the interpolation remainder in Step 2 follows from Rolle’s theorem. Fix an interior point \(x\) and set \(c=(f(x)-L(x))/((x-u)(x-v))\). The function \(g(t)=f(t)-L(t)-c(t-u)(t-v)\) is zero at \(u\), \(x\), and \(v\). Applying Rolle’s theorem twice shows that \(g''(\xi)=0\) for some \(\xi\) between \(u\) and \(v\). Since \(L''(t)=0\) and the second derivative of \((t-u)(t-v)\) is \(2\), this gives \(f''(\xi)-2c=0\), which is the stated remainder formula. The endpoint cases have \(f(x)-L(x)=0\), so they satisfy the same inequality.

Worked Example: Bounding the Error for a Quadratic

Worked Example: Bounding the Error for a Quadratic

Use \(n=3\) equal subintervals to approximate \(\int_{-1}^{2}x^2\,dx\). Find the trapezoidal estimate, the actual error, and the error bound.

Here \(f(x)=x^2\), so \(f''(x)=2\) and we may take \(K=2\). The interval length is \(b-a=2-(-1)=3\), and \(h=3/3=1\). The nodes are \(-1,0,1,2\), where the function values are \(1,0,1,4\), respectively.

$$ T_3=\frac{1}{2}\left[1+2(0+1)+4\right] =\frac{1}{2}(7)=\frac{7}{2}=3.5. $$

The exact integral is \(\int_{-1}^{2}x^2\,dx=[x^3/3]_{-1}^{2}=8/3-(-1/3)=3\). Thus the absolute error is \(|3-3.5|=0.5\).

$$ \frac{K(b-a)^3}{12n^2} =\frac{2(3)^3}{12(3)^2} =\frac{54}{108} =\frac{1}{2}=0.5. $$

The calculated error equals the bound, so this example also checks that the stated bound holds for these values.

Choosing a Sufficient Number of Subintervals

Suppose the desired absolute error is at most a positive tolerance \(\varepsilon\). It is sufficient to choose \(n\) so that the error bound is no greater than \(\varepsilon\):

$$ \frac{K(b-a)^3}{12n^2}\le \varepsilon. $$

When \(K>0\), solve this inequality for \(n\). Since \(n\) is a positive integer, round the resulting threshold up to the next integer:

Rule: A sufficient number of equal subintervals is \(n=\left\lceil\sqrt{\frac{K(b-a)^3}{12\varepsilon}}\right\rceil\), where \(\lceil r\rceil\) denotes the least integer greater than or equal to \(r\). If \(K=0\), then \(f''=0\) throughout the interval, so \(f\) is linear there and the trapezoidal rule is exact.

This choice guarantees that the error is no larger than the tolerance. It does not generally tell us the actual error, nor does it prove that a smaller number of subintervals would fail. It identifies the smallest integer that satisfies this particular error-bound inequality.

Worked Example: Choosing Subintervals for a Tolerance

Worked Example: Choosing Subintervals for a Tolerance

How many equal subintervals are sufficient for the composite trapezoidal rule to approximate \(\int_0^1 \cos x\,dx\) with error at most \(0.01\)?

For \(f(x)=\cos x\), \(f''(x)=-\cos x\). On \([0,1]\), \(|f''(x)|=|\cos x|\le 1\), so \(K=1\) is valid. The interval length is \(1\), and \(\varepsilon=0.01\). Therefore, the bound requires

$$ n\ge \sqrt{\frac{1(1)^3}{12(0.01)}} =\sqrt{\frac{1}{0.12}} =\sqrt{\frac{25}{3}} \approx 2.887. $$

The least integer at least \(2.887\) is \(3\). Substituting \(n=3\) back into the bound gives \(\frac{1}{12(3)^2}=\frac{1}{108}\approx 0.00926<0.01\). Thus \(3\) subintervals are sufficient by the theorem.

For comparison, \(n=2\) gives a bound of \(\frac{1}{48}\approx 0.02083\), which exceeds the tolerance. That means the bound does not certify two subintervals; it does not, by itself, prove that the actual error with two subintervals is greater than \(0.01\).

Worked Example: Using a Derivative Bound on a Longer Interval

Worked Example: Using a Derivative Bound on a Longer Interval

For \(f(x)=\ln(1+x)\) on \([0,2]\), find a sufficient number of equal subintervals to guarantee an error no greater than \(0.005\).

The derivatives are \(f'(x)=1/(1+x)\) and \(f''(x)=-1/(1+x)^2\). For \(0\le x\le 2\), \(|f''(x)|=1/(1+x)^2\le 1\), so take \(K=1\). The interval length is \(2\). Substituting these values and \(\varepsilon=0.005\) gives

$$ n\ge \sqrt{\frac{1(2)^3}{12(0.005)}} =\sqrt{\frac{8}{0.06}} =\sqrt{\frac{400}{3}} \approx 11.547. $$

Round up to \(n=12\). Substitution into the error bound gives \(\frac{8}{12(12)^2}=\frac{8}{1728}=\frac{1}{216}\approx 0.00463<0.005\). For \(n=11\), the bound is \(\frac{8}{12(11)^2}=\frac{8}{1452}=\frac{2}{363}\approx 0.00551>0.005\). Therefore, \(12\) is the smallest integer that meets the requested tolerance using this bound.

A Common Mistake: Rounding Down

A frequent error is to find the real-number threshold for \(n\) and then round it to the nearest integer, or down to the nearest integer. But the inequality requires \(n\) to be at least that threshold. Rounding down can violate the guarantee.

In the cosine example, the threshold is approximately \(2.887\). Choosing \(n=2\) because it is the nearest lower integer gives the bound \(1/48\approx 0.02083\), which is not at most \(0.01\). The correction is to use the ceiling: \(n=\lceil 2.887\rceil=3\). Checking the bound after rounding confirms that \(1/108\approx 0.00926\le 0.01\).

Takeaway: The error theorem gives a guarantee only when its hypotheses hold and the chosen integer satisfies the error inequality. Find a valid \(K\), compute the threshold, round up, and substitute the resulting integer back into the bound.

Why the Bound Matters

A numerical estimate is most useful when its accuracy can be assessed. The second-derivative bound turns information about a function’s curvature into a guaranteed limit on the trapezoidal error. It also makes the effect of subdivision precise: for fixed \(K\) and interval, the bound falls as \(1/n^2\).

The bound is conservative. It may be larger than the actual error, as a bound must allow for every function satisfying its assumptions. A small bound guarantees accuracy within the stated tolerance; a bound larger than the tolerance means only that this guarantee has not been obtained. In applications, \(K\) must be justified over the entire interval, and the units of the bound match the units of the integral: \(K\) has units of function value per squared input unit, so \(K(b-a)^3\) has units of function value times input unit.

Check Your Understanding

Use the theorem and the distinction between an error bound and actual error to answer these questions.

  1. State the differentiability condition and the inequality required for \(K\).
  2. For an interval of length \(4\), with \(K=3\) and \(n=6\), what error bound does the theorem give?
  3. For interval length \(1\), \(K=2\), and tolerance \(0.02\), what is the least subdivision count certified by the bound?
  4. If the bound is greater than a requested tolerance, what can and cannot be concluded about the actual error?
  5. Why must a real-valued threshold for \(n\) be rounded up rather than down?

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon