Tutorials › Calculus II › Trapezoidal Refinement Error Estimates

Quadrature and Error Bounds · Tutorial 369 of 998

Trapezoidal Refinement Error Estimates

Use the difference between nested trapezoidal approximations to estimate the fine-grid error, and recognize when that estimate may not be trustworthy.

Intermediate 10 min read

What You'll Learn

  • Define coarse and fine trapezoidal approximations on nested grids.
  • Derive the factor of one third for estimating the fine-grid error.
  • Distinguish the estimated fine-grid error from the coarse-grid error.
  • Use the difference to form a Richardson-corrected approximation.
  • Identify smoothness, asymptotic-regime, and cancellation issues that can undermine the estimate.

Why Compare Two Trapezoidal Approximations?

A trapezoidal approximation is useful only if we have some sense of its accuracy. Often the exact integral is unknown, so directly calculating the error is impossible. A practical alternative is to compute the approximation on two related grids and use their difference to estimate the error.

The key is that the composite trapezoidal rule has second-order error behavior: when the panel width is halved, the leading error is approximately divided by four. The two approximations therefore differ by about three times the error remaining in the finer result. This relationship gives a useful estimate, but it is not automatically a guaranteed error bound.

Coarse and Fine Nested Grids

Let \(I=\int_a^b f(x)\,dx\), and let \(T_n\) denote the composite trapezoidal approximation using \(n\) equal panels on \([a,b]\). The panel width is \(h=(b-a)/n\), and the rule is

$$ T_n = h\left[ \frac{f(a)+f(b)}{2} + \sum_{j=1}^{n-1} f(a+jh) \right]. $$

For a refinement comparison, use \(n\) panels for the coarse grid and \(2n\) panels for the fine grid. The fine grid contains every coarse-grid point, along with one new point halfway between each pair of neighboring coarse points. Write \(T_c=T_n\) and \(T_f=T_{2n}\). Their signed difference is

$$ D=T_f-T_c. $$

This comparison requires the same integrand and interval, and a fine grid whose panel width is half the coarse panel width. Comparing unrelated grids does not justify the same error scaling.

Why the Fine-Grid Error Is About One Third of the Difference

For a twice continuously differentiable function, the leading composite trapezoidal error is proportional to the square of the panel width. In particular, for sufficiently small \(h\), the approximations have the form

$$ T_h=I+Ch^2+o(h^2), $$

where \(C\) depends on the function and interval, and \(o(h^2)\) denotes a remainder whose ratio to \(h^2\) tends to zero as the grid is refined. The leading coefficient can be seen from the local trapezoidal error: on a panel of width \(h\), the trapezoidal value minus the integral is \(h^3 f''(\xi)/12\) for some point \(\xi\) in that panel. Summing over panels and taking a Riemann-sum limit gives \(C=(f'(b)-f'(a))/12\). Thus the leading error scales like \(h^2\).

The following derivation uses that scaling. It explains both the factor of one third and the assumptions behind the estimate.

1
Write the coarse approximation.
For coarse width \(h\), \(T_c=I+Ch^2+o(h^2)\).
2
Halve the panel width.
The fine width is \(h/2\), so \(T_f=I+C(h/2)^2+o(h^2)=I+Ch^2/4+o(h^2)\).
3
Subtract the approximations.
\(D=T_f-T_c=-3Ch^2/4+o(h^2)\).
4
Compare with the fine-grid error.
\(I-T_f=-Ch^2/4+o(h^2)\), so \(D/3\) has the same leading term as \(I-T_f\).

Consequently, the signed fine-grid error is estimated by \(D/3\), and its magnitude by \(|D|/3\). The sign convention matters: \(I-T_f\) is the exact integral minus the fine approximation, while \(D=T_f-T_c\). When the estimate is accurate, these signed quantities have the same sign.

Refinement estimate: For nested trapezoidal grids with panel widths in the ratio \(2:1\), estimate the fine-grid error by \(I-T_f\approx (T_f-T_c)/3\). Estimate its magnitude by \(|T_f-T_c|/3\). This is generally an asymptotic estimate, not a guaranteed error bound.

The coarse-grid error is different. Since the leading error on the coarse grid is four times the leading error on the fine grid, its magnitude is estimated by \(4|D|/3\), not \(|D|/3\). Confusing these two estimates is a common source of a factor-of-four mistake.

Worked Calculations

Worked Example: Estimate the Error for \(x^2\)

Estimate the fine-grid error for \(\int_0^1 x^2\,dx\), using two coarse panels and four fine panels. The exact integral is

$$ I=\left[\frac{x^3}{3}\right]_0^1=\frac13. $$

For the coarse grid, \(h=1/2\), and the function values at \(0,1/2,1\) are \(0,1/4,1\). Therefore,

$$ T_c = \frac12\left[\frac{0+1}{2}+\frac14\right] = \frac12\left(\frac12+\frac14\right) = \frac38. $$

For the fine grid, \(h=1/4\), and the values at \(0,1/4,1/2,3/4,1\) are \(0,1/16,1/4,9/16,1\). Thus,

$$ T_f = \frac14\left[ \frac{0+1}{2} +\frac1{16}+\frac14+\frac9{16} \right] = \frac14\left(\frac12+\frac{14}{16}\right) = \frac14\cdot\frac{11}{8} = \frac{11}{32}. $$

