Trapezoidal Rule

Trapezoidal Rule
Written by: Jack Methew

Jack Methew knows that successful students become successful adults. This is her 15th year at Edison Elementary School and her 10th year teaching fourth grade. So far, fourth grade is her favorite grade to teach! Mrs. Carroll was the 2011 Newell Unified School District Teacher of the Year, and received her National Board Certification in 2013. She loves science and majored in biology at Arizona State University, where she also earned her teaching credential and Master of Education degree. Mrs. Carroll is excited to begin the best year ever!

See Article History

Trapezoidal Rule

The trapezoidal approximation allows you to estimate the value of a definite integral which represents the area under a curve.

$$ T_n \; \approx \; \int_a^b f(x) \; dx $$

So consider we have a trapezoid rule example in which there is a curve y = x2 and we wish to estimate the area under the curve from 0 to 10.

$$ T_n \; \approx \; \int_0^{10} x^2 \; dx $$

Use the trapezoidal rule to do so,

So let's graph this function so this is the right side of y = x2 and we want to calculate or estimate the area of the shaded region by using trapezoidal approximation as shown in the graph.

Now let's use five sub intervals or five rectangles i.e. n=5 to do so and then we can confirm how close our estimation is using the exact value of the definite integral.

Width of Sub Intervals in Trapezoidal Approximation

So first we need to calculate Δx, the width of each sub interval and that's going to be:

$$ Δx \;=\; \frac{b-a}{n} $$

So we're going from 0 to 10 in the given function of definite integral, therefore, b = 10 & a =0 and n= 5. So the interval is

$$ Δx \;=\; \frac{b-a}{n} \;=\; \frac{10-0}{5} \;=\; 2 $$

So Δx is 2. Now what I like to do is create a number line from A to B in this case 0 to 10 and Delta X is 2, which represents that the width of each sub-interval it's going to be 2.

Now just to recap using the left endpoint or right endpoint or a midpoint rule for a Riemann sums problem you would have to choose five points out of the six points listed. Since n is equal to five there's five intervals and you would have to choose five out of the six points.

For the trapezoidal rule you should use all six points, you're not gonna use five out of the six players, you're gonna use all of them and so that's how the trapezoidal rule differs in one way from using the left endpoint the right endpoint or the midpoint rule.

Trapezoidal rule Formula

Now what is the trapezoid area formula of integration approximation?

The area of the rectangles will be equal to:

$$ T_n \; \approx \; \frac{Δx}{2} \left[ f(x_0) \;+\; 2f(x_1) \;+\; 2f(x_2) \;+\;...\;+\; 2f(x_{n-1}) \;+\; f(x_n) \right] $$

So here's what we need to know for the trapezoid rule formula: the first one and the last one are y-values that do not multiply by 2.

Remaining all of the y values in the middle will multiply by 2.

Trapezoidal rule Example

Now let's try the above trapezoid rule example

So we have Δx = 2 and we have confused what x0,x1 and so on , basically these are the value points that we had on a number line.

Here x0 = 0, x1 = 2, x2 = 4, x3 = 6, x4 = 8, x5 = 10, So the trapezoid area formula will become:

$$ T_5 \; \approx \; \frac{2}{2} \left[ f(0) \;+\; 2f(2) \;+\; 2f(4) \;+\; 2f(6) \;+\; 2f(8) \;+\; f(10) \right] $$

So keep that in mind the first and the last one do not multiply that by 2. So never multiply these two Y values by 2 but the middle ones you need to do so.

So let’s simplify it

Since f(x) = x2

So we can get values of function at trapezoid points in a number line.

f(0) = 0, f(2) = 4, f(4) = 16, f(6) = 36, f(8) = 64, f(10)=100

Now it’s just solved here,

$$ T_5 \; \approx \; 1 \left[ f(0) \;+\; 2(4) \;+\; 2(16) \;+\; 2(36) \;+\; 2(64) \;+\; (100) \right] $$ $$ T_5 \; \approx \; \left[ 8 \;+\; 32 \;+\; 72 \;+\; 128 \;+\; 100 \right] $$ $$ T_5 \; \approx \; 340 $$

So that's the approximate area under the curve which we have calculated by using the trapezoidal rule formula.

Now let's calculate the exact answer by evaluating the definite integral for checking the results obtained from the trapezoid rule.

So the exact answer is going to be:

$$ \int_0^{10} x^2 \;=\; \frac{x^3}{3} \Biggr|_0^{10} \; dx $$ $$ \int_0^10 x^2 \;=\; \left[ \frac{10^3}{3} \;-\; \frac{0^3}{3} \right] \;=\; 333.33 $$

So the exact answer is 333.3 which represents the area under the curve as we see in this trapezoid rule example.

The trapezoidal rule did a very good job in approximating the exact answer of the area under the curve 340 is very close to 333.33 and so the trapezoidal rule is a very good approximation if you wish to evaluate the definite integral or find the area under the curve.