---
title: Trapezoidal Rule Approximation
url: https://www.emergentmind.com/topics/trapezoidal-rule-approximation
type: topic
---

# Trapezoidal Rule Approximation

The trapezoidal rule is a fundamental quadrature scheme that approximates an integral $I(f) = \int_a^b f(x)\,dx$ by fitting the integrand with a degree–1 interpolant and integrating this linear approximation exactly. The rule is a weighted mean of the two degree–0 companion quadrature rules: the left rectangle $L(f) = (b-a)f(a)$ and the right rectangle $R(f) = (b-a)f(b)$, and under classical error analysis, it achieves second order convergence for smooth functions. Technical advances have extended this rule to handle endpoint corrections, singularities, rough signals, high accuracy via spline perturbations, multidimensional domains, and near-singular integrals, while detailed analysis provides sharp error bounds and optimal constants.

## 1. The Classical Trapezoidal Rule and Its Error Analysis

Starting from the companion rule framework, the trapezoidal rule is derived as the associate of $L$ and $R$ [1906.06124]. For a single panel,
\[
T(f) = \frac{b-a}{2}\Big[f(a)+f(b)\Big],
\]
with local error $E_{T}(f) = -\frac{(b-a)^3}{12}f''(\xi)$ for some $\xi \in (a,b)$ [1202.0249]. For a uniform partition $x_i = a + ih,\ i=0,\dots,n$ with $h = (b-a)/n$, the composite rule reads
\[
T_n(f) = \frac{h}{2}\Big[f(x_0) + 2\sum_{i=1}^{n-1} f(x_i) + f(x_n)\Big],
\]
with global error bound $|E_{T_n}(f)| \leq \frac{(b-a)^3}{12 n^2} \|f''\|_\infty$.

The rule is exact for polynomials of degree ≤1, and its approximation error decays as $O(h^2)$ for $f \in C^2([a,b])$. A defining property is monotonic bracketing for monotone functions:
\[
L_n(f) \le T_n(f) \le R_n(f)\quad \text{or vice versa},
\]
enabling the construction of guaranteed integral brackets [1906.06124].

## 2. Corrected and Weighted Trapezoidal Rules

Corrected trapezoidal rules incorporate endpoint derivative information to minimize error coefficients or forcibly match cubic polynomials [1202.0249, 1205.3759]. Let
\[
T_c[f] = \frac{b-a}{2}[f(a)+f(b)] + k[f'(a) - f'(b)].
\]
The optimal coefficient $k$—minimizing the $L^p$ error—depends on the choice of norm and is computed from minimization of the monic quadratic weight function [1205.3759]. For $f'' \in L^\infty$, the sharp error bound for the corrected rule is
\[
|E_{CT}(f)| \le \frac{(b-a)^3}{32}\|f''\|_\infty,
\]
whereas the classical rule's coefficient is $1/12$.

A cubic-exact corrected rule sets $k = (b-a)^2/12$ and
\[
\int_a^b f(x)\,dx = \frac{b-a}{2}[f(a)+f(b)] + \frac{(b-a)^2}{12}[f'(a)-f'(b)] + E(f),
\]
annihilating all cubic polynomials [1205.3759]. Composite rules propagate the endpoint correction term only once due to telescoping interior derivatives. Weighted averages between the ordinary and composite rules enable cancellation of lower-order error terms, as in Youngberg's O($h^4$)–O($h^8$) extrapolation schemes [1207.6067].

## 3. Extensions: High-Order, Spline, and Multidimensional Generalizations

Trapezoidal rules can be raised to arbitrarily high algebraic order by suitable boundary perturbations. "B-spline–perturbed" integration constructs quasi-interpolation operators using centered B-splines, combining each with explicit finite difference corrections on boundaries [2405.11469]. The $p$th order composite rule for $f \in C^{p+1}$ (odd $p$) or $C^{p+2}$ (even $p$) admits
\[
\int_a^b f(x)\,dx \approx h \sum_{k=0}^N f(x_k) + \text{(boundary terms)} + O(h^{p+1}),
\]
reducing to the classical rule for $p=1$, and achieving $O(h^{p+1})$ or $O(h^{p+2})$ global convergence depending on parity.

Tensor-product analogues extend the construction to $d$ dimensions, with the leading error scaling as $O(h^{p+1})$ times $h^d$ [2405.11469]. Such extensions require only $O(p)$ additional boundary evaluations per dimension.

## 4. Treatment of Singular and Near-Singular Integrals

Standard trapezoidal rules suffer severe degradation for integrands with algebraic or logarithmic singularities near integration boundaries or grid nodes. "Corrected trapezoidal rules" resolve this by explicit local Taylor expansion of the singular kernel, followed by application of specialized stencils [2208.08216, 2203.04854, 2504.01144]. For $f(x) = s(x-x_0) v(x)$ with $s(y) = |y|^\gamma \ell(|y|,y/|y|)$, composite corrected rules combine the punctured trapezoidal sum with linear combinations of $v$ at stencil points near the singularity. The weight vectors $\omega$ are determined by enforcing exactness for a basis of smooth test functions.

For a prescribed order $p$, the global error for the composite rule is $O(h^{\gamma+n+p+1})$ for functions with isolated algebraic singularities [2208.08216]. This approach is the basis for robust near-singular integral evaluation in 3D boundary integral solvers, achieving uniform fourth-order accuracy close to interfaces [2504.01144].