The difference is \(D=11/32-3/8=11/32-12/32=-1/32\). The estimated signed fine-grid error is \(D/3=-1/96\), and its estimated magnitude is \(1/96\). Check against the exact error:

$$ I-T_f = \frac13-\frac{11}{32} = \frac{32-33}{96} = -\frac1{96}. $$

Here the estimate is exact. The fine approximation exceeds the integral by \(1/96\), matching the predicted signed error.

Worked Example: Estimate Error for a Nonpolynomial Integrand

Use two and four panels to estimate the error in the four-panel approximation to \(\int_0^1 \frac{1}{1+x}\,dx=\ln 2\).

For two panels, the width is \(1/2\), and the values at \(0,1/2,1\) are \(1,2/3,1/2\). Hence

$$ T_c = \frac{1/2}{2}\left[1+\frac12+2\left(\frac23\right)\right] = \frac14\left(\frac32+\frac43\right) = \frac14\cdot\frac{17}{6} = \frac{17}{24} \approx 0.708333. $$

For four panels, the width is \(1/4\); the three interior values are \(4/5,2/3,4/7\). Therefore,

$$ \begin{aligned} T_f &= \frac{1/4}{2} \left[ 1+\frac12+2\left(\frac45+\frac23+\frac47\right) \right]\\ &= \frac18\left[ \frac32+2\left(\frac{84+70+60}{105}\right) \right]\\ &= \frac18\left(\frac32+\frac{428}{105}\right) = \frac18\cdot\frac{1171}{210} = \frac{1171}{1680} \approx 0.697024. \end{aligned} $$

Thus

$$ D = \frac{1171}{1680}-\frac{17}{24} = \frac{1171-1190}{1680} = -\frac{19}{1680}. $$

The estimated magnitude of the fine-grid error is \(19/5040\approx 0.003770\), and its estimated signed value is \(-19/5040\). The exact integral is \(\ln 2\approx0.693147\), so the actual signed error is \(0.693147-0.697024\approx-0.003877\). The estimate is close but not exact, as expected for a nonzero higher-order remainder. The signs also agree: the fine approximation is above the integral.

Richardson Correction

The same difference can be used to improve the approximation, not just estimate its error. Since the leading error in \(T_f\) is approximately one quarter of the leading error in \(T_c\), the combination below cancels that leading term:

$$ T_R=T_f+\frac{T_f-T_c}{3} =\frac{4T_f-T_c}{3}. $$

For example, in the preceding calculation,

$$ T_R = \frac{4(1171/1680)-17/24}{3} = \frac{3494/1680}{3} = \frac{1747}{2520} \approx 0.693254. $$

This is closer to \(\ln 2\approx0.693147\) than \(T_f\) is. The correction removes the leading second-order error term; it does not guarantee that the remaining error is zero or provide a guaranteed bound.

When the Estimate Can Mislead

The estimate relies on the leading second-order error behavior being a useful description of both grids. It can be unreliable if the grid is too coarse for that behavior to dominate, or if the integrand is not sufficiently smooth. A corner, jump, singularity, or other irregularity can change the error scaling. The estimate can also be misleading when the leading coefficient \(C\) is zero or very small: then higher-order terms, rather than the assumed leading term, control the observed difference.

Worked Example: A Nonsmooth Integrand Gives a Misleading Estimate

Consider \(f(x)=|x|\) on \([-1,1]\). Its exact integral is

$$ I=\int_{-1}^{1}|x|\,dx =2\int_0^1 x\,dx =1. $$

With one coarse panel, the endpoints both have value \(1\), so \(T_c=2(1+1)/2=2\). With two fine panels, the grid values are \(1,0,1\), giving

$$ T_f=\frac{1}{2}\left[1+1+2(0)\right]=1, \qquad D=T_f-T_c=1-2=-1. $$

The refinement formula would estimate \(I-T_f\) as \(D/3=-1/3\). But direct checking gives \(I-T_f=1-1=0\). The fine rule is exact here because the grid point at the corner captures the shape of this particular function. The one-third estimate is not a bound; the nonsmooth corner also means the usual smoothness-based error analysis does not apply.

Even for a smooth function, a small difference does not by itself prove that the fine result is accurate: the grids may not yet be in the asymptotic regime, or error contributions may partially cancel. Treat \(|T_f-T_c|/3\) as evidence about accuracy, not as a certified tolerance test. When accuracy must be guaranteed, use an applicable error bound with its required hypotheses.

Summary

For nested composite trapezoidal grids with a halved panel width, second-order error behavior gives a simple refinement estimate: the fine-grid error is approximately one third of the difference between fine and coarse results. The coarse-grid error is approximately four times the fine-grid error. The same comparison yields a Richardson-corrected approximation, while smoothness and asymptotic behavior determine how much confidence to place in either calculation.

Check Your Understanding

Use the definitions and reasoning above to answer these questions.

  1. If \(T_c=2.4\) and \(T_f=2.1\), what is the estimated magnitude of the fine-grid error?
  2. What is the estimated signed fine-grid error when \(T_f-T_c\) is negative?
  3. Why does halving the panel width lead to the factor of one third?
  4. Write the Richardson-corrected approximation in terms of \(T_c\) and \(T_f\).
  5. Give two reasons the refinement estimate may be unreliable.