# The Trapezoidal Rule

You have likely already read our Forming Riemann Sums article, looking at how we can use them to estimate the area under the curve. As a refresher, a Riemann sum divides the area under the curve into rectangles and sums the area of each rectangle to approximate the area under the curve. But do we always have to use rectangles when approximating areas? Of course not!

#### Create learning materials about The Trapezoidal Rule with our free learning app!

• Flashcards, notes, mock-exams and more
• Everything you need to ace your exams

The Trapezoidal Rule is a form of Riemann's sum. However, the Trapezoidal Rule uses trapezoids rather than rectangles! Interestingly enough, using trapezoidal subregions to approximate the area is usually more exact than using rectangles. In this article, we'll explore the Trapezoidal Rule derivation, formula, and error. Finally, we'll apply the Trapezoidal Rule to some examples.

## The Trapezoidal Rule Definition and Formula for Area

Before we get into how this technique is used in practice, let's define what this rule is!

The Trapezoidal Rule is an integral approximation technique that divides the area under the curve into little trapezoids. The area of each trapezoid is summed to approximate the total area under the curve.

The Trapezoidal Rule estimates the area under the curve by dividing the region into trapezoidal subregions - StudySmarter Original

The area of a trapezoid is defined as

$\frac{1}{2}×\left(\mathrm{distance}\mathrm{between}\mathrm{each}\mathrm{base}\right)×\left(\mathrm{sum}\mathrm{of}\mathrm{the}\mathrm{length}\mathrm{of}\mathrm{each}\mathrm{base}\right)$

Translating this formula to the above figure, we can say that the area of the left-most trapezoid is defined as

$\frac{1}{2}×\left(∆x\right)×\left(f\left({x}_{0}\right)+f\left({x}_{1}\right)\right)=\frac{∆x}{2}×\left(f\left({x}_{0}\right)+f\left({x}_{1}\right)\right)$

Similarly, the formula for the area of the 2nd left-most trapezoid is defined as

$\frac{1}{2}×\left(∆x\right)×\left(f\left({x}_{1}\right)+f\left({x}_{2}\right)\right)=\frac{∆x}{2}×\left(f\left({x}_{1}\right)+f\left({x}_{2}\right)\right)$

The formula for the area of each trapezoid is formulated the same way. The Trapezoidal Rule states that we can estimate the area under the curve by summing the area of each of these trapezoids. The Trapezoidal Rule is derived by factoring out $\frac{∆x}{2}$ and adding up the length of each base, where $f\left({x}_{1}\right)$ through $f\left({x}_{n-1}\right)$ are multiplied by a factor of two because they are bases shared by other trapezoids.

Then, for approximating the definite integral of a function f(x), the Trapezoidal Rule states

${\int }_{a}^{b}f\left(x\right)dx\approx \frac{∆x}{2}\left[f\left({x}_{0}\right)+2f\left({x}_{1}\right)+2f\left({x}_{2}\right)+...+2f\left({x}_{n-1}\right)+f\left({x}_{n}\right)\right]\phantom{\rule{0ex}{0ex}}$

where n is the number of trapezoids, $∆x=\frac{b-a}{n}$, and ${x}_{i}=a+i∆x$.

As the number of trapezoidal subregions n approaches infinity, the right-hand side of the Trapezoidal Rule approaches the definite integral on the left side. In other words, the integral approximation gets more accurate as n gets larger.

## Over and Underestimating using the Trapezoidal Rule

Look at the graph under the Trapezoidal Rule definition again. Notice how some of the trapezoidal subregions stay under the graph while other subregions stick out over the graph. When the graph is "concave up" (the graph bends upwards), the subregions tend to overestimate the area under the curve.

When the graph is "concave down" (the graph bends downwards), the subregions tend to underestimate the area under the curve. Based on a function's concavity, we can use this observation to tell whether the Trapezoidal Rule will overestimate or underestimate the area under the curve.

Below is a graphical example illustrating the difference between an overestimate and an underestimate.

Notice how the trapezoids extend above the function when there is an overestimation and sit below the function when there is an underestimation - StudySmarter Originals

## The Trapezoidal Rule Error Bounds

As numerical integration techniques, like the Trapezoidal Rule, are an estimation, calculating the error of that estimation is incredibly important.

### Relative error

Using common sense, we compute the relative error of a Trapezoidal Rule computation (given as a percentage) by using the relative error formula:

$\begin{array}{rcl}Relativeerror& =& \frac{\left|approximation-actual\right|}{actual}×100%\\ & =& \frac{\left|{T}_{n}-{\int }_{a}^{b}f\left(x\right)dx\right|}{{\int }_{a}^{b}f\left(x\right)dx}×100%\end{array}$

where ${T}_{n}$ is the Trapezoidal Rule approximation of the integral and ${\int }_{a}^{b}f\left(x\right)dx$ is the actual area.

We cannot always compute the integral of any function exactly! It may even be too difficult to approximate certain definite integrals (more on this in our university articles...). You can also see the deep dive in our Approximating Areas article for a sneak peek!

### Absolute Error

In addition to relative error, the absolute error of our approximation using the trapezoidal rule can be calculated using the formula for absolute error:

$\begin{array}{rcl}Absoluteerror& =& \left|approximation-actual\right|\\ & =& \left|{T}_{n}-{\int }_{a}^{b}f\left(x\right)dx\right|\end{array}$

### Error Bounds for the Trapezoidal Rule

We can use an error bound formula to tell us the maximum possible area of our approximation. For the Trapezoidal Rule, the error bound formula is

$\left|{E}_{T}\right|\le \frac{K{\left(b-a\right)}^{3}}{12{n}^{2}}$ for $\left|f\text{'}\text{'}\left(x\right)\right|\le K$

where ${E}_{T}$ is the exact error for the Trapezoidal Rule and $f\text{'}\text{'}\left(x\right)$ is the second derivative of f(x). Essentially, K is the maximum value of the second derivative on the interval [a, b].

The uses of the error bound will make more sense once we work through some examples.

## Examples of Using the Trapezoidal Rule to Estimate the Integral

### Example 1

Consider the function $f\left(x\right)=\frac{1}{x}$ on the closed interval [1, 3]. Use the Trapezoidal Rule to estimate the ${\int }_{1}^{3}\frac{1}{x}dx$ using n = 4. Then, find n such that the error bound is 0.001 at most.

Let's graph f(x) to visualize the curve.

Example 1: Graph of 1/x - StudySmarter Original

#### Step 1: Find $∆x$

Plugging in our given interval and n subregions:

$∆x=\frac{3-1}{4}=\frac{1}{2}$

#### Step 2: Plug in known values to the Trapezoidal Rule Formula

From here, all we need to do is plug our known values into the Trapezoidal Rule formula. Since our interval is [1, 3] and the problem asks us to use n = 4, ${x}_{i}=1+i\left(\frac{1}{2}\right)$ meaning each trapezoid has a width of $\frac{1}{2}$ units.

#### Step 3: Consider if our estimate is an over or underestimate

Looking at the graph of f, we can see that on the interval [1, 3] the graph is concave up, so our estimate is likely an overestimate.

#### Step 4: Consider the maximum error bound

Let's use our error-bound formula to see exactly how much of an overestimate our approximation is.

In the error-bound formula ${E}_{T}$, our only unknown value is K. However, we can use the second derivative of f(x) to find K.