## 5. Acceleration and Adaptation via Conformal and Variable Transformations

The convergence rate of the trapezoidal rule for analytic functions over unbounded or finite intervals can be dramatically accelerated by change-of-variable mappings [1406.3320, 2107.05860, 1210.6247]. Canonical conformal maps (such as the double-exponential sinh/exp families) are tuned so that the image of the nearest singularity lies at the edge of analyticity strip, $|\mathrm{Im}\,t| = d = \pi/2$, maximizing exponential convergence rates:
\[
|I-T_N| \le C \exp\Big(-\frac{\pi^2 N}{2\,\log(\pi^2 N/(2\beta_2))}\Big)
\]
for double-exponential mapping [1406.3320]. Adaptive schemes derive singularity locations by Sinc–Padé approximants and optimize map parameters accordingly.

Applications include special function evaluation via infinite-range trapezoidal sums with analytic decay, e.g., incomplete gamma and confluent hypergeometric functions [1210.6247]. Such transforms enable exponential to double-exponential convergence with $O(\exp(-C\, n^{\rho/(1+\rho)}))$ error decay.

## 6. Generalizations: Stochastic, Rough, and Convolution Integrals

The trapezoidal rule generalizes to non-deterministic integrators in rough-path theory, where it approximates iterated integrals against continuous Gaussian processes [2005.06500]. Given a partition $\pi$ of $[0,T]$ and a controlled process $y_t$, the trapezoidal sum
\[
S_\pi(y,X) = \sum_{i=0}^{N-1} \frac{y_{t_i} + y_{t_{i+1}}}{2} (X_{t_{i+1}} - X_{t_i})
\]
converges to the rough path integral $\int_{0}^{T} y \, dX$ as $|\pi|\to0$, with convergence in probability and explicit error estimates depending on regularity. All higher-order correction terms cancel in the limit, and midpoint rules follow as a direct corollary.

Trapezoidal–based quadratures are central to generalized convolution quadrature (gCQ) for time–domain integral equations [2305.11134]. The gCQ method applies the trapezoidal rule to the underlying ODE for each Laplace–transformed convolution kernel, resulting in explicit recurrence formulas for quadrature weights on nonuniform meshes, and achieves stability and $O(\Delta^2_{\max})$ global error under mild step variation.

## 7. Optimality, Adaptivity, and Extrapolation

Sharp optimal constants for trapezoidal error in various norms ($L^p, L^\infty$, Alexiewicz) have been characterized by minimization over the space of monic quadratics used in integration–by–parts error analysis [1205.3759]. These results clarify the unattainability of lower error coefficients under minimal smoothness, and provide guidance for adapting partition sizes, especially in areas of large second derivative.

Weighted extrapolation schemes, such as Youngberg's method, combine the ordinary and composite trapezoidal results to systematically cancel leading-order error terms via explicit weights, achieving O($h^6$) and higher-order accuracy without restriction to power–of–two partitions [1207.6067].

## Table: Core Formulas and Properties

| Rule/Formulation        | Formula/Definition                                                   | Error Bound        |
|------------------------|----------------------------------------------------------------------|--------------------|
| Classic Trapezoidal    | $T(f) = \frac{b-a}{2}[f(a)+f(b)]$                                    | $O(h^2)$           |
| Composite Trapezoidal  | $T_n(f) = \frac{h}{2}[f(x_0)+2\sum_{i=1}^{n-1}f(x_i)+f(x_n)]$        | $O(h^2)$           |
| Corrected Trapezoidal  | $T_c[f] = T(f) + k[f'(a)-f'(b)]$                                     | $O(h^2)$, optimal  |
| Spline-Perturbed       | $T^{(p)}[f] = T(f) + $ (boundary corrections via finite differences)  | $O(h^{p+1})$       |
| Weighted Trapezoidal   | $A_n = \frac{n^2C-nT}{n^2-1}$                                        | $O(h^4), O(h^6),$… |

## References

- "Four beautiful quadrature rules" [1906.06124]
- "Simple derivation of basic quadrature formulas" [1202.0249]
- "Optimal error estimates for corrected trapezoidal rules" [1205.3759]
- "Numerical integration rules based on B-spline bases" [2405.11469]
- "High order corrected trapezoidal rules for a class of singular integrals" [2203.04854]
- "Convergence of a class of high order corrected trapezoidal rules" [2208.08216]
- "Corrected Trapezoidal Rules for Near-Singular Surface Integrals Applied to 3D Interfacial Stokes Flow" [2504.01144]
- "On the use of conformal maps for the acceleration of convergence of the trapezoidal rule and Sinc numerical methods" [1406.3320]
- "Exponentially convergent trapezoidal rules to approximate fractional powers of operators" [2107.05860]
- "Generalized convolution quadrature based on the trapezoidal rule" [2305.11134]
- "Alternative to the Romberg Method of Estimating the Definite Integral" [1207.6067]
- "Convergence of trapezoid rule to rough integrals" [2005.06500]
- "More Special Functions Trapped" [1210.6247]

The trapezoidal rule, in its classical and modern forms, remains central to both the theory and practice of scientific computation, underpinned by rigorous analysis, extensibility to high accuracy and challenging cases, and optimal error bounds directly traceable to companion rule structure and smoothness properties.

Source: https://www.emergentmind.com/topics/trapezoidal-rule-approximation