Trapezium rule – approximating integrals

trapezium ruleThroughout this page we use methods such as the trapezium rule to approximate the area beneath a curve. This serves as an alternative to definite integrals and we will see below that the approximations can be overestimates or underestimates. Recall that the expression \int_a^b f(x)dx finds the area between the curve of f(x), the x-axis and the limits x=a and x=b (see definite integrals). Up until now, we found integrals using integration, that is, we find the area analytically (using algebra etc). However, if we cannot integrate f(x) like this we must adopt a numerical method. For example, we could fit rectangles over the area and sum their individual areas.

Approximating Integrals

approximating integralsIn this diagram, we use 4 rectangles. Each of these rectangles has a width of \Delta x (meaning change in x) which we can find from \frac{b-a}{4} when the full width is b-a and there are 4 rectangles spanning it. The height of each rectangle is dependent on the y-coordinate of the point on the curve which is at the centre of the top of each rectangle. Hence, the area of the ith triangle is f(x_i)\delta x. It follows that we can approximate the area in this diagram as \sum_{i=1}^4 f(x_i)\Delta x (see sigma notation). The more rectangles we use the better the approximation to the integral. In general, if the number of rectangles we use is n then:

\int_a^b f(x)dx=\sum_{i=1}^nf(x_i)\Delta x

In which case, \Delta x=\frac{b-a}{n} and can be thought of the discrete version of dx. Similarly, we can think of dx as the continuous infinitesimal version of \Delta x and \int as the continuous infinitesimal version of \sum. So, for large finite n, we can say \int_a^bf(x)dx\approx \sum_{i=1}^n f(x_i)\Delta x. However, if we take n\rightarrow\infty, then we can say:

\int_a^b f(x) dx=\lim_{n\rightarrow\infty} \sum_{i=1}^n f(x_i)\Delta x where \Delta x=\frac{b-a}{n}.

Trapezium Rule

trapezium ruleIn this diagram, instead of fitting 4 rectangles, we use 4 trapezia to approximate the area. In general, this is a more accurate approximation to the area. Conventionally, we use h=\frac{b-a}{4} (instead of \Delta x) to describe the width of each trapezium. We also use y-coordinates to describe heights instead of the function notation. Notice that we require 5 points instead of 4 since we need the lengths of the parallel sides when computing the area of a trapezium. The area of each trapezium is ‘half the sum of the parallel sides multiplied by the distance between them‘. Hence, the area of the second trapezium here, for example, is \frac{(y_1+y_2)h}{2}. It follows that we can approximate the full area with the trapezium rule as:

\int_a^b y \,dx\approx \frac{(y_0+y_1)h}{2}+\frac{(y_1+y_2)h}{2}+\frac{(y_2+y_3)h}{2}+\frac{(y_3+y_4)h}{2}=\frac{h}{2}\left\lbrace y_0+2\left(y_1+y_2+y_3\right)+y_4\right\rbrace

where h=\frac{b-a}{4}. Note that,  in general, the trapezium rule for n trapezia is given by 

\int_a^b y \,dx\approx \frac{(y_0+y_1)h}{2}+\frac{(y_1+y_2)h}{2}+...+\frac{(y_{n-1}+y_n)h}{2}=\frac{1}{2}h\left\lbrace y_0+y_n+2\left(y_1+y_2+...+y_{n-1}\right)\right\rbrace

where h=\frac{b-a}{n}. This formula is given in the Edexcel Formula Booklet. See Examples 1 and 2 for a demonstration of the trapezium rule in use.

Overestimate or Underestimate?

trapezium ruleThe trapezium rule will only ever give the exact area if the graph has the same shape as the trapezia. In general, the trapezium rule will give an overestimate or an overestimate. Which one of these it is will depend on the shape of the curve.  trapezium ruleRecall the difference between a concave and a convex function. The trapezium rule applied to parts of the graph where it is concave will give an underestimate. Conversely, the trapezium rule applied to parts of the graph where it is convex will give an overestimate.

It is harder to tell what kind of estimate we get using rectangles instead. This is because, the rectangle don’t tend to follow the line of the graph as closely as the trapezia do.

Examples

The following shows the graph of the function f(x)=2-\cos^2(x) and the dashed line x=1:

trapezium rule

1. Complete the following table of values, giving 3 decimal places where appropriate:

x00.20.40.60.81
f(x)12.416

2. Using the trapezium rule with 5 trapezia, estimate the area bounded by the curve, the x-axis, the y-axis and the line x=1.

3. Is the estimate an overestimate or an underestimate? Explain why increasing the number of trapezia improves the approximation.

Solution:

1.

x00.20.40.60.81
f(x)11.0031.0511.2481.7132.416

2. For 5 trapezia, the formula is: \frac{1}{2}h\left\lbrace y_0+y_5+2\left(y_1+y_2+y_3+y_4\right)\right\rbrace. Setting the trapezium width h=0.2 and using the y-values from the table above we have: 0.1(1+2.416+2(1.003+1.051+1.248+1.713)). Hence, the area is approximately 1.3446 square units.

3. On this interval, the curve is mostly convex and so the estimate is likely to be an overestimate. Increasing the number of trapezia will improve the estimate as the closer you zoom, the more the curve begins to look like a straight line. In this case, the top of each trapezium will match more closely to the curve.

The following shows the graph of y=5\sqrt{x}+3 and the dashed line x=1:

trapezium rule
  1. Use the trapezium rule with 5 trapezia to approximate the area between the curve, the x-axis, the y-axis and the line x=1. Is this approximation an overestimate or an underestimate?
  2. Use integration to find the exact area.
  3. What is the percentage error in the approximation?

Solution:

1. We can organise the x and y values in a table:

x00.20.40.60.81
f(x)35.2366.1626.8737.4748

For 5 trapezia, the formula is: \frac{1}{2}h\left\lbrace y_0+y_5+2\left(y_1+y_2+y_3+y_4\right)\right\rbrace. Setting the trapezium width h=0.2 and using the y-values from the table above we have: 0.1(3+8+2(5.236+6.162+6.873+7.472)). Hence, the area is approximately 6.2486 square units. The curve is concave and so this will be an underestimate.

2. We can find the exact area by integrating:

\begin{array}{lll}\int_0^1\left(5\sqrt{x}+3\right)dx&=&\int_0^1\left(5x^{\frac{1}{2}}+3\right)dx\\&=&\left[\frac{5}{\frac{3}{2}}x^{\frac{3}{2}+}3x\right]_0^1\\&=&\left[\frac{10}{3}x^{\frac{3}{2}}+3x\right]_0^1\\&=&\left(\frac{10}{3}(1)^{\frac{3}{2}}+3(1)\right)-\left(\frac{10}{3}(0)^{\frac{3}{2}}+3(0)\right)\\&=&\frac{19}{3}\end{array}

See more on definite integrals. Note that \frac{19}{3}=6.3333… and so the approximation from part 1 is a good estimate.

3. The percentage error is given by \frac{6.2486-\frac{19}{3}}{\frac{19}{3}}\times 100=-1.34\% to 2 decimal places.