πŸ“ The Trapezium Rule

A Level Maths Year 2 Β· Numerical Methods

Level 3 · Ages 17–18

← Back to topic overview
1 Areas You Cannot Integrate

Many functions β€” $\sqrt{1 + x^3}$, $\mathrm{e}^{x^2}$, $\dfrac{\sin x}{x}$ β€” cannot be integrated using the standard techniques. And in practical work you often have only a table of measured values, not a formula at all. The trapezium rule estimates $\displaystyle\int_a^b y\,\mathrm{d}x$ in either situation.

Split the range $a \leqslant x \leqslant b$ into $n$ vertical strips of equal width $h$. Join the tops of neighbouring ordinates (the $y$-values) with straight lines. Each strip becomes a trapezium, and the area of a trapezium is easy: $\tfrac12 h\,(y_{\text{left}} + y_{\text{right}})$.
x y 1 1.5 2 2.5 3 0.5 1 y = ln x curve above the chords β†’ underestimate

Adding the $n$ trapezia, every inner ordinate is used twice (once by the strip on each side) and the two end ordinates once:

The trapezium rule
$\displaystyle\int_a^b y\,\mathrm{d}x \approx \frac{h}{2}\Big[\,y_0 + y_n + 2\left(y_1 + y_2 + \cdots + y_{n-1}\right)\Big]$,   $h = \dfrac{b - a}{n}$
Strips versus ordinates. $n$ strips need $n + 1$ ordinates. "Use $5$ ordinates" means $4$ strips. Misreading this is the most common way to lose every mark.
The formula is in the exam formula booklet, but you must know how to use it: a table of values laid out neatly earns method marks even if you slip on the arithmetic.
2 Using the Rule
  1. Find the strip width $h = \dfrac{b - a}{n}$.
  2. Make a table of $x$-values $a, a + h, \ldots, b$ and the corresponding $y$-values (to at least $4$ or $5$ decimal places).
  3. Substitute into the formula: ends once, middles twice, multiply by $\frac{h}{2}$.
  4. Round the final answer only, to the accuracy asked for.
Worked Example 1 β€” Four strips

Use the trapezium rule with $4$ strips to estimate $\displaystyle\int_1^3 \ln x\,\mathrm{d}x$, giving your answer to $3$ significant figures.

β‘ $h = \dfrac{3 - 1}{4} = 0.5$.
$x$$1$$1.5$$2$$2.5$$3$
$y = \ln x$$0$$0.40547$$0.69315$$0.91629$$1.09861$
β‘‘Ends: $0 + 1.09861 = 1.09861$.  Middles: $0.40547 + 0.69315 + 0.91629 = 2.01491$.
β‘’$\dfrac{0.5}{2}\left[1.09861 + 2(2.01491)\right] = 0.25 \times 5.12843 = 1.28211$
β‘£Estimate $\approx 1.28$ (3 s.f.).
Worked Example 2 β€” A function you cannot integrate

Estimate $\displaystyle\int_0^2 \sqrt{1 + x^3}\,\mathrm{d}x$ using $5$ ordinates.

β‘ $5$ ordinates means $4$ strips, so $h = 0.5$.
$x$$0$$0.5$$1$$1.5$$2$
$y$$1$$1.06066$$1.41421$$2.09165$$3$
β‘‘$\dfrac{0.5}{2}\Big[1 + 3 + 2(1.06066 + 1.41421 + 2.09165)\Big] = 0.25 \times 13.13304$
β‘’$\approx 3.283$ (4 s.f.).
Worked Example 3 β€” Estimating $\pi$

Given that $\displaystyle\int_0^1 \frac{1}{1 + x^2}\,\mathrm{d}x = \frac{\pi}{4}$, use the trapezium rule with $4$ strips to estimate $\pi$.

$x$$0$$0.25$$0.5$$0.75$$1$
$y$$1$$0.94118$$0.8$$0.64$$0.5$
β‘ $\dfrac{0.25}{2}\Big[1 + 0.5 + 2(0.94118 + 0.8 + 0.64)\Big] = 0.125 \times 6.26235 = 0.78279$
β‘‘$\pi \approx 4 \times 0.78279 = 3.131$ β€” within $0.4\%$ of the true value.
3 Overestimate or Underestimate?

The tops of the trapezia are chords of the curve. Whether a chord lies above or below the curve depends on the curve's concavity β€” see Concavity and Points of Inflection.

