Fitting the Curve Better
The trapezoidal rule
First improvement: instead of a flat-topped rectangle, we join the two values of at the endpoints of each piece with a segment. We then approximate the area by trapezoids, which follow the curve much better since the segment follows the local slope.
The area of a trapezoid is . When we add up all the trapezoids, the interior values are counted twice, since each serves as an edge of two neighboring trapezoids, hence the formula:
The two endpoint values count once, all the interior values count double: this is the pattern .
For the same number of points, trapezoids are much more accurate than rectangles: the error decreases like instead of . Dividing the error by then only takes twice as many points.
| Method | Top | Order of the error |
|---|---|---|
| rectangles | flat | |
| trapezoids | slanted segment |
Remember the principle: replacing the flat top with a slope that follows the curve makes accuracy leap forward. One last idea remains for an even better approximation — curving the top itself.

