IB Diploma Mathematics AI · Calculus
The trapezoidal rule
1Why approximate?
Sometimes a curve's equation is unknown (only some measurements exist), or it cannot be integrated easily. The trapezoidal rule estimates the area under the curve by splitting it into trapezoids (trapeziums) of equal width.
The trapezoidal rule for y = x² from 0 to 2 with four strips
The area of one trapezoid with parallel sides $y_0$ and $y_1$ and width $h$ is $\frac{h}{2}(y_0 + y_1)$.
Check yourself
What shapes does the trapezoidal rule use to estimate an area?
Show the answer
Trapezoids of equal width
Each strip has straight top edges joining the curve's points.
2The rule
With $n$ strips of width $h = \frac{b - a}{n}$:
$$\int_a^b y\,dx \approx \frac{h}{2}\left[y_0 + y_n + 2(y_1 + y_2 + \cdots + y_{n-1})\right]$$
- $y_0$ and $y_n$ are the first and last heights; they are used once.
- All the middle heights are used twice, because each is shared by two trapezoids.
A river's cross-section
- A river is 10 m wide. Its depth, measured every 2 m, is 0, 1.2, 2.0, 2.4, 1.8, 0 m.
- $h = 2$, so $\frac{h}{2} = 1$.
- Area $\approx 1 \times [0 + 0 + 2(1.2 + 2.0 + 2.4 + 1.8)] = 2 \times 7.4 = 14.8$ m².
Check yourself
Five strips cover the interval from 0 to 10. What is h?
Show the answer
2
h = (10 − 0) ÷ 5 = 2.
3Over- and underestimates
Whether the rule gives too much or too little depends on the shape of the curve.
- If the curve bends upwards (concave up, like $y = x^2$), the straight tops of the trapezoids lie above the curve: the rule overestimates.
- If the curve bends downwards (concave down), the tops lie below the curve: the rule underestimates.
- More, narrower strips give a better estimate.
Comparing with the exact value
- Estimate $\int_0^2 x^2\,dx$ with 4 strips: $h = 0.5$, heights 0, 0.25, 1, 2.25, 4.
- Estimate $= 0.25[0 + 4 + 2(0.25 + 1 + 2.25)] = 0.25 \times 11 = 2.75$.
- Exact value $= \frac{8}{3} = 2.667$. The estimate is too large, because $y = x^2$ bends upwards.
- Percentage error $= \frac{|2.75 - 2.667|}{2.667} \times 100\% = 3.13\%$.
Check yourself
A curve bends downwards. Does the trapezoidal rule over- or underestimate the area?
Show the answer
Underestimate
The straight tops cut below the curve.
4Using the rule well
- Make a table of $x$ and $y$ values first, so no height is missed or double-counted.
- Check the number of strips is one fewer than the number of heights: 6 heights make 5 strips.
- In a real context, give units: an area under a speed–time graph in m/s × s gives metres.
A car's speed is recorded every 10 seconds as 0, 8, 14, 18, 20 m/s. With $h = 10$: distance $\approx 5[0 + 20 + 2(8 + 14 + 18)] = 5 \times 100 = 500$ m.
Check yourself
How many strips do 7 equally spaced measurements make?
Show the answer
6
There is one fewer strip than the number of heights.
5A worked trapezoidal calculation
The trapezoidal rule: $\int_a^b y\,dx \approx \frac{h}{2}\left[y_0 + y_n + 2(y_1 + y_2 + \cdots + y_{n-1})\right]$, where $h = \frac{b - a}{n}$.
$\int_0^4 x^2\,dx$ with 4 strips
- $h = 1$. Values: $y_0 = 0$, $y_1 = 1$, $y_2 = 4$, $y_3 = 9$, $y_4 = 16$.
- Estimate: $\frac{1}{2}[0 + 16 + 2(1 + 4 + 9)] = \frac{1}{2}[16 + 28] = 22$.
- Exact: $\frac{4^3}{3} = 21.33$.
- The rule overestimates because the curve is concave up.
Check yourself
What is $h$ for 5 strips between $x = 0$ and $x = 10$?
Show the answer
2
$\frac{10 - 0}{5}$.
6Trapezoidal rule from data
The rule is useful when you only have measurements, not a formula.
Area of a field
- Widths measured every 10 m across a field: 0, 25, 30, 28, 0 m.
- $h = 10$.
- Area $\approx \frac{10}{2}[0 + 0 + 2(25 + 30 + 28)] = 5 \times 166 = 830$ m².
Check yourself
Why is the trapezoidal rule useful for real data?
Show the answer
It estimates area when only measurements are available
Data-based estimation.
7Going deeper: using the rule on measured data, and judging the error
The trapezoidal rule is most useful when there is no formula, only measurements.
The rule: $\text{Area} \approx \frac{h}{2}\left[y_0 + y_n + 2(y_1 + y_2 + \dots + y_{n-1})\right]$, where $h$ is the width of each strip.
Worked example (measured data): the depth of a river is measured every 2 m across its 10 m width: 0, 1.2, 2.1, 2.6, 1.8, 0 metres.
- $h = 2$, with 6 values, so 5 strips.
- Ends: $0 + 0 = 0$. Middle values: $1.2 + 2.1 + 2.6 + 1.8 = 7.7$.
- Area $\approx \frac{2}{2}\left[0 + 2(7.7)\right] = 15.4$ m².
- If the water flows at 0.5 m per second, the flow rate is about $15.4 \times 0.5 = 7.7$ m³ per second.
Worked example (a function, with the error): estimate $\int_0^2 x^2\,dx$ with 4 strips.
- $h = 0.5$. Values of $x^2$ at 0, 0.5, 1, 1.5, 2: 0, 0.25, 1, 2.25, 4.
- Estimate: $\frac{0.5}{2}\left[0 + 4 + 2(0.25 + 1 + 2.25)\right] = 0.25 \times 11 = 2.75$.
- Exact value: $\frac{8}{3} \approx 2.667$.
- Percentage error: $\frac{2.75 - 2.667}{2.667} \times 100 \approx 3.1\%$.
- It is an overestimate, because the curve bends upwards (concave up), so each straight top lies above the curve.
Over or under?
- Concave up (curving like a cup): the rule overestimates.
- Concave down (curving like a cap): the rule underestimates.
- If the curve changes shape, the errors partly cancel and you cannot say without more work.
Improving the estimate
- More strips, each narrower, give a better estimate. Doubling the number of strips reduces the error to about a quarter.
- With measured data you are limited to the measurements you have.
Percentage error formula: $\left|\frac{\text{approximate} - \text{exact}}{\text{exact}}\right| \times 100\%$.
Setting out for full marks
- State $h$ and list the $y$-values.
- Write the formula with the numbers substituted before evaluating.
- Give units: area units, or the context's units.
Common mistakes
- Counting values instead of strips: 6 values make 5 strips.
- Doubling the first and last values.
- Using unequal strip widths in the formula. The rule needs equal widths.
- Using $x$-values in place of $y$-values.
Check yourself
With strip width h = 1, the y-values are 3, 5 and 4. What does the trapezoidal rule give?
Show the answer
8.5
(1 ÷ 2) × [3 + 4 + 2 × 5] = 0.5 × 17 = 8.5.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera