Trapezoidal rule is a technique used to approximate the value of a definite integral ($\int_{a}^{b}$ f(x)dx). Supposing f(x) is continuous on [a, b] divide [a, b] into n sub intervals of equal length $\bigtriangleup$x = $\frac{b - a}{n}$.  Using n + 1 points we get $x_{0}$ = a, $x_{1}$ = a + $\bigtriangleup$x, $x_{2}$ = a + 2$\bigtriangleup$x, ......, $x_{n}$ = a + n$\bigtriangleup$x = b.

f(x) at these points is $y_{0}$ = f($x_{0}$), $y_{1}$ = f($x_{1}$),.......,$y_{n}$ = f($x_{n}$). As straight lines are formed between the points (x$_{i-1}$, y$_{i-1}$) and (x$_{i}$, y$_{i}$) for 1 $\leq$ i $\leq$ n approximate the integral using n trapezoids.

Trapezoidal Rule Graph

Adding the area of a rectangle and a triangle the area of trapezoid is
 
A = $y_{0}$$\bigtriangleup$x + $\frac{1}{2}$ ($y_{1} - y_{0}$) $\bigtriangleup$x

A = $\frac{(y_{0} + y_{1})\bigtriangleup x}{2}$

Area of trapezoid is A = $\frac{(y_{0} + y_{1})\bigtriangleup x}{2}$
Adding the area of n trapezoids the approximation is

$\int_{a}^{b}f(x)dx$  $\approx$  $\frac{(y_{0}+y_{1})\bigtriangleup x}{2}$ + $\frac{(y_{1}+y_{2})\bigtriangleup x}{2}$ + ........ + $\frac{(y_{n-1} + y_{n})\bigtriangleup x}{2}$

which is simplified to

$\int_{a}^{b}f(x)dx$  $\approx$ $\frac{\bigtriangleup x}{2}$ ($y_{0}  + 2y_{1}+ 2y_{2}+ ...... + 2y_{n-1}+y_{n})$
Therefore the formula for trapezoidal rule is
$\int_{a}^{b}f(x)dx$  $\approx$ $\frac{\bigtriangleup x}{2}$ ($y_{0}  + 2y_{1}+ 2y_{2}+ ...... + 2y_{n-1}+y_{n})$
Composite integral method is used for approximating definite integral by evaluating the integral at n points. Sub divide [a, b] into 'n' smaller intervals with $\bigtriangleup$x = h. Applying the rule to each sub interval and adding we get the composite trapezoidal rule as
$\int_{a}^{b}f(x)\approx \sum_{i=0}^{n-1}$$\frac{h}{2}$ $(f_{i}+f_{i+1})$

=$\frac{h}{2}$$(f_{0}+2f_{1}+2f_{2}+............+2f_{n-1}+f_{n})$
Integration trapezoid rule can be solved by first approximating the integrand by a polynomial and then integrate for the given limits. Trapezoidal rule gives an approximate value for an integral based on the sum of the areas of trapezia.

Trapezoidal rule is also known as approximate integration.
The formula for integration trapezoid rule is given by

 $\int_{a}^{b}f(x)dx$ =$\frac{h}{2}$$[f(x_{0})+2f(x_{1})+......+2f(x_{n-1})+f(x_{n})]$

Solved Examples

Question 1: Use the trapezoidal rule with n = 5 estimate  $\int_{1}^{5}\sqrt{1+x^{2}}$ dx
Solution:
 
For n = 5 we have $\bigtriangleup$x = $\frac{5-1}{5}$ = 0.8

Computing the values for $y_{0}$, $y_{1}$,......,$y_{5}$

x
y = $\sqrt{1+x^{2}}$
1
 1.41
1.8
 2.06
 2.6  2.78
 3.4  3.54
 4.2  4.32
 5  5.10
  $\int_{1}^{5}\sqrt{1+x^{2}}$ dx  = $\frac{0.8}{2}$ (1.41 + 2(2.06) + 2(2.18) + 2(3.54) + 2(4.32) + (5.10))
= 12.284
 

Question 2: Use the trapezoidal rule with n = 4 estimate $\int_{1}^{6}x^{4}$ dx.
Solution:
 
Given a = 1, b = 6 and n = 4  so h = $\frac{b-a}{n}$ = $\frac{6-1}{4}$ = 1.25

$x_{0}$ = 1, $x_{1}$ = 2.25, $x_{2}$ = 3.5, $x_{3}$ = 4.75, $x_{4}$ = 6
The given table gives values of x, in the left column, and $y=x^{4}$, in the right column.

1
 1
2.25
 25.628
 3.5  150.06
 4.75  509.06
6
 1296

Using the trapezoidal rule,
$\int_{1}^{6}x^{4}$ dx  = $\frac{1.25}{2}$ (1 + 2(25.628) + 2(150.06) + 2(509.06) + 1296)) = $0.625\times 2660.496$ = 1662.81.