Since $f\left(x\right)=\frac{1}{x},f\text{'}\left(x\right)=\frac{-1}{{x}^{2}},f\text{'}\text{'}\left(x\right)=\frac{2}{{x}^{3}}$ using the Power Rule.

To find K, we have to consider where $\left|f\text{'}\text{'}\left(x\right)=\frac{2}{{x}^{3}}\right|$ will be the largest on the interval [1, 3]. We know that minimizing x will maximize f''(x). So $\left|f\text{'}\text{'}\left(x\right)\right|$ is largest when x = 1.

$f\text{'}\text{'}\left(1\right)=\frac{2}{{1}^{3}}=2=K$

Now that all the values of ${E}_{T}$ are known, we can simply plug in to find our bound.

$\left|{E}_{T}\right|\le \frac{2{\left(3-1\right)}^{3}}{12{\left(4\right)}^{2}}=\frac{16}{192}=0.083$

At most, the error of our estimation is 0.083.

#### Step 5: Find a minimum n such that the error is at most 0.001

To find the minimum n to ensure that the error is below 0.001, we let n be our unknown.

$\frac{16}{12{n}^{2}}\le 0.001\to \frac{4000}{3}\le {n}^{2}\to 36.5\le n$

So, to ensure that our error is at most 0.001, we must use at least 37 trapezoidal subregions.

### Example 2

Use the Trapezoidal Rule to approximate the area under the curve of f(x), which you should assume to be differentiable on [-3, 3], given in the table below with n = 6.

 x -3 -2 -1 0 1 2 3 f(x) 0 2 5 9 14 20 27

#### Step 1: Find $∆x$

Plugging in our given interval and n subregions:

$∆x=\frac{3-\left(-3\right)}{6}=1$

#### Step 2: Plug in known values to the Trapezoidal Rule

From here, all we need to do is plug our known values into the Trapezoidal Rule formula. Since our interval is [-3, 3] and the problem asks us to use n = 6, ${x}_{i}=1+i$ meaning each trapezoid has a width of 1 unit.

#### Step 3: Consider if our estimate is an over or underestimate

Though we don't have a graph of our function, close your eyes and try to visualize what this function might look like given the table of values. Given that all the values of the table are increasing over the domain and the rate at which the values are increasing is also increasing, we can assume that f(x) is concave up. Thus, we can make an informed guess that our approximation is likely an overestimate.

Without the function f(x), we cannot check the maximum error bound as we cannot take the 2nd derivative of a table of values.

## Trapezoidal Rule vs. Simpson's Rule

Estimating areas using trapezoids and rectangles use straight lines on top of the shape. When reading the article on Simpson's Rule, you'll discover that we replace the straight lines in the trapezoids and rectangles with a curve (more specifically, a parabolic curve). More on this in the Simpson's Rule article!

## The Trapezoidal Rule - Key takeaways

• The Trapezoidal Rule is an integral approximation technique that divides the area under the curve into little trapezoids and sums the area of each trapezoid together to approximate the total area under the curve
• For approximating the definite integral of a function f(x), the Trapezoidal Rule states${\int }_{a}^{b}f\left(x\right)dx\approx \frac{∆x}{2}\left[f\left({x}_{0}\right)+2f\left({x}_{1}\right)+2f\left({x}_{2}\right)+...+2f\left({x}_{n-1}\right)+f\left({x}_{n}\right)\right]\phantom{\rule{0ex}{0ex}}$

where n is the number of trapezoids, $∆x=\frac{b-a}{n}$, and ${x}_{i}=a+i∆x$

• When using the Trapezoidal Rule on a concave up function, the subregions tend to overestimate the area under the curve

• When using the Trapezoidal Rule on a concave down function, the subregions tend to underestimate the area under the curve

• We can use an error-bound formula to tell us the maximum possible error of our approximation

• For the Trapezoidal Rule, the error bound formula is

$\left|{E}_{T}\right|\le \frac{K{\left(b-a\right)}^{3}}{12{n}^{2}}$ for $\left|f\text{'}\text{'}\left(x\right)\right|\le K$

where ${E}_{T}$ is the exact error for the Trapezoidal Rule and f''(x) is the second derivative of f(x)

#### Flashcards in The Trapezoidal Rule 3

###### Learn with 3 The Trapezoidal Rule flashcards in the free StudySmarter app

We have 14,000 flashcards about Dynamic Landscapes.

What is the formula for trapezoidal rule?

The Trapezoidal Rule states that for the integral of a function f(x) on the interval [a, b], the integral can be approximated with (2(b - a)/n)(f(x0) + 2f(x1) + 2f(x2) + ... + 2f(xn-1) + f(xn)) where is the number of trapezoidal subregions.

What is trapezoidal rule with example?

The Trapezoidal Rule is an integral approximation technique that divides the area under the curve into little trapezoids. The area of each trapezoid is summed to approximate the total area under the curve.

What is the order of trapezoidal rule?

The Trapezoidal Rule is a first-order numerical integration method. This means that straight line is used to approximate along the curve and the error of the estimate is proportional to the interval size.

How do you prove trapezoidal rule?

The Trapezoidal Rule can be proved using the formula for the area of a trapezoid. Each trapezoidal sum region is then summed to approximate the total area under the curve.

How to use the trapezoidal rule with a table?

Treat the first table entry as x0  and each following entry as x1, x2, ... with the last entry as xn. The number of trapezoidal subregions should be one less than the number of entries in the table.

StudySmarter is a globally recognized educational technology company, offering a holistic learning platform designed for students of all ages and educational levels. Our platform provides learning support for a wide range of subjects, including STEM, Social Sciences, and Languages and also helps students to successfully master various tests and exams worldwide, such as GCSE, A Level, SAT, ACT, Abitur, and more. We offer an extensive library of learning materials, including interactive flashcards, comprehensive textbook solutions, and detailed explanations. The cutting-edge technology and tools we provide help students create their own learning materials. StudySmarter’s content is not only expert-verified but also regularly updated to ensure accuracy and relevance.

##### StudySmarter Editorial Team

Team Math Teachers

• Checked by StudySmarter Editorial Team