Tutorials › Calculus II › The Composite Trapezoidal Error Bound

Quadrature and Error Bounds · Tutorial 354 of 998

The Composite Trapezoidal Error Bound

Learn how a second-derivative bound controls the composite trapezoidal error and why the estimate scales as the inverse square of the panel count.

Intermediate 10 min read

What You'll Learn

  • State the smoothness assumptions required for the composite trapezoidal error bound.
  • Derive a local error estimate from the linear interpolation remainder.
  • Add panel errors to obtain the global maximum-curvature bound.
  • Apply the bound and check it against exact errors in worked examples.
  • Recognize why a one-panel error bound cannot be used as the total composite error.

Why the Error Depends on Curvature

The composite trapezoidal rule estimates an integral by dividing an interval into equal panels and approximating the function by a straight line on each panel. A straight line captures the endpoint values exactly, but it does not generally follow the curve between them. The size of that discrepancy depends on how much the function bends: a bound on the magnitude of its second derivative controls the error.

This tutorial derives an error estimate for a fixed interval and a fixed number of equal-width panels. The result is useful because it gives a guaranteed upper bound, not just a numerical approximation. It also explains why doubling the number of panels reduces this bound by a factor of four, provided the same second-derivative bound applies.

Key idea: If the second derivative is bounded in magnitude by \(M_2\), then the composite trapezoidal error is at most proportional to \(M_2/n^2\), where \(n\) is the number of panels.

Rule and Assumptions

Let \(f\) be twice continuously differentiable on the closed interval \([a,b]\), where \(a<b\). Choose a positive integer \(n\), divide the interval into \(n\) equal panels, and let \(h=(b-a)/n\) be the width of each panel. The grid points are \(x_i=a+ih\) for \(i=0,1,\ldots,n\).

$$ T_n = h\left( \frac{f(x_0)}{2} +\sum_{i=1}^{n-1} f(x_i) +\frac{f(x_n)}{2} \right). $$

Here \(T_n\) is the composite trapezoidal estimate of \(\int_a^b f(x)\,dx\). The smoothness assumption ensures that the second derivative exists and is continuous throughout the interval. Consequently, its magnitude has a maximum there. Define that maximum by

$$ M_2=\max_{a\le x\le b}|f''(x)|. $$
Theorem: If \(f\) is twice continuously differentiable on \([a,b]\), then for every positive integer \(n\), $$ \left|\int_a^b f(x)\,dx-T_n\right| \le \frac{M_2(b-a)^3}{12n^2}, \qquad M_2=\max_{a\le x\le b}|f''(x)|. $$

The bound applies to the error in the whole composite estimate. It requires the stated smoothness on the entire closed interval; it is not automatically applicable if the function or its second derivative is undefined or unbounded at a point in the interval.

Deriving the Bound on One Panel

First consider just one panel \([u,v]\), with width \(h=v-u\). Let \(L(x)\) be the straight-line function that agrees with \(f\) at the two endpoints. The area under \(L\) is the trapezoid area:

$$ \int_u^v L(x)\,dx=\frac{h}{2}\bigl(f(u)+f(v)\bigr). $$

To bound the difference between \(f\) and \(L\), we use the linear interpolation remainder. Here is a direct justification. Fix any interior point \(x\in(u,v)\), and set

$$ K=\frac{f(x)-L(x)}{(x-u)(x-v)}, \qquad g(t)=f(t)-L(t)-K(t-u)(t-v). $$

