Trapezoidal Rule: Formula, Error Bound, and Examples
Estimate integrals with equal or unequal trapezoids. Compare the result with the exact value and check the error bound with six examples.
TL;DR
The trapezoidal rule estimates a definite integral by joining neighbouring sample points with straight lines. Multiply each interval width by the average of its endpoint heights. Add those signed contributions over the full interval.
Key Points
- A single trapezoid uses two endpoint values.
- In an equally spaced composite rule, interior values count twice in the usual formula.
- For unequally spaced points, calculate each interval using its own width.
- The rule is exact for linear functions because the chords follow the graph.
- Curvature determines the error, and a second-derivative bound can guide the number of intervals.
What is the trapezoidal rule?
For a function on , approximate the curve by the segment connecting and . The signed integral of that segment is its width times its average height:
When both heights are positive, this is the familiar trapezoid area. A graph below the horizontal axis contributes a negative value to the definite integral. The formula automatically keeps that sign. For background on the geometric area, see the trapezoid area guide. OpenStax, Numerical Integration
How do you use the composite trapezoidal rule?
Divide into equal subintervals. Write and for . The usual form is
The two outer endpoints appear once. Each interior value is the right endpoint of one trapezoid and the left endpoint of the next, so it appears twice. This is also the average of the left and right endpoint sums for the same equal-width partition. University of Nebraska–Lincoln, Numerical Integration
For unequal spacings, use half the sum of each pair of heights multiplied by its own width. Add those local values. Using one common width for irregular time readings or uneven measurement locations would pair values with the wrong intervals. University of California, Berkeley, Numerical Integration
When does the rule overestimate or underestimate?
If the graph is convex on the interval, each chord lies above it, so the estimate is at least as large as the actual integral. For a concave graph, the chords lie below it. A function can change curvature, in which case different local errors can offset each other.
If is continuous on and , the equal-width composite error satisfies
This is an upper bound for the magnitude of error, rather than the error itself. Doubling divides the bound by four. The function extrema guide can help find a maximum of on a closed interval. University of Waterloo, Composite Trapezoidal Rule
How does trapezoidal integration compare with other rules?
The left and right endpoint rules use one height per subinterval and form rectangles. The midpoint rule uses the centre height. The trapezoidal rule uses both endpoints and forms a straight-line cap. Simpson’s rule fits quadratic pieces to sampled points and, in its standard composite form, uses an even number of equal subintervals. Choose according to the available sample positions and smoothness of the function. CLP Integral Calculus, Numerical Integration
Worked Trapezoidal Rule Examples
Example 1
Use a single trapezoid for from 0 to 4.
- The width is 4 and the endpoint heights are 1 and 5.
- Their average is 3, so the estimate is .
- The function is linear, so this equals the exact integral.
Example 2
Use four equal trapezoids for from 0 to 2.
- The width is . The values at the five endpoints are .
- Double the three interior values and add the outer ones. The weighted sum is 11.
- Multiply by . The result is . The exact value is , so the overestimate is .
Example 3
Approximate the integral from table points , , and .
- The first interval has width 1 and average height 3, giving 3.
- The second interval has width 2 and average height 4.5, giving 9.
- The sum is 12. Each interval used its own width.
Example 4
Apply two trapezoids to on .
- Use width 1 and heights 4, 3, and 0.
- The composite estimate is .
- The exact integral is . The approximation is smaller, matching the expected sign for a concave function.
Example 5
Choose enough equal trapezoids to guarantee an error at most 0.001 for on .
- The second derivative is , whose maximum on this interval is .
- Require . This gives , slightly above 15.
- Choose 16 equal intervals. The bound is then below 0.001.
Example 6
Speed readings at 0, 2, and 4 seconds are 0, 2, and 5 metres per second. Estimate the distance covered.
- The first interval contributes metres.
- The second contributes metres.
- The estimated distance is 9 metres. The units follow from multiplying speed by time.
Mistakes That Change a Trapezoidal Estimate
Mistake 1: Doubling the first and last values
Only interior values occur in two neighbouring trapezoids. Use the outer endpoints once.
Mistake 2: Using the full interval width in every trapezoid
For equally spaced points, each width is . For unequal spacing, subtract each neighbouring pair of inputs.
Mistake 3: Treating the error bound as the exact error
The bound is a guarantee under its assumptions. The actual error can be smaller and may be positive or negative.
Try It Yourself
- Use one trapezoid for on .
- Find the composite estimate for heights 1, 4, and 6 at inputs 0, 2, and 4.
- How does the error bound change if you triple the number of equal intervals?
Answers and Reasoning
- The width is 3 and the average height is 3. The estimate is 9 and is exact.
- Compute .
- It becomes one-ninth as large because the denominator contains .
Frequently Asked Questions
What if the function crosses below zero?
The formula approximates signed integral. If total unsigned area is required, split at zeros and accumulate positive magnitudes.
Is the trapezoidal rule exact for a constant function?
Yes. A constant is linear with slope zero, so the approximating segments follow its graph exactly.
Do you need even numbers of subintervals?
No. Any positive whole number of intervals can be used. The even-subinterval requirement applies to the standard composite Simpson rule.
Conclusion
- Average endpoint values within each interval and multiply by its width.
- Use the composite weights only for equal spacing.
- Check curvature or a second-derivative bound when accuracy matters.
Read More
- Use common integration formulas when an exact antiderivative is available
- Check whether a discontinuity changes how an integral is evaluated
Research Behind This Article
- OpenStax, Calculus Volume 2: Numerical Integration. OpenStax
- University of Nebraska–Lincoln, Active Calculus: Numerical Integration. UNL
- Per-Olof Persson, Numerical Differentiation and Integration. UC Berkeley
- Douglas W. Harder, Composite Trapezoidal Rule. University of Waterloo
- Joel Feldman, Andrew Rechnitzer and Elyse Yeager, CLP Integral Calculus: Numerical Integration. CLP Calculus