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
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
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
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.
For coarse width \(h\), \(T_c=I+Ch^2+o(h^2)\).
The fine width is \(h/2\), so \(T_f=I+C(h/2)^2+o(h^2)=I+Ch^2/4+o(h^2)\).
\(D=T_f-T_c=-3Ch^2/4+o(h^2)\).
\(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.
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
For the coarse grid, \(h=1/2\), and the function values at \(0,1/2,1\) are \(0,1/4,1\). Therefore,
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,
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:
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
For four panels, the width is \(1/4\); the three interior values are \(4/5,2/3,4/7\). Therefore,
Thus
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:
For example, in the preceding calculation,
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
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
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.
- If \(T_c=2.4\) and \(T_f=2.1\), what is the estimated magnitude of the fine-grid error?
- What is the estimated signed fine-grid error when \(T_f-T_c\) is negative?
- Why does halving the panel width lead to the factor of one third?
- Write the Richardson-corrected approximation in terms of \(T_c\) and \(T_f\).
- Give two reasons the refinement estimate may be unreliable.