An integral whose antiderivative cannot be found is approximated numerically. Laying out trapezoids instead of rectangles is the trapezoidal rule1. We look at its accuracy for from to .
The area of a trapezoid is the average of the two parallel sides times the width.
The true value is , so the error is .
It is a sum with half weight on the two ends.
It is also the average of the left-endpoint sum and the right-endpoint sum.
| Construction | Value |
|---|---|
| Left-endpoint sum | |
| Right-endpoint sum | |
| Their average, the trapezoidal rule |
An underestimate and an overestimate, added and halved.
| Partition | Approximation | Error | |
|---|---|---|---|
| Two pieces | |||
| Four pieces |
Halving quarters the error, which shows that the error is proportional to . The error of a plain rectangle sum is proportional to , so the trapezoidal rule shrinks faster.
| Concavity of the function | What the trapezoidal rule gives |
|---|---|
| Concave up | an overestimate |
| Concave down | an underestimate |
It is decided by whether the top of the trapezoid lies above or below the curve. Knowing the concavity tells one the direction of the error.
Approximate with parabolas rather than lines. Joining three points at a time with a parabola gives Simpson's rule, whose error is proportional to , and with the same four pieces it reproduces exactly2. A quadratic is represented perfectly by a parabola.
The smooth curve on the graph is , the polyline is the approximation joining the tops of the trapezoids, and the large dots are the division points.