Shape of curve for $a \leqslant x \leqslant b$Second derivativeChords lie…Trapezium rule gives
Convex (bends upwards, βˆͺ)$\mathrm{f}''(x) > 0$above the curvean overestimate
Concave (bends downwards, ∩)$\mathrm{f}''(x) < 0$below the curvean underestimate
Worked Example 4 β€” An overestimate

Use $4$ strips to estimate $\displaystyle\int_0^2 \mathrm{e}^x\,\mathrm{d}x$. Explain why it is an overestimate, and find the percentage error.

β‘ $h = 0.5$; ordinates $1,\ 1.64872,\ 2.71828,\ 4.48169,\ 7.38906$.
β‘‘$0.25\Big[1 + 7.38906 + 2(1.64872 + 2.71828 + 4.48169)\Big] = 0.25 \times 26.08644 = 6.52161$
β‘’$\dfrac{\mathrm{d}^2}{\mathrm{d}x^2}\mathrm{e}^x = \mathrm{e}^x > 0$, so the curve is convex: the chords lie above it, giving an overestimate.
β‘£Exact value $\mathrm{e}^2 - 1 = 6.38906$. Percentage error $= \dfrac{6.52161 - 6.38906}{6.38906} \times 100 = 2.07\%$.
Worked Example 5 β€” An underestimate

Explain whether the estimate in Worked Example 1 is too big or too small, and compare it with the exact value $3\ln 3 - 2$.

β‘ $y = \ln x$ gives $y'' = -\dfrac{1}{x^2} < 0$: concave for $1 \leqslant x \leqslant 3$.
β‘‘The chords lie below the curve (as in the diagram), so $1.28211$ is an underestimate.
β‘’Exact: $3\ln 3 - 2 = 1.29584$. Error $= 1.06\%$ too small. βœ“
If the curve changes concavity between $a$ and $b$ (it has a point of inflection there), you cannot say in general whether the estimate is too big or too small.
4 Improving the Estimate

Narrower strips follow the curve more closely, so the estimate improves as $n$ increases. In the limit $n \to \infty$ the trapezium sum becomes the integral β€” the idea behind integration as the limit of a sum.

Worked Example 6 β€” Doubling the strips

Compare the trapezium rule estimates of $\displaystyle\int_1^3 \ln x\,\mathrm{d}x$ with $2$, $4$ and $8$ strips.

Strips $n$$h$EstimateError (exact $1.29584$)
$2$$1$$1.24245$$-4.12\%$
$4$$0.5$$1.28211$$-1.06\%$
$8$$0.25$$1.29238$$-0.267\%$
β‘ Every estimate is too small β€” the curve is concave throughout.
β‘‘Each time the number of strips doubles, the error falls to roughly a quarter. Halving $h$ divides the error by about $4$.
In an exam, "How could the estimate be improved?" has a one-line answer: use more strips (narrower strips). Do not say "use more decimal places".
5 The Trapezium Rule in Context

The area under a velocity–time graph is distance; the area under a rate graph is a total. When the data come from measurements, the trapezium rule is often the only option.

Worked Example 7 β€” Distance from a table of speeds

A cyclist's speed $v$ m s$^{-1}$ is recorded every $5$ seconds:

$t$ (s)$0$$5$$10$$15$$20$$25$$30$
$v$ (m s$^{-1}$)$0$$4.2$$7.1$$8.9$$9.6$$9.8$$10.0$

Estimate the distance travelled in the $30$ seconds, and comment on the estimate.

β‘ Distance $= \displaystyle\int_0^{30} v\,\mathrm{d}t$, with $6$ strips and $h = 5$.
β‘‘$\dfrac{5}{2}\Big[0 + 10.0 + 2(4.2 + 7.1 + 8.9 + 9.6 + 9.8)\Big] = 2.5 \times 89.2 = 223$ m.
β‘’The speed increases at a decreasing rate, so the graph is concave: the estimate is probably an underestimate. We also do not know how the speed varies between readings.
6 Quick Reference

Formula

$\frac{h}{2}\big[y_0 + y_n + 2(y_1 + \cdots + y_{n-1})\big]$

Strip width

$h = \dfrac{b - a}{n}$

Ordinates

$n$ strips $\leftrightarrow$ $n + 1$ ordinates.

Convex

$\mathrm{f}'' > 0$: overestimate.

Concave

$\mathrm{f}'' < 0$: underestimate.

Improve

More, narrower strips. Halving $h$ cuts the error to about a quarter.

Percentage error

$\dfrac{\text{estimate} - \text{exact}}{\text{exact}} \times 100\%$

Context

