Trapezoidal Rule
In mathematics, the trapezoidal rule, also known as the trapezoid rule or trapezium rule is a technique for approximating the definite integral in numerical analysis. The trapezoidal rule is an integration rule used to calculate the area under a curve by dividing the curve into small trapezoids. The summation of all the areas of the small trapezoids will give the area under the curve. Let us understand the trapezoidal rule formula and its proof using examples in the upcoming sections.
What is Trapezoidal Rule?
The trapezoidal rule is applied to solve the definite integral of the form b∫a f(x) dx, by approximating the region under the graph of the function f(x) as a trapezoid and calculating its area. Under the trapezoidal rule, we evaluate the area under a curve is by dividing the total area into little trapezoids rather than rectangles.
Trapezoidal Rule Formula
We apply the trapezoidal rule formula to solve a definite integral by calculating the area under a curve by dividing the total area into little trapezoids rather than rectangles. This rule is used for approximating the definite integrals where it uses the linear approximations of the functions. The trapezoidal rule takes the average of the left and the right sum.
Let y = f(x) be continuous on [a, b]. We divide the interval [a, b] into n equal subintervals, each of width, h = (b – a)/n,
such that a = x0 < x1 < x2 < ⋯ < xn = b
Area = (h/2) [y0 + 2 (y1 + y2 + y3 + ….. + yn-1) + yn]
where,
- y0, y1,y2…. are the values of function at x = 1, 2, 3….. respectively.
Derivation of Trapezoidal Rule Formula
We can calculate the value of a definite integral by using trapezoids to divide the area under the curve for the given function.
Trapezoidal Rule Statement: Let f(x) be a continuous function on the interval (a, b). Now divide the intervals (a, b) into n equal sub-intervals with each of width,
Δx = (b – a)/n, such that a = x0 < x1 < x2 < x3 <…..< xn = b
Then the Trapezoidal Rule formula for area approximating the definite integral b∫af(x)dx is given by:
b∫af(x) dx ≈ Tn = △x/2 [f(x0) + 2f(x1) + 2f(x2) +….2f(xn-1) + f(xn)]
where, xi = a + i△x
If n → ∞, R.H.S of the expression approaches the definite integral b∫a f(x)dx
Proof:
To prove the trapezoidal rule, consider a curve as shown in the figure above and divide the area under that curve into trapezoids. We see that the first trapezoid has a height Δx and parallel bases of length y0 or f(x0) and y1 or f1. Thus, the area of the first trapezoid in the above figure can be given as,
(1/2) Δx [f(x0) + f(x1)]
The areas of the remaining trapezoids are (1/2)Δx [f(x1) + f(x2)], (1/2)Δx [f(x2) + f(x3)], and so on.
Consequently,
∫ba f(x) dx ≈ (1/2)Δx (f(x0)+f(x1) ) + (1/2)Δx (f(x1)+f(x2) ) + (1/2)Δx (f(x2)+f(x3) ) + … + (1/2)Δx (f(n-1) + f(xn) )
After taking out a common factor of (1/2)Δx and combining like terms, we have,
∫ba f(x) dx≈ (Δx/2) (f(x0)+2 f(x1)+2 f(x2)+2 f(x3)+ … +2f(n-1) + f(xn) )
How to Apply Trapezoidal Rule?
The trapezoidal rule can be applied to solve the definite integral of any given function. It calculates the area under the curve formed by the function by dividing it into trapezoids and is a lesser accurate method in comparison to Simpson’s Rule. Both Simpson’s Rule and Trapezoidal Rule give the approximation value, but Simpson’s Rule results in an even more accurate approximation value of the integrals because Simpson’s Rule uses the quadratic approximation instead of linear approximation.
Follow the below-given steps to apply the trapezoidal rule to find the area under the given curve, y = f(x).
- Step 1: Note down the number of sub-intervals, “n” and intervals “a” and “b”.
- Step 2: Apply the formula to calculate the sub-interval width, h (or) △x = (b – a)/n
- Step 3: Substitute the obtained values in the trapezoidal rule formula to find the approximate area of the given curve,
b∫a f(x)dx ≈ Tn = (△x/2) [f(x0) + 2 f(x1) + 2 f(x2) +….+ 2 f(n-1) + f(n)], where, xi = a + i△x
Let us have a look at a few examples to understand trapezoidal rule better.
Examples Using Trapezoidal Rule
Example 1: Find the area under the curve using trapezoidal rule formula which passes through the following points:
x | 0 | 0.5 | 1 | 1.5 |
y | 5 | 6 | 9 | 11 |
Solution:
Given: y0 = 5
y1= 6
y2= 9
y3= 11
h = (0.5 – 0) = (1 – 0.5) = (1.5 – 1) = 0.5
Using Trapezoidal rule formula,
Area = (h/2) [y0 + yn + 2(y1 + y2 + y3 + ….. + yn-1)]
= (.5/2) [5 + 11 + 2 (6 + 9)]
= 0.25 [16+30]
= 0.25 [46]
= 11.5
Answer: Therefore, the area under the curve is 11.5 sq units.
Example 2: Using Trapezoidal Rule Formula find the area under the curve y = x2 between x = 0 and x = 4 using the step size of 1.
Solution:
Given: y = x2
h = 1
Find the values of ‘y’ for different values of ‘x’ by putting the value of ‘x’ in the equation y = x2
X | 0 | 1 | 2 | 3 | 4 |
y = x2 | y0 = 0 | y1 = 1 | y2 = 4 | y3 = 9 | y4 = 16 |
Using Trapezoidal rule:
Area = (h/2) [y0 + yn + 2 (y1 + y2 + y3 + ….. + yn-1)]
= (1/2) [0 + 16 + 2 (1 + 4 + 9)]
= 0.5 [16 + 28]
= 22
Answer: Therefore, the area under the curve is 22 sq units.
Example 3: Find the area under the curve using the trapezoidal rule formula which passes through the following points:
x | 0 | 0.5 | 1 | 1.5 |
y | 4 | 7 | 10 | 15 |
Solution:
Given: y0 = 4
y1 = 7
y2 = 10
y3 = 15
h = (0.5 – 0) = (1 – 0.5) = (1.5 – 1) = 0.5
Using Trapezoidal formula:
Area = (h/2) [y0 + yn + 2 (y1 + y2 + y3 + ….. + yn-1)]
= (0.5/2) [4 + 15 + 2 (7 + 10)]
= 0.25 [19 + 34]
= 0.25 [53]
= 13.25
Answer: Therefore, the area under the curve is 13.25 sq units.
FAQs on Trapezoidal Rule
Why is Trapezoidal Rule Used?
The trapezoidal rule is an integration rule used to calculate the area under a curve by dividing the curve into small trapezoids. The summation of all the areas of the small trapezoids will give the area under the curve. Under this rule, the area under a curve is evaluated by dividing the total area into little trapezoids rather than rectangles.
What is the Trapezoidal Rule Formula?
The trapezoidal rule formula is, Area = (h/2)[y0+yn+2(y1+y2+y3+…..+yn-1)]
where,
- y0, y1,y2…. are the values of function at x = 1, 2, 3….. respectively.
- h = small interval (x1– x0)
Why is it Called Trapezoidal Rule Formula?
The rule is called trapezoidal because when the area under the curve (a definite integral) is evaluated, then the total area is divided into small trapezoids instead of rectangles. Then we find the area of these small trapezoids in a definite interval.
Using the Trapezoidal Rule Formula, Find the Area when h = 2, y0 = 4, y1 = 8, y2 = 12, y3 = 15.
Using trapezoidal formula, Area = (h/2)[y0+yn+2(y1+y2+y3+…..+yn-1)]
= (2/2) [4+15+2(8+12)]
= 1[19+40]
= 1[59]
= 59
Therefore, the area under the curve is 59 sq. units.
Solved Examples
Go through the below given Trapezoidal Rule example.
Example 1:
Approximate the area under the curve y = f(x) between x =0 and x=8 using Trapezoidal Rule with n = 4 subintervals. A function f(x) is given in the table of values.
x | 0 | 2 | 4 | 6 | 8 |
f(x) | 3 | 7 | 11 | 9 | 3 |
Solution:
The Trapezoidal Rule formula for n= 4 subintervals is given as:
T4 =(Δx/2)[f(x0)+ 2f(x1)+ 2f(x2)+2f(x3) + f(x4)]
Here the subinterval width Δx = 2.
Now, substitute the values from the table, to find the approximate value of the area under the curve.
A≈ T4 =(2/2)[3+ 2(7)+ 2(11)+2(9) + 3]
A≈ T4 = 3 + 14 + 22+ 18+3 = 60
Therefore, the approximate value of area under the curve using Trapezoidal Rule is 60.
Example 2:
Approximate the area under the curve y = f(x) between x =-4 and x= 2 using Trapezoidal Rule with n = 6 subintervals. A function f(x) is given in the table of values.
x | -4 | -3 | -2 | -1 | 0 | 1 | 2 |
f(x) | 0 | 4 | 5 | 3 | 10 | 11 | 2 |
Solution:
The Trapezoidal Rule formula for n= 6 subintervals is given as:
T6 =(Δx/2)[f(x0)+ 2f(x1)+ 2f(x2)+2f(x3) + 2f(x4)+2f(x5)+ f(x6)]
Here the subinterval width Δx = 1.
Now, substitute the values from the table, to find the approximate value of the area under the curve.
A≈ T6 =(1/2)[0+ 2(4)+ 2(5)+2(3) + 2(10)+2(11) +2]
A≈ T6 =(½) [ 8 + 10 + 6+ 20 +22 +2 ] = 68/2 = 34
Therefore, the approximate value of area under the curve using Trapezoidal Rule is 34.
Frequently Asked Questions – FAQs
What is Trapezoidal Rule?
Why the rule is named after trapezoid?
What is the difference between Trapezoidal rule and Riemann Sums rule?
Frequently Asked Questions
What is trapezoidal rule in math?
In math, the trapezoidal rule helps to estimate the area under the graph. The trapezoidal rule is a quick way to provide an approximation of the area by using the trapezoid area formula.
What is the formula of trapezoidal rule?
The formula of the trapezoidal rule depends on the summation notation of the areas of trapezoids constructed under the graph or curve. For example, a single trapezoid rule is the multiplication of three terms: the trapezoid’s height multiplied by the addition of the lengths of the two parallel sides multiplied by half.
How do you use the trapezoidal rule?
The trapezoid rule calculates the area trapped between a graph or curve and the x-axis. To use the trapezoid rule, calculate the area of every constructed trapezoid and add them up to find the total area.
Sample Questions
Ques. Find the area under the curve for the curve passing through the points (0,2), (0.5,4), (2,10), and (2.5,12) using the formula. (3 marks)
Ans. Write the given points in the tabular form we have,
x | 0 | 0.5 | 1 | 1.5 |
y | 2 | 4 | 10 | 12 |
Given that, y0 = 2
y1 = 4
y3 = 10
y4 = 12
Δx = (0.5 – 0) = (1 – 0.5) = (1.5 – 1) = 0.5
Using Trapezoidal Formula,
Area = Tn = Δx/2 [y0 + 2y1 + 2y2 +…… +2yn-1 + yn]
= 0.5/2 [2 + 2×4 + 2×10 + 12]
= 0.5/2 [42]
= 10.5
Therefore, the area under the curve is 10.5 sq units.
Ques. Find the area under the curve y=x2 between the x=0 and x=3 using the trapezoidal rule taking step size 2. (3 marks)
Ans. Given, y=x2
Δx = 2
Find values of y for different values of x using the equation y=x2
x | 0 | 1 | 2 | 3 |
y=x2 | y0=0 | y1=1 | y2=4 | y3=9 |
Using Trapezoidal Formula,
Area = Δx/2 [y0 + 2y1 + 2y2 + y3]
= 2/2 [0 + 2x1 + 2x4 + 9]
= 19
Therefore, the area under the curve is 19 sq. units
Ques. Use the Trapezoidal Rule to approximate 0∫4 x2dx with n=2. (3 marks)
Ans. Using the trapezoidal formula result we have,
a∫b f(x)dx = [f(a) + f(b)](b-a)/n
f(x) = x2
a = 0
b = 4
n = 2,
f(a=0) = 0
f(b=4) = 16
Δx = (4-0)/2 = 2
0∫4 x2dx = [16 + 0](4 – 2)/2
= 16
The approximate value is 16.
Ques. Use the trapezoidal rule to find 1∫4 √1+x dx with n = 9. (5 marks)
Ans. Given, f(x) = (1+x)1/2
Δx = (b-a)/n
= (4-1)/9
= 1/3
Now, divide the curve into 9 subintervals with the length Δx=1/3 the following 9 subintervals are,
a= 1, 4/3, 5/3, 2, 7/3, 8/3, 3, 10/3, 11/3, 4 = b
Now, calculate the values of functions with these endpoint,
f(x0) = f(1) = √2 = 1.41
f(x1) = f(4/3) = √7/3 = 0.88
f(x2) = f(5/3) = √8/3 = 0.94
f(x3) = f(2) = √3 = 1.73
f(x4) = f(7/3) = √10/3 = 1.05
f(x5) = f(8/3) = √11/3 = 1.10
f(x6) = f(3) = √4 = 2
f(x7) = (10/3) = √13/3 = 1.20
f(x8) = (11/3) = √14/3 = 1.24
f(x9) = (4) = √5 = 2.23
a∫b f(x)dx = Δx/2[f(x0) + 2f(x1) + 2f(x2) + 2f(x3) +……. 2f(xn-1) + f(xn)]
= 1/6 [1.41 + 2(0.88 + 0.94 + 1.73 + 1.05 + 1.10 + 2 + 1.20 + 1.24) + 2.23]
= 1/6 [14.98]
= 2.4966 ≈ 2.5
Hence, 1∫4 √1+x dx ≈ 2.4966
Ques. Approximate the integral 0∫2 (1 + cos[2√x])dx by using trapezoidal rule with n = 1, 2, and 4 subintervals. (5 marks)
Ans. Given, f(x) = (1 + cos[2√x])
f(0) = 2
f(1) = 1+ cos2
f(2) = 1+ cos2√2
f(3) = 1+ cos2√3
f(4) = 1+ cos4
For n=1,
T1 = [(2-0/1)]/2 [f(0) + f(2)]
= [2 + 1+cos2√2]
= [3 +cos2√2]
= [3 + 0.99]
= 3.99
For n=2,
T2 = [(2-0)/2]/2 [f(0) + 2f(1) + f(2)]
= 1/2 [2 + 2(1+cos2) + (1+cos2√2)]
= 1/2 [5 + 2cos2 + cos2√2]
= 1/2 [5+ 1.99 + 0.99]
= 3.99
For n=4,
T4 = [(2-0)/4]/2 [f(0) + 2f(1) + 2f(2) + 2f(3) + f(4)]
= 1/4 [2 + 2(1+cos2) + 2(1+cos2√2 + 2(1+cos2√3) + (1+cos4)]
= 1/4 [9 + 2cos2 + 2cos2√2 + 2coss2√3 + cos4]
= 1/4 [9+ 1.99 + 1.99 + 1.99 + 0.99]
= 3.99
Ques. Use the Trapezoidal rule with n=8 to evaluate 0∫2 1/(1+x2)dx. Calculate the approximate value of π. (5 marks)
Ans. Using Trapezoidal formula we have,
T8 = Δx/2 [f(x0) + 2f(x1) + f(x2)+…… 2f(x7) + f(x8)]….(1)
f(x) = 1/(1+x2)
Δx = b-a/n = 2-0/8 = 1/4 = 0.25
Now, calculate f(xi) for different values of xi
(b = Δx + a )
x= a <xi <b = 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2
x | 0 | 0.25 | 0.5 | 0.75 | 1 | 1.25 | 1.50 | 1.75 | 2 |
f(x) | 1 | 0.94 | 0.8 | 0.64 | 0.5 | 0.39 | 0.30 | 0.25 | 0.2 |
Putting the values in equation 1 we have,
T8 = 0.25/2 [1 + 2(0.94+0.8+0.64+0.5+0.39+0.3+0.25) + 0.2]
= 0.125 [1.2 + 7.64]
= 0.125 x 8.84
= 1.105
Hence, 0∫2 1/(1+x2)dx = 1.105
Now, evaluate this integral
0∫2 1/(1+x2)dx = [arctanx]20 = arctan2 – arctan0 = 1.107 – 0 = 1.107(π/2.85)
Hence, the approximate value of π is given by;
π/2.85 ≈ 0∫2 1/(1+x2)dx
π ≈ 2.85 x 1.105
π ≈ 3.149
Ques. Calculate the approximate value of the area under the curve f(x) = 4x-x2 between x=0 and x=3 using trapezoidal rule with n = 4 subintervals. Also, calculate the % error of the approximation. (5 marks)
Ans. The Trapezoidal Rule with n = 4 is written as,
T4 = Δx/2 [f(x0) + 2f(x1) + 2f(x2) + 2f(x3) + f(x4)]…..(1)
f(x) = 4x-x2
a= 0
b=3
n=4,
The width of subintervals is,
Δx = (b-a)/n = 3-0/4 = 3/4 = 0.75
xi = [a,b] = [0, 0.75, 1.5, 2.25, 3] (b= Δx + a)
Now, calculate the values of the function at different points xi
f(x0) = f(0) = 0
f(x1) = f(0.75) = 2.4375
f(x2) = f(1.5) = 2.75
f(x3) = f(2.25) = 3.9375
f(x4) = f(3) = 4
The approximate value of the area under the curve is,
T4 = 0.75/2 [0 + 2(2.4375+2.75+3.9375) + 4]
= 0.375 [4 + 22.25]
= 0.375 x 26.25
= 9.84 —— (2)
The true solution can be found by integration
0∫3 (4x-x2)dx = [4x2/2 – x3/3]30 = 36/2 -27/3 = 9….(3)
The relative error is calculated by
|ε| = (9.84 – 9)/9.84 ≈ 0.085
Hence, a relative %error ≈ 8.53%
Ques. The curve y=ex2 is bonded by the x-axis, y-axis, and the line x=3 and forms a region R. (5 marks)
(a) Complete the table by calculating the value of y corresponding to x = 0.8 to x = 1.6
(b) Using a trapezoidal rule, calculate the approximate value for the region R using all the values of the above table.
Ans. a) We have,
f(x) = ex2
R = region formed between f(x), x-axis, y-axis, and the line x=2.
Completing the table, put the values
f(x2) = f(0.8) = e(0.8)2= e0.64
f(x4) = f(1.6) = e(1.6)2= e2.56
Hence the completed table is;
x | 0 | 0.4 | 0.8 | 1.2 | 1.6 | 2 |
y=f(x) | e0 | e0.16 | e0.64 | e1.44 | e2.56 | e4 |
b) Now, calculate the approximate value for the region R using all the values of the table is given by,
0∫2 ex2dx = Δx/2 [f(x0) + 2f(x1) + 2f(x3) + 2f(x4) + f(x5)]…..(1)
Δx = (b-a)/n = (2-0)/5 = 0.4
f(x0) = f(0) = e0 = 1
f(x1) = f(0.4) = e0.16 = 1.173
f(x2) = f(0.8) = e0.64 = 1.896
f(x3) = f(1.2) = e1.44 = 4.22
f(x4) = f(1.6) = e2.56 = 12.93
f(x5) = f(2) = e4 = 54.60
Putting all these values in equation 1 we have,
0∫2 ex2 dx = 0.4/2 [1 + 2(1.173+1.896+4.22+12.93) + 54.60]
= 0.2 [55.60 + 33.14]
= 0.2 x 88.75
≈ 17.75
Hence, the approximate value of the area of Region R is 17.75
Sample Questions
Ques. What is the Applicability of Trapezoid rule? (3 marks)
Ans. The trapezoidal rule is part of the Newton–Cotes group of numerical assimilation formulas, which includes the midpoint rule, which is related to the trapezoidal law. Simpson’s rule is yet another component of the same group, and for functions that are twice constantly differentiable, it has a faster rate of convergence than the trapezoidal rule in average, albeit not in all circumstances.
The trapezoidal rule, on the other hand, has a higher convergence rate than Simpson’s rule for certain classes of coarser functions (those with weaker smoothing criteria). Furthermore, when periodic variables are combined throughout their periods, the trapezoidal rule is likely to become exceedingly precise, which can be studied in a variety of ways. Maximum functionalities also have a similar effect.
Ques. Applying the trapezoidal rule formula, determine the area underneath the curve that goes through the mentioned sequence: (3 marks)
X | 0 | 0.5 | 1 | 1.5 |
y | 5 | 6 | 9 | 11 |
Ans. Presented: y00 = 5
y1y1= 6
y2y2= 9
y3y3= 11
h = (0.5 – 0) = (1 – 0.5) = (1.5 – 1) = 0.5
By applying Trapezoidal Rule Formula,
Area = h2[y0+yn+2(y1+y2+y3+…..+yn−1)]h2[y0+yn+2(y1+y2+y3+…..+yn−1)]
= 0.52[5+11+2(6+9)]0.52[5+11+2(6+9)]
= 0.25[16+30]
= 0.25[46]
= 11.5
Hence, the area underneath the curve is 11.5 sq units.
Ques. Which Quantitative integration method is the best? (2 marks)
Ans. The finest numerical approach of inclusion is called Gaussian quadrature if the parameters are known analytically rather than tabulated at evenly spaced frequencies. Gaussian quadrature provides the most precise approximations available by selecting the abscissas at which to assess the function. Considering the pace of today’s electronics, however, the added complexity of the Gaussian quadrature approach is typically less desired than just brute-forcing twice as many dots on a grid pattern.
Ques. Determine the area underneath the curve y = x2 between x = 0 and x = 4 by utilising the Trapezoidal Rule Formula with a scale factor of 1. (4 marks)
Ans. Presented: y = x2
h = 1
Evaluate the values of ‘y’ for different variables of ‘x’ by putting the value of ‘x’ in the equation y = x2
X | 0 | 1 | 2 | 3 | 4 |
y = x22 | y00 = 0 | y11 = 1 | y22 = 4 | y33 = 9 | y44 = 16 |
By applying Trapezoidal Rule Formula:
Area = h2[y0+yn+2(y1+y2+y3+…..+yn−1)]h2[y0+yn+2(y1+y2+y3+…..+yn−1)]
= 12[0+16+2(1+4+9)]12[0+16+2(1+4+9)]
= 0.5[16 + 28]
= 22
Hence, the area underneath the curve is 22 sq units.
Ques. The trapezoidal rule formula, which travels through the following locations, can be used to calculate the area beneath the curve: (3 marks)
x00.511.5
y471015
Ans. Presented: y00= 4
y1y1 = 7
y2y2 = 10
y3y3 = 15
h = (0.5 – 0) = (1 – 0.5) = (1.5 – 1) = 0.5
By applying Trapezoidal Rule Formula:
Area = h2[y0+yn+2(y1+y2+y3+…..+yn−1)]h2[y0+yn+2(y1+y2+y3+…..+yn−1)]
= 0.52[4+15+2(7+10)]0.52[4+15+2(7+10)]
= 0.25[19+34]
= 0.25[53]
= 13.25
Hence, the area underneath the curve is 13.25 sq units.
Ques. Applying the Trapezoidal Rule with n = 4 subintervals, estimate the area underneath the curve y = f(x) between x = 0 and x=8. In the list of values, there is a function f(x). (3 marks)
x | 0 | 2 | 4 | 6 | 8 |
f(x) | 3 | 7 | 11 | 9 | 3 |
Ans. The Trapezoidal Rule for n= 4 subintervals is Presented as:
T4 =(Δx/2)[f(x0)+ 2f(x1)+ 2f(x2)+2f(x3) + f(x4)]
We can see the subinterval width Δx = 2.
Now, through substitution the values from the table, to find the approximation value of the area underneath the curve.
A≈ T4 =(2/2)[3+ 2(7)+ 2(11)+2(9) + 3]
A≈ T4 = 3 + 14 + 22+ 18+3 = 60
Hence, the approximation value of area underneath the curve using Trapezoidal Rule is 60.
Ques. Calculate the location encompassed by the function f(x) with two intervals between x = 0 and x = 2. 2x Equals f(x). (3 marks)
Ans. We are provided a=0, b=2, c=-2
Related Articles
Leave a Reply