P2 8.3 - The trapezium rule

P2 8.3 - The trapezium rule

Approximate an integral using equally spaced values from a function or a table. Understand the trapezium weights, use curve shape to identify overestimates and underestimates, and judge how refinement affects accuracy and what an error estimate can establish.

Equal intervals and endpoint weights

How can you estimate an integral when you have only a table of heights, or cannot integrate the function with the methods you know? Join consecutive plotted points with straight lines, and calculate the resulting trapezia instead of the curved strips.

For one strip of width hh, the two parallel sides are the endpoint heights y0y_0 and y1y_1. Its signed trapezium contribution is 12h(y0+y1)\frac12h(y_0+y_1). Adding adjacent strips counts an interior height twice, once in each neighbouring strip; the two outer heights appear once each.

Trapezium rule

For nn equal strips from aa to bb, with n+1n+1 ordinates y0,…,yny_0,\ldots,y_n,

∫aby dx≈Tn=h2[y0+yn+2(y1+⋯+yn−1)],h=b−an.\int_a^b y\,\mathrm{d}x\approx T_n=\frac h2\bigl[y_0+y_n+2(y_1+\cdots+y_{n-1})\bigr], \qquad h=\frac{b-a}{n}.

An ordinate here is a sampled yy-value. The formula assumes equally spaced xx-values, not equally spaced heights.

In the formula booklet.

For positive heights, this gives the geometric area of the trapezia. With negative heights, it estimates the signed integral; it does not automatically give total area between curve and axis. That requires splitting at crossings and using positive piece areas.

Worked example 1: why an interior height is doubled

Question. Use the table to estimate ∫02y dx\int_0^2 y\,\mathrm{d}x by the trapezium rule.

xx001122
yy223366

Plan. There are two strips of width 11; add their individual trapezia.

T2=12(1)(2+3)+12(1)(3+6)=12[2+2(3)+6]=7\begin{aligned} T_2&=\frac12(1)(2+3)+\frac12(1)(3+6)\\ &=\frac12\bigl[2+2(3)+6\bigr]=7 \end{aligned}

Answer. The integral is approximately 77.

Check. The separate trapezia have areas 2.52.5 and 4.54.5, whose sum is 77. The height 33 belongs to both strips.

Change only the spacing of the xx-values. Keeping the same heights does not keep the same area.

Worked example 2: halve the strip width

Question. Estimate ∫01y dx\int_0^1 y\,\mathrm{d}x from this table using the trapezium rule.

xx000.50.511
yy223366

Plan. Use two strips of width 0.50.5, with the same endpoint weights as before.

T2=0.52[2+6+2(3)]=3.5.T_2=\frac{0.5}{2}\bigl[2+6+2(3)\bigr]=3.5.

Answer. The integral is approximately 3.53.5.

Check. The interval is half as wide as in Worked example 1 and all heights match, so each trapezium and their total area must halve: 7/2=3.57/2=3.5.

If the xx-gaps are unequal, a single common hh cannot be used in this formula. You can instead add individual trapezia with their actual widths. A table alone does not tell you how the true curve bends between the points.

Watch out

Five ordinates make four strips. Use the number of gaps in h=(b−a)/nh=(b-a)/n, and put the entire weighted height sum inside the bracket multiplied by h/2h/2.

Use the widths in a fresh table.

Approximating an integral from a function or table

When a function is given, first calculate its values at the equally spaced inputs; when a table is supplied, use its values and spacing directly.

For nn strips, the input list is a,a+h,…,ba,a+h,\ldots,b. Keep working precision in calculated heights and round the final estimate as requested. A supplied rounded table limits the accuracy available; carry its entries as given rather than silently replacing them with other values.

Worked example 3: calculate the ordinates

Question. Use four strips to estimate I=∫0211+x dxI=\int_0^2\frac{1}{1+x}\,\mathrm{d}x.

Plan. Use h=2/4=0.5h=2/4=0.5, calculate five heights, then apply the weights.

xx001/21/2113/23/222
1/(1+x)1/(1+x)112/32/31/21/22/52/51/31/3
T4=14[1+13+2(23+12+25)]=14[43+4715]=6760\begin{aligned} T_4&=\frac14\left[1+\frac13+2\left(\frac23+\frac12+\frac25\right)\right]\\ &=\frac14\left[\frac43+\frac{47}{15}\right]=\frac{67}{60} \end{aligned}

Answer. I≈1.117I\approx1.117, to three decimal places. The exact fraction is the trapezium estimate, not the exact integral.

Check. The four individual trapezia have areas 5/125/12, 7/247/24, 9/409/40 and 11/6011/60. Their sum is 67/6067/60, confirming the endpoint-weight calculation.

Change only the vertical scale: multiply the same function by 33. Every strip height, and hence every trapezium contribution, triples.

Worked example 4: reuse an estimate after scaling

Question. Using the table and result in Worked example 3, estimate ∫0231+x dx\int_0^2\frac{3}{1+x}\,\mathrm{d}x with the same four strips.

Plan. Multiply the unrounded trapezium estimate by 33; there is no need to recalculate the table.

∫0231+x dx≈3(6760)=6720=3.35.\int_0^2\frac{3}{1+x}\,\mathrm{d}x \approx3\left(\frac{67}{60}\right)=\frac{67}{20}=3.35.

Answer. Approximately 3.3503.350, to three decimal places.

Check. Direct substitution of the scaled heights gives

14[3+1+2(2+32+65)]=6720.\frac14\left[3+1+2\left(2+\frac32+\frac65\right)\right] =\frac{67}{20}.

Adding a constant cc to every height adds a rectangle of area c(b−a)c(b-a). More generally, on the same interval and strip division, an estimate for ∫(ky+c) dx\int(ky+c)\,\mathrm{d}x is kTn+c(b−a)kT_n+c(b-a). You may also combine an approximate integral with a separate term that you can integrate exactly. Follow an instruction to use an earlier result by showing that connection.

Watch out

∫02(2y+1) dx\int_0^2(2y+1)\,\mathrm{d}x is estimated by 2Tn+22T_n+2, not 2Tn+12T_n+1: the constant contributes its height times the interval's width.

Use all the supplied table entries before transforming the estimate.

Interpreting error from curve shape

The trapezium rule replaces curved edges by chords, so the position of those chords tells you the direction of the error.

If the graph bends upwards throughout an interval, each chord lies above the curve and the trapezium rule overestimates the signed integral. If it bends downwards, the chords lie below and the estimate is too small. The sign of the second derivative can establish this: positive means upward bending, negative means downward bending. This uses the derivative of the gradient that you already know.

Whether the function is increasing or decreasing is a different question. An increasing curve can bend either way. If the bending changes within the interval, different strip errors can have opposite signs, so a single global conclusion needs further justification. Do not infer the bending between samples from an unexplained table alone.

Signed and absolute error

For estimate TT and exact integral II, the signed error is T−IT-I. A positive signed error is an overestimate. The absolute error is ∣T−I∣|T-I|, the nonnegative size of the difference.

Use a curve whose exact integral is available to measure the error as well as predict its sign.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account