Area under $v$–$t$ is distance; under a rate graph is a total.

7 Practice Questions
Question 1

Use the trapezium rule with $4$ strips to estimate $\displaystyle\int_0^2 x^2\,\mathrm{d}x$. Compare with the exact value.

β–Ά Show solution

$h = 0.5$; ordinates $0,\ 0.25,\ 1,\ 2.25,\ 4$.

$0.25\big[0 + 4 + 2(0.25 + 1 + 2.25)\big] = 0.25 \times 11 = 2.75$.

Exact: $\left[\tfrac{x^3}{3}\right]_0^2 = \tfrac83 = 2.667$. The estimate is too big, as expected for the convex curve $y = x^2$.

Question 2

Use $4$ strips to estimate $\displaystyle\int_1^2 \frac{1}{x}\,\mathrm{d}x$ to $4$ d.p. Hence give an estimate of $\ln 2$ and state whether it is too large or too small.

β–Ά Show solution

$h = 0.25$; ordinates $1,\ 0.8,\ 0.66667,\ 0.57143,\ 0.5$.

$0.125\big[1 + 0.5 + 2(0.8 + 0.66667 + 0.57143)\big] = 0.125 \times 5.57619 = 0.6970$.

$\displaystyle\int_1^2 \frac1x\,\mathrm{d}x = \ln 2$, so $\ln 2 \approx 0.6970$. Since $\dfrac{\mathrm{d}^2}{\mathrm{d}x^2}\left(\dfrac1x\right) = \dfrac{2}{x^3} > 0$, the curve is convex, so this is too large ($\ln 2 = 0.6931$).

Question 3

Estimate $\displaystyle\int_0^1 \mathrm{e}^{x^2}\,\mathrm{d}x$ using the trapezium rule with $5$ ordinates, to $3$ d.p.

β–Ά Show solution

$5$ ordinates $\Rightarrow 4$ strips, $h = 0.25$.

$x$$0$$0.25$$0.5$$0.75$$1$
$y$$1$$1.06449$$1.28403$$1.75505$$2.71828$

$0.125\big[1 + 2.71828 + 2(1.06449 + 1.28403 + 1.75505)\big] = 0.125 \times 11.92542 = 1.491$.

Question 4

Use $4$ strips to estimate $\displaystyle\int_0^2 \sqrt{1 + x^2}\,\mathrm{d}x$. Given that $\mathrm{f}''(x) = (1 + x^2)^{-3/2}$, state whether your answer is an over- or underestimate.

β–Ά Show solution

$h = 0.5$; ordinates $1,\ 1.11803,\ 1.41421,\ 1.80278,\ 2.23607$.

$0.25\big[1 + 2.23607 + 2(1.11803 + 1.41421 + 1.80278)\big] = 0.25 \times 11.90611 = 2.977$ (3 d.p.).

$\mathrm{f}''(x) > 0$ for all $x$, so the curve is convex and this is an overestimate. (The true value is $2.958$.)

Question 5

Use the trapezium rule with $3$ strips to estimate $\displaystyle\int_1^4 \sqrt{x}\,\mathrm{d}x$. Find the exact value and the percentage error.

β–Ά Show solution

$h = 1$; ordinates $1,\ \sqrt2,\ \sqrt3,\ 2$.

$\tfrac12\big[1 + 2 + 2(1.41421 + 1.73205)\big] = \tfrac12 \times 9.29253 = 4.64626$.

Exact: $\left[\tfrac23 x^{3/2}\right]_1^4 = \tfrac23(8 - 1) = \tfrac{14}{3} = 4.66667$.

Percentage error $= \dfrac{4.64626 - 4.66667}{4.66667} \times 100 = -0.437\%$ β€” an underestimate, as $\sqrt x$ is concave.

Question 6

Use $4$ strips to estimate $\displaystyle\int_0^{\pi} \sin x\,\mathrm{d}x$, giving your answer to $4$ d.p. Explain why the estimate is less than the exact value $2$.

β–Ά Show solution

$h = \dfrac{\pi}{4}$; ordinates $0,\ \tfrac{\sqrt2}{2},\ 1,\ \tfrac{\sqrt2}{2},\ 0$.

$\dfrac{\pi}{8}\big[0 + 0 + 2(0.70711 + 1 + 0.70711)\big] = \dfrac{\pi}{8} \times 4.82843 = 1.8961$.

For $0 \leqslant x \leqslant \pi$, $\dfrac{\mathrm{d}^2}{\mathrm{d}x^2}\sin x = -\sin x \leqslant 0$, so the curve is concave and the chords lie below it.

Question 7

The trapezium rule estimates of $\displaystyle\int_1^3 \ln x\,\mathrm{d}x$ with $2$ and $4$ strips are $1.24245$ and $1.28211$. Without further calculation, predict roughly how far the $8$-strip estimate will be from the exact value $1.29584$, and explain your reasoning.

β–Ά Show solution

The errors are $1.29584 - 1.24245 = 0.0534$ and $1.29584 - 1.28211 = 0.0137$. Doubling the strips cut the error to about a quarter ($0.0534 \div 4 \approx 0.013$).

So with $8$ strips expect an error of about $0.0137 \div 4 \approx 0.0034$, i.e. an estimate near $1.2924$. (The actual value is $1.29238$.)

Question 8

A river is $12$ m wide. Its depth $d$ m is measured every $2$ m across:

Distance (m)$0$$2$$4$$6$$8$$10$$12$
Depth (m)$0$$1.1$$1.9$$2.4$$2.2$$1.3$$0$

Estimate the cross-sectional area. Water flows at $0.5$ m s$^{-1}$; estimate the volume of water passing per second.

β–Ά Show solution

$6$ strips, $h = 2$: $\;\dfrac{2}{2}\big[0 + 0 + 2(1.1 + 1.9 + 2.4 + 2.2 + 1.3)\big] = 1 \times 17.8 = 17.8$ m$^2$.

Volume per second $\approx 17.8 \times 0.5 = 8.9$ m$^3$ s$^{-1}$.

(A river bed is roughly concave, so this is likely to be a slight underestimate; it also assumes the flow speed is the same everywhere.)

Question 9

The quarter circle $y = \sqrt{1 - x^2}$, $0 \leqslant x \leqslant 1$, has area $\dfrac{\pi}{4}$. Use $4$ strips to estimate $\pi$, and explain why the estimate is poor.

β–Ά Show solution

$h = 0.25$; ordinates $1,\ 0.96825,\ 0.86603,\ 0.66144,\ 0$.

$0.125\big[1 + 0 + 2(0.96825 + 0.86603 + 0.66144)\big] = 0.125 \times 5.99143 = 0.74893$.

$\pi \approx 4 \times 0.74893 = 2.996$ β€” an error of about $4.6\%$.

The circle is concave, so it is an underestimate. It is poor because the curve becomes vertical as $x \to 1$: the last strip's chord cuts off a large sliver of area. (Compare Worked Example 3, where the same number of strips gave $\pi$ to within $0.4\%$.)

Question 10

The region $R$ is bounded by $y = x\ln x$, the $x$-axis and the line $x = 3$.

(a) Use the trapezium rule with $4$ strips to estimate the area of $R$, to $4$ d.p.
(b) Show that $\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} > 0$ for $x > 0$ and hence say whether your estimate is too big or too small.
(c) Use integration by parts to show that the exact area is $\tfrac92\ln 3 - 2$.
(d) Find the percentage error in (a).

β–Ά Show solution

The curve meets the $x$-axis at $x = 1$ (as $\ln 1 = 0$) and is positive for $x > 1$, so $R$ runs from $x = 1$ to $x = 3$.

(a) $h = 0.5$:

$x$$1$$1.5$$2$$2.5$$3$
$y$$0$$0.60820$$1.38629$$2.29073$$3.29584$

$0.25\big[0 + 3.29584 + 2(0.60820 + 1.38629 + 2.29073)\big] = 0.25 \times 11.86628 = 2.9666$.

(b) $y' = \ln x + 1$, $y'' = \dfrac1x > 0$ for $x > 0$. Convex, so the estimate is too big.

(c) With $u = \ln x$, $\dfrac{\mathrm{d}v}{\mathrm{d}x} = x$: $\displaystyle\int x\ln x\,\mathrm{d}x = \frac{x^2}{2}\ln x - \int \frac{x}{2}\,\mathrm{d}x = \frac{x^2}{2}\ln x - \frac{x^2}{4}$.

$\left[\dfrac{x^2}{2}\ln x - \dfrac{x^2}{4}\right]_1^3 = \left(\dfrac92\ln 3 - \dfrac94\right) - \left(0 - \dfrac14\right) = \dfrac92\ln 3 - 2 = 2.94376$. (See Integration by Parts.)

(d) $\dfrac{2.96657 - 2.94376}{2.94376} \times 100 = 0.775\%$ (too big, as predicted).

The Trapezium Rule · A Level Maths Year 2 · Created with MathJax