Maths › Numerical methods › The trapezium rule
The trapezium rule
The trapezium rule estimates a definite integral from function values or tabulated ordinates. Where f'' has one sign throughout each strip, it determines whether the corresponding chord lies above or below the curve. For a function known to be monotonic, left- and right-endpoint rectangle sums give lower and upper bounds.
Newton-Raphson and the trapezium rule, part 2 of 2. Part 1 is The Newton-Raphson method.
Builds on Definite integrals and areas.
IN THIS TOPIC
- Estimate definite integrals by the trapezium rule with a stated number of strips.
- Decide from the sign of f'' whether the estimate is an overestimate or an underestimate.
- Count ordinates against strips, and state how an estimate can be improved.
- Bound an integral between two rectangle sums, and state the condition each bound requires.
- Turn a record of readings into a quantity, with its units and the assumptions it rests on.
COMMON MISCONCEPTION
The trapezium rule always underestimates, because the chords cut the corners off the curve.
The direction of the error follows from the curvature. Where f'' is positive the curve is convex, the chords lie above it and the estimate is too big; where f'' is negative the curve is concave, the chords lie below it and the estimate is too small. Four strips under √(1 + x2) on [0, 1] give 1.1515 against a true 1.1478. Where f'' changes sign inside the interval, no direction can be claimed.
Strips with straight tops
The trapezium rule estimates a definite integral from the values of the integrand at equally spaced points. Divide the interval into n strips of width h, join consecutive ordinates by straight chords, and add the areas of the trapezia.
with h = (b − a)/n. The bracket takes each end ordinate once and each interior ordinate twice, because every interior ordinate is a side of two trapezia. There are n + 1 ordinates for n strips; check that count before computing h.
Some integrands have no antiderivative expressible in terms of the standard functions, and some functions are given only as a table of readings. The rule estimates the definite integral in either case, since it works from the ordinates rather than from an antiderivative.
The direction of the error follows from the curvature. Where f'' is positive across the interval the curve is convex, every chord lies above it and the estimate is too big; where f'' is negative the curve is concave, the chords lie below it and the estimate is too small. Overestimate or underestimate gives the reasoning behind that, and the condition it requires.
WORKED EXAMPLE
Under a known curve, as a test
Estimate ∫12 ln x dx with 4 strips, and compare with the exact value.
h = 0.25, and the five ordinates are 0, 0.2231, 0.4055, 0.5596, 0.6931.
T = (0.25/2)(0 + 0.6931 + 2(0.2231 + 0.4055 + 0.5596)) = 0.3837.
Integration by parts gives the exact value, 2 ln 2 − 1 = 0.3863, so the estimate is 0.0026 below it. On [1, 2] the second derivative of ln x is −1/x2, which is negative throughout, so the curve is concave, every chord lies below it and the estimate is an underestimate. Doubling to 8 strips gives 0.3856.
A question that supplies a table of readings and no function is still a trapezium-rule question. There is no expression to integrate; the readings are the ordinates, their spacing is h, and the bracket is filled in as above.
The questions on this topic, with worked answers beneath them, are on the trapezium rule questions page.
Overestimate or underestimate
The rule replaces each arc of the curve by the chord across it, so the direction of the error is set by which side of the curve the chords lie on. Where f'' is positive on a strip the curve is convex, the chord lies above it and that trapezium overestimates. Where f'' is negative the curve is concave, the chord lies below it and that trapezium underestimates. A direction for the whole estimate follows only when f'' keeps one sign across every strip.
Two consequences. The estimate is not always low: whether a chord lies above or below the curve depends on the sign of f''. And where f'' changes sign inside the interval, some chords lie above the curve and others below it, so the errors are of opposite sign and no direction can be claimed for the total without further work. A question that asks for a direction supplies a function whose second derivative keeps one sign on the interval.
Improving an estimate is a question about h. Halving the strip width, that is, doubling n, shortens every chord, so each chord lies closer to the arc it replaces and the estimate improves. Where f'' keeps one sign, the direction of the error does not change: an overestimate refined by more strips remains an overestimate and approaches the true value from above.
INDEPENDENT PRACTICE
Over or under, then the number
Using 4 strips, estimate ∫01 √(1 + x2) dx, and state with a reason whether your estimate is too big or too small.
Show the working
The ordinates at 0, 0.25, 0.5, 0.75, 1 are 1, 1.0308, 1.1180, 1.25, 1.4142.
T = (0.25/2)(1 + 1.4142 + 2(1.0308 + 1.1180 + 1.25)) = 1.1515.
The second derivative of √(1 + x2) is (1 + x2)−3/2, positive on [0, 1], so the curve is convex, the chords lie above it and the estimate is an overestimate. The true value is 1.1478. A complete answer states the reason as well as the direction.
Two rectangle sums that bound the area
The sign of f'' gives a direction but not a size, and a question may ask instead for two values between which the integral must lie. Rectangle sums supply those; the trapezium rule on its own does not. Divide the interval as before, but take the top of each strip as horizontal rather than as a chord. Using the left-hand ordinate of each strip as its height gives one sum, and using the right-hand ordinate gives another.
The ordinates and h are the same in both sums; only the choice of end supplying the height changes. Where the function increases across a strip, the left-hand ordinate is its least value there, so that rectangle lies inside the region and its area is less than the strip's; the right-hand ordinate is its greatest value, so that rectangle contains the region and its area is greater. Applied to every strip of an increasing function, this gives L below the integral and R above it. For a decreasing function the two exchange roles. Rather than memorising which is which, decide on each strip whether the ordinate used is the smaller or the larger of the two.
Monotonic on each strip is the condition each bound requires, because the argument uses the end ordinates as the extreme values on the strip, and a function that turns inside a strip takes values beyond both of them. Take y = 4x − x2 across [0, 4] in two strips of width 2. The ordinates are 0, 4, 0, so L = 2(0 + 4) = 8 and R = 2(4 + 0) = 8: the two sums are equal, and the true area 32 − 64/3 = 10.67 exceeds both. Neither value bounds the integral above. Split the interval at the turning point, bound each monotonic piece separately, and add the results.
The two sums share every ordinate except the first and the last, so for an increasing function they differ by h(yn − y0), the strip width times the total rise. Halving h halves that difference, which converts a required accuracy into a number of strips before any arithmetic is done. Adding the sums instead gives every interior ordinate twice and each end ordinate once, so L + R = 2T: the trapezium estimate is the mean of the two bounds. It therefore lies within half the width of those bounds of the true value, using the same ordinates.
A third choice of height gives no bound. Take the height of each strip at its centre rather than at either end. The rectangle then exceeds the region on one half of the strip and falls short on the other, so the errors are of opposite sign. On the four strips used above, the centre heights are 0.1178, 0.3185, 0.4855 and 0.6286, and h times their sum is 0.3876 against the true 0.3863: half the trapezium rule's error, and on the other side of the true value. This sum is the mid-ordinate rule, which appears in Further Mathematics. It supplies no bound, which is why the two end-ordinate sums are used here.
WORKED EXAMPLE
Bounds either side of a known answer
Bound ∫12 ln x dx between two rectangle estimates with 4 strips, and compare them with the trapezium value.
The ordinates and h = 0.25 are the ones found above, and ln x increases across the whole of [1, 2], so the left-hand sum is the low bound and the right-hand sum the high one.
L = 0.25(0 + 0.2231 + 0.4055 + 0.5596) = 0.2971 and R = 0.25(0.2231 + 0.4055 + 0.5596 + 0.6931) = 0.4703, so the area lies between them.
The exact value 0.3863 lies between them, and the mean of the bounds is 0.3837, which is the trapezium estimate to the last digit.
The bounds are 0.1733 apart while the trapezium value is 0.0026 from the true value, so the bounds give certainty rather than accuracy, and doubling to 8 strips narrows them to 0.0866 apart. Combining the two results: the curve is concave, so 0.3837 is below the true value, which therefore lies between 0.3837 and 0.4703.
A record of readings, and what it supports
In the readings-only case no function is given anywhere in the question. A pump fills a tank, and the flow rate is recorded every five minutes.
| Time t (minutes) | Flow rate R (litres per minute) |
|---|---|
| 0 | 12.0 |
| 5 | 18.5 |
| 10 | 22.4 |
| 15 | 24.6 |
| 20 | 25.5 |
| 25 | 25.9 |
| 30 | 26.0 |
WORKED EXAMPLE
Volume delivered, from the record alone
Estimate the volume of water delivered in the first 30 minutes, and state what the estimate rests on.
Volume is the area under rate against time. There is no function to integrate, so the readings are the ordinates: seven of them, six strips, h = 5 minutes.
T = (5/2)(12.0 + 26.0 + 2(18.5 + 22.4 + 24.6 + 25.5 + 25.9)) = (5/2)(271.8) = 679.5, and litres per minute multiplied by minutes is litres, so about 680 litres has been delivered.
The recorded increases become smaller, which suggests concave behaviour at the observation times, but the table does not determine the curve between readings. The data alone therefore do not show whether the trapezium estimate is high or low.
The left- and right-endpoint sums, L = 5 × 128.9 = 644.5 litres and R = 5 × 142.9 = 714.5 litres, are bounds only if the flow rate is known to be monotonic on every five-minute interval. Without that additional assumption, report about 680 litres as an estimate and recommend more frequent readings.
Two significant figures, 680 litres, is what this record supports; 679.5 claims a precision the readings do not have, since nothing was measured between them and a change within any five-minute gap leaves no trace in the arithmetic.
A context adds a step at each end. Reading the situation into ordinates comes before the method, and giving the answer in its own units, with the assumptions it rests on, comes after it. The method between them is the trapezium rule applied to the readings as ordinates.
ASSESSMENT FOCUS
- Trapezium bracket: end ordinates once, interior ordinates twice. Check the ordinate count against the strip count, since n strips need n + 1 ordinates and h = (b − a)/n.
- A statement that the estimate is above or below the true value requires the sign of f'' on the interval, with the concave or convex conclusion stated.
- Keep the ordinates to more figures than the answer requires and round once, at the end. Five ordinates each rounded early can change the last figure of the total.
- A table of readings with no function is still a trapezium-rule question, and the spacing of the readings is h.
- Where bounds are asked for rather than a direction, use rectangle sums with the end ordinates as heights, and state that the function is increasing or decreasing throughout, which is what makes each sum a bound.
- In context, give the answer in the units formed by the two quantities, and state what the estimate assumes about the intervals between readings.
- Where a question asks how to improve an estimate, more strips is the answer supported by this method: rectangle sums bound an integral rather than estimating it more precisely, and the trapezium rule is the numerical integration required by Edexcel 9MA0 9.4.
CHECK YOURSELF
Use the trapezium rule with 3 strips to estimate ∫03 1/(1 + x) dx, and state with a reason whether the estimate is above or below the true value.
Show a hint
Ordinates first, then the bracket. The sign of the second derivative gives the direction of the error.
Show the answer
Three strips over a width of 3 gives h = 1, and the four ordinates at x = 0, 1, 2, 3 are 1, 0.5, 0.3333 and 0.25.
T = (1/2)(1 + 0.25 + 2(0.5 + 0.3333)) = (1/2)(1.25 + 1.6667) = 1.4583.
The second derivative of 1/(1 + x) is 2/(1 + x)3, positive on [0, 3], so the curve is convex, every chord lies above it and the estimate is too big. The exact value is ln 4 = 1.3863, which is below it. Three strips across an interval of width 3 is a coarse division: doubling to six strips would roughly quarter the error without changing its direction.
Rectangle sums bound the integral. The function decreases throughout, so the left-hand sum 1(1 + 0.5 + 0.3333) = 1.8333 is above the area and the right-hand sum 1(0.5 + 0.3333 + 0.25) = 1.0833 is below it, with 1.3863 between them and 1.4583 their mean.
The trapezium rule adds straight-topped strips, end ordinates once and interior ordinates twice, with n + 1 ordinates to n strips.
Where f'' keeps one sign, it fixes the direction of the error: convex overestimates, concave underestimates, and more strips reduce the error without changing its direction.
Where the function is monotonic on every strip, the two end-ordinate sums lie either side of the integral, h(yn − y0) apart, with the trapezium value at their mean.
WORKBOOK
Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.
Or read them with their worked answers on the trapezium rule questions page.
CHECK YOUR PROGRESS
Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device, unless you sign in.
- Estimate definite integrals by the trapezium rule with a stated number of strips.
- Decide from the sign of f'' whether the estimate is an overestimate or an underestimate.
- Count ordinates against strips, and state how an estimate can be improved.
- Bound an integral between two rectangle sums, and state the condition each bound requires.
- Turn a record of readings into a quantity, with its units and the assumptions it rests on.
Open the full revision checklist to see every objective in the course in one place.