The definition of \(L\) gives \(g(u)=g(v)=0\), and the choice of \(K\) gives \(g(x)=0\). Rolle’s theorem applied between these three zeros shows that \(g'\) has two zeros, one in \((u,x)\) and one in \((x,v)\). A further application of Rolle’s theorem gives a point \(\xi\in(u,v)\) where \(g''(\xi)=0\). Since \(L\) is linear and the second derivative of \((t-u)(t-v)\) is \(2\), this means

$$ 0=g''(\xi)=f''(\xi)-2K. $$

Therefore \(K=f''(\xi)/2\). Substituting the definition of \(K\) gives the remainder formula at the chosen point:

$$ f(x)-L(x) = \frac{f''(\xi)}{2}(x-u)(x-v). $$

Because \(|f''(\xi)|\le M_2\) and \((x-u)(x-v)\le 0\), it follows that

$$ |f(x)-L(x)| \le \frac{M_2}{2}(x-u)(v-x). $$

This also holds at the endpoints, where both sides are zero. Integrate the inequality across the panel. With \(s=x-u\), the distance \(v-x\) is \(h-s\), so

$$ \begin{aligned} \left|\int_u^v f(x)\,dx-\int_u^v L(x)\,dx\right| &\le \frac{M_2}{2}\int_0^h s(h-s)\,ds\\ &=\frac{M_2}{2}\left[\frac{hs^2}{2}-\frac{s^3}{3}\right]_0^h\\ &=\frac{M_2}{2}\left(\frac{h^3}{2}-\frac{h^3}{3}\right)\\ &=\frac{M_2h^3}{12}. \end{aligned} $$

Thus one panel contributes an error of at most \(M_2h^3/12\). This local estimate is the ingredient needed for the composite bound.

Adding the Panel Errors

On panel \(i\), from \(x_i\) to \(x_{i+1}\), the trapezoid estimate is \(h(f(x_i)+f(x_{i+1}))/2\). Summing these panel areas produces \(T_n\): each interior grid value occurs in two adjacent panels, with a combined coefficient of \(h\), while each endpoint occurs once with coefficient \(h/2\).

The integral over \([a,b]\) is likewise the sum of the integrals over the \(n\) panels. Applying the triangle inequality to the difference between these sums, and then applying the one-panel estimate to every panel, gives

$$ \begin{aligned} \left|\int_a^b f(x)\,dx-T_n\right| &\le \sum_{i=0}^{n-1} \left|\int_{x_i}^{x_{i+1}}f(x)\,dx -\frac{h}{2}\bigl(f(x_i)+f(x_{i+1})\bigr)\right|\\ &\le \sum_{i=0}^{n-1}\frac{M_2h^3}{12}\\ &=\frac{nM_2h^3}{12}. \end{aligned} $$

Since \(h=(b-a)/n\), substituting this width gives the theorem:

$$ \frac{nM_2h^3}{12} = \frac{nM_2}{12}\left(\frac{b-a}{n}\right)^3 = \frac{M_2(b-a)^3}{12n^2}. $$

The inverse-square dependence follows from adding \(n\) local errors, each proportional to \(h^3\), while the width \(h\) itself shrinks like \(1/n\). In symbols, \(n h^3=n((b-a)/n)^3=(b-a)^3/n^2\).

Worked Examples

Worked Example: A Quadratic with an Exact Bound

Apply the bound to \(f(x)=x^2\) on \([0,1]\) using \(n=4\) panels, and compare it with the exact error.

The panel width and grid points are

$$ h=\frac{1-0}{4}=\frac14, \qquad x_0=0,\quad x_1=\frac14,\quad x_2=\frac12,\quad x_3=\frac34,\quad x_4=1. $$

The function values are \(0,\;1/16,\;1/4,\;9/16,\;1\). Therefore,

$$ \begin{aligned} T_4 &=\frac14\left(\frac{0+1}{2}+\frac{1}{16}+\frac14+\frac{9}{16}\right)\\ &=\frac14\left(\frac12+\frac{14}{16}\right) =\frac14\left(\frac{11}{8}\right) =\frac{11}{32}. \end{aligned} $$

An antiderivative is \(x^3/3\), so the exact integral is

$$ \int_0^1x^2\,dx=\left[\frac{x^3}{3}\right]_0^1=\frac13. $$

Since \(f''(x)=2\), \(M_2=2\). The error bound is

$$ \frac{2(1-0)^3}{12(4)^2}=\frac{1}{96}. $$

The actual error is \(\left|11/32-1/3\right|=|33/96-32/96|=1/96\), equal to the bound. As a check on the integral calculation, differentiating \(x^3/3\) gives \(x^2\).

Worked Example: A Cubic with a Looser Bound

For \(f(x)=x^3\) on \([0,1]\), use \(n=2\), then compare the actual error with the bound.

Here \(h=1/2\), and the function values at \(0,1/2,1\) are \(0,1/8,1\). Thus

$$ T_2 =\frac12\left(\frac{0+1}{2}+\frac18\right) =\frac12\left(\frac58\right) =\frac{5}{16}. $$

The exact integral is

$$ \int_0^1x^3\,dx=\left[\frac{x^4}{4}\right]_0^1=\frac14. $$

Since \(f''(x)=6x\), the maximum magnitude on \([0,1]\) is \(M_2=6\). The error bound is

$$ \frac{6(1-0)^3}{12(2)^2}=\frac18. $$

The actual error is \(\left|5/16-1/4\right|=|5/16-4/16|=1/16\), which is no greater than \(1/8\). Differentiating the antiderivative \(x^4/4\) gives \(x^3\), confirming the integral used in the check.

Worked Example: A Trigonometric Function on a Nonunit Interval

Use \(n=2\) to estimate \(\int_0^{\pi/2}\sin x\,dx\), and calculate the corresponding error bound.

The panel width is \(h=(\pi/2)/2=\pi/4\), and the grid points are \(0,\pi/4,\pi/2\). The function values are \(0,\sqrt{2}/2,1\), so

$$ T_2 = \frac{\pi}{4}\left( \frac{0}{2}+\frac{\sqrt{2}}{2}+\frac{1}{2} \right) = \frac{\pi(1+\sqrt{2})}{8} \approx 0.9481. $$

The exact integral is \([-\cos x]_0^{\pi/2}=1\). Also, \(f''(x)=-\sin x\), so \(M_2=1\) on this interval. The bound is

$$ \frac{1\cdot(\pi/2)^3}{12(2)^2} = \frac{\pi^3}{384} \approx 0.0807. $$

The actual error is \(1-\pi(1+\sqrt{2})/8\approx 0.0519\), which is below \(0.0807\). The exact integral checks directly by differentiating \(-\cos x\), whose derivative is \(\sin x\).

A Common Error: Forgetting to Add All Panels

A one-panel bound is not yet a bound for the whole composite rule. For example, with \(f(x)=x^2\) on \([0,1]\) and \(n=4\), the local bound on one panel is

$$ \frac{M_2h^3}{12} = \frac{2(1/4)^3}{12} = \frac{1}{384}. $$

It would be incorrect to claim that \(1/384\) bounds the total error: the actual total error is \(1/96\), which is larger. There are four panels, so adding their local bounds gives

$$ 4\left(\frac{1}{384}\right)=\frac{1}{96}. $$

The correction is to sum the panel bounds before substituting \(h=(b-a)/n\). That missing factor of \(n\) is precisely why the composite bound has \(n^2\) in the denominator rather than \(n^3\).

Using the Estimate Carefully

The bound is a guarantee when its assumptions hold, but it is not generally the actual error. It may be exact, as in the quadratic example, or larger than the error, as in the cubic and sine examples. A smaller bound is more informative, but the theorem itself does not assert that the error equals its right-hand side.

To apply the result, one must have a valid upper bound for \(|f''(x)|\) across the full interval. The theorem does not supply that bound automatically. If \(f\) is not twice continuously differentiable on the closed interval, or if no finite bound on \(|f''|\) is available there, this particular estimate cannot be invoked as stated. In particular, applying it across an endpoint singularity without checking the assumptions is not justified.

The factor \((b-a)^3\) also matters: the estimate depends on the length of the interval as well as the panel count. For a fixed interval and a fixed \(M_2\), replacing \(n\) by \(2n\) changes the bound by the factor \(n^2/(2n)^2=1/4\). This describes the change in the guaranteed error bound; it is not a claim that every actual error must decrease by exactly that factor.

Check Your Understanding

Use the definitions and derivation above to answer these questions.

  1. What smoothness assumption on \(f\) is used in the composite trapezoidal error bound?
  2. For one panel of width \(h\), what is the error bound in terms of \(M_2\) and \(h\)?
  3. Why does summing the one-panel estimates produce a factor of \(n\) before replacing \(h\) by \((b-a)/n\)?
  4. For a fixed interval and fixed \(M_2\), by what factor does the theorem’s bound change when the panel count is doubled?
  5. Why is the one-panel bound not, by itself, a bound for a composite estimate with several panels?

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): 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