notesonly.in

One notebook for every subject — open it anywhere.

Log in

Trapezoidal Rule: Formula, Error Bound, Worked Examples

The trapezoidal rule approximates a definite integral by replacing the curve with straight-line segments and adding the areas of the resulting trapezoids. On each subinterval you take the average of the two endpoint heights times the width — the trapezoid's area — and sum over all subintervals. Only function values are needed, no antiderivative.

This matters because most real integrals have no closed-form antiderivative — the functions in statistics, physics, and engineering rarely integrate neatly. The trapezoidal rule is the simplest reliable numerical integrator, the foundation of more accurate methods (Simpson's rule is a weighted combination of trapezoidal estimates), and it comes with a clean error bound so you know how many subintervals guarantee the accuracy you need.

Key Concepts

  • Trapezoid area: on [x_i, x_i+1] with width h, the area is h × (f(x_i) + f(x_i+1)) / 2.
  • Composite rule: divide [a, b] into n equal subintervals of width h = (b − a)/n and apply the trapezoid on each; interior points get counted twice.
  • Error order: the error shrinks like h², so doubling n (halving h) cuts the error roughly by a factor of four.
  • Error bound: depends on the maximum of |f″| on [a, b] — curvier functions need more subintervals.

Formulas

  • Composite trapezoidal rule: ∫_a^b f(x) dx ≈ (h/2)[f(x₀) + 2f(x₁) + 2f(x₂) + … + 2f(x_n−1) + f(x_n)], with h = (b − a)/n and x_i = a + ih.
  • Error: E = −(b − a)/12 · h² · f″(ξ) for some ξ in (a, b), assuming f is twice differentiable.
  • Error bound: |E| ≤ (b − a)³/(12n²) · max|f″|. The sign of the error follows −f″: the rule overestimates where the function is concave down.
  • Subintervals for tolerance ε: choose n ≥ √((b − a)³ · max|f″| / (12ε)).

Worked Example

Approximate ∫₀¹ x² dx with n = 4, so h = 0.25. The nodes and values: f(0) = 0, f(0.25) = 0.0625, f(0.5) = 0.25, f(0.75) = 0.5625, f(1) = 1. The rule gives (0.25/2)[0 + 2(0.0625 + 0.25 + 0.5625) + 1] = 0.125[0 + 2(0.875) + 1] = 0.125 × 2.75 = 0.34375. The exact integral is 1/3 ≈ 0.333333, so the actual error is 0.34375 − 0.333333 = 0.010417. The error bound: f″(x) = 2 everywhere, so |E| ≤ (1)³/(12 × 16) × 2 = 2/192 = 0.010417 — the bound is exactly tight here because f″ is constant. Doubling to n = 8 would quarter the error to about 0.0026.

Common Misconceptions

  • "The trapezoidal rule is exact for all polynomials." It is exact only up to degree 1 (straight lines). For quadratics and above there is always some error, as the example shows.
  • "Doubling the subintervals halves the error." The error is O(h²), so doubling n cuts the error to roughly one quarter, not one half.
  • "The points must be equally spaced." The composite formula assumes equal spacing, but the basic trapezoid works on any single interval; adaptive methods exploit this by refining only where the function curves most.

Real-World Applications

  • Physics: work done by a variable force, computed from sampled force measurements.
  • Statistics: approximating probabilities and expected values from distributions with no closed form.
  • Signal processing: energy of a signal from discrete samples.
  • Economics: consumer surplus as the area under an estimated demand curve.

The trapezoidal rule estimates ∫_a^b f as (h/2) times the weighted sum of endpoint and doubled interior values, with error bounded by (b−a)³·max|f″|/(12n²). Simple, reliable, and second-order accurate, it is the building block of Simpson's rule and Romberg integration.