Trapezoidal Rule

Here, the integral is computed on each of the sub-intervals by using linear interpolating formula, i.e. for $ n = 1$ and then summing them up to obtain the desired integral.

Note that

$\displaystyle \int\limits^{b}_{a}f(x)dx =
\int\limits^{x_1}_{x_0}f(x)dx + \int...
...\int\limits^{x_k}_{x_{k+1}}f(x)dx +\cdots +
\int\limits^{x_{n-1}}_{x_n}f(x)dx $

Now using the formula ( 13.3.2) for $ n = 1$ on the interval $ [x_k, x_{k+1}],$ we get,

$\displaystyle \int\limits^{x_{k+1}}_{x_k}f(x)dx =\frac{h}{2}
\left[y_k +y_{k+1}\right].$

Thus, we have,

$\displaystyle \int\limits^{b}_{a}f(x)dx = \frac{h}{2} \left[y_0
+y_{1}\right]+...
...ac{h}{2} \left[y_{n-2} +y_{n-1}\right]+\frac{h}{2}
\left[y_{n-1} +y_{n}\right]$

i.e.
$\displaystyle \int\limits^{b}_{a}f(x)dx$ $\displaystyle =$ $\displaystyle \frac{h}{2} \left[y_0 +2 y_{1} + 2
y_{2}+\cdots+ 2 y_k +\cdots + 2 y_{n-1} + y_{n}\right]$  
  $\displaystyle =$ $\displaystyle h\left[\frac{y_0+y_n}{2}+\sum_{i=1}^{n-1} y_i\right]
.$ (13.3.4)

This is called TRAPEZOIDAL RULE. It is a simple quadrature formula, but is not very accurate.

Remark 13.3.1   An estimate for the error $ E_1$ in numerical integration using the Trapezoidal rule is given by

$\displaystyle E_1= - \frac{b-a}{12}\overline{\Delta^2 y}, $

where $ \overline{\Delta^2 y}$ is the average value of the second forward differences.

Recall that in the case of linear function, the second forward differences is zero, hence, the Trapezoidal rule gives exact value of the integral if the integrand is a linear function.

EXAMPLE 13.3.2   Using Trapezoidal rule compute the integral $ \int\limits^{1}_{0}e^{x^2}dx,$ where the table for the values of $ y = e^{x^2}$ is given below:
$ x$ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
$ y$ 1.00000 1.01005 1.04081 1.09417 1.17351 1.28402 1.43332 1.63231 1.89648 2.2479 2.71828

Solution: Here, $ h=0.1, \; n=10,$

$\displaystyle \frac{y_0+y_{10}}{2}=\frac{1.0+2.71828}{2}= 1.85914,$

and

$\displaystyle \sum_{i=1}^{9} y_i=12.81257.$

Thus,

$\displaystyle \int\limits^{1}_{0}e^{x^2}dx=
0.1\times[1.85914+12.81257]=1.467171$

A K Lal 2007-09-12