Trapezoid Rule for Integrals - Examples with Answers

The trapezoid rule is a method of approximating the definite integral of a function. It is based on the idea of approximating the area under a curve by a series of trapezoids instead of rectangles, which gives a more accurate estimate.

In this article, we will look at a summary of how to use the trapezoid rule to calculate integrals. In addition, we will solve several practice problems to apply this concept.

CALCULUS
Trapezoid rule for integrals Example 5 graph

Relevant for...

Learning about the trapezoid rule of integrals with examples.

See examples

CALCULUS
Trapezoid rule for integrals Example 5 graph

Relevant for...

Learning about the trapezoid rule of integrals with examples.

See examples

How to use the trapezoid rule to solve integrals

To use the trapezoid rule to solve definite integrals, you can follow these steps:

Step 1: Divide the integration interval [a, b] into $latex n$ subintervals of equal width $latex h = \frac{b - a}{n}$.

Step 2: Evaluate the function $latex f(x)$ at the extreme points of each subinterval, i.e., at $latex x = a,$ $latex a + h$, $latex a + 2h$, …, $latex a + (n-1)h$, and $latex b$.

Step 3: Calculate the height of each trapezoid by taking the average of the function values at the extremes of the subinterval, i.e, $latex \frac{f(a) + f(a+h)}{2}$, $latex \frac{f(a+h) + f(a+2h)}{2}$, …, $latex \frac{f(a+(n-1)h) + f(b)}{2}$.

Step 4: Calculate the area of each trapezoid by multiplying the height by the width, that is, $latex \frac{f(a) + f(a+h)}{2} \times h$, $latex \frac{f(a+h) + f(a+2h)}{2} \times h$, …, $latex \frac{f(a+(n-1)h) + f(b)}{2} \times h$.

Step 5: Add the areas of all the trapezoids to obtain the approximation of the definite integral of the function $latex f(x)$ over the interval [a, b].

Alternatively, we can use the following formula:

$$I_a = \frac{\Delta x}{2} ( f(x_0)+2[ f(x_1)+f(x_2)+f(x_3)+f(x_4) ]+f(x_5)$$

The smaller the value of $latex n$, the less accurate the approximation, but using a larger value of $latex n$ will require a longer process.

Therefore, it is important to find a balance between accuracy and efficiency when using the trapezoidal rule for integration.

Trapezoid rule for approximating integrals - Examples with answers

EXAMPLE 1

Find the approximate value, using the trapezium rule, of the following definite integral:

$$ I= \int_{-2}^{2} \exp (-x^{2}) dx $$

Solution

EXAMPLE 2

Use the trapezoid rule to find an approximate value of the following definite integral:

$$I=\int_{0}^{2} \sqrt{x} dx $$

(note: use 5 subintervals)

Solution

EXAMPLE 3

Let f(x) be the function shown in the figure. Find a formula that gives, approximately, the definite integral of this function in the interval [a, b], taking into account that the sum of the area of the trapezoids represented there is numerically close to the value of the area under the curve of the function.

Trapezoid rule for integrals Example 3 graph
Solution

EXAMPLE 4

The figure below shows the graph of the function $latex f(x)= \frac{1}{1+x^2}$. Find, with the data in the figure, the approximate value of the definite integral:

$$ \int_0^3 \frac{1}{1+x^2} dx $$

Compare the result obtained with that of the exact value and estimate the percentage error of the approximation.

Trapezoid rule for integrals Example 4 graph
Solution

EXAMPLE 5

Find an approximate solution to the integral:

$$ \int_0^{\pi /2} cos^3(x) dx $$

applying the trapezoid rule and taking four subdivisions, i.e. n=4.

Trapezoid rule for integrals Example 5 graph
Solution

EXAMPLE 6

Find the value of the indicated integral

$$ \int_0^{\pi /4} sec(x) dx $$

using the trapezoid rule and taking three subdivisions, i.e. n=3.

Solution

EXAMPLE 7

By means of the sum of the areas of trapezoids, find an approximate value of the indicated integral

$$ \int_{-4}^{+4} \frac{4}{2+x^4} dx $$

Use nine subdivisions (n=9). Present the operations in a table.

Solution

EXAMPLE 8

Apply the trapezoid rule to find a quadrature (definite integral) of the following function, in the interval [-4, 4]:

$$ f(x) = \frac{2}{\sqrt{1+x^2}} $$.

Note: Use n=8 and show the results of the operations in a table.

Solution

EXAMPLE 9

Using the trapezoid rule find an approximation to the definite integral of the following function, in the interval [-4, 4]:

Trapezoid rule for integrals Example 9 graph

Note: Use n=8 and show the results of the operations in a table.

Solution

EXAMPLE 10

Find the definite integral between -4 and 4, by sum of trapezoids approximation for the function shown. Incidentally, this is the function that describes a rope or chain hanging between two fixed points, which is why it is known as a catenary.

Trapezoid rule for integrals Example 10 graph

Note: Use n=8 and show the results of the operations in a table.

Solution

Trapezoid rule - Practice problems

Trapezoid rule quiz
Logo
You have completed the quiz!

Use the trapezoid rule with 4 subintervals or trapezoids to find an approximate value for:$$\int_{1}^{9}\sqrt{\ln(x)}dx$$

Write the answer to two decimal places.

$latex I_{a}=$

Compare trapezoids with left, right and midpoint rectangles in the interactive Riemann sums explorer: Riemann Sums: Area Under a Curve with Rectangles (Interactive Practice).

See also

Interested in learning more about numerical methods? You can take a look at these pages:

Learn mathematics with our additional resources in different topics

LEARN MORE