next up previous
Next: Simpson's Rule: Up: NUMERICAL INTEGRATION Previous: NUMERICAL INTEGRATION


Trapezoidal Rule:

This is the case of $n=1$, i.e. linear approximation. In this case $h=b-a$ and $\displaystyle \gamma_0=\int_0^1\frac{u-1}{0-1}\, du=\frac{1}{2},$ and $\displaystyle \gamma_1=\int_0^1\frac{u-0}{1-0}\, du=\frac{1}{2}$. This gives the trapezoid rule approximation

\begin{displaymath}\int_a^b f(x)\, dx\approx \frac{h}{2}\left(f(a)+f(b)\right).\end{displaymath}

To estimate the error in this approximation, we need to estimate the error term

\begin{displaymath}E(f)=\int_a^b \frac{(x-a)(x-b)}{2} f''(\xi(x))\, dx.\end{displaymath}

Using the same change of variables ($x=a+hu$), it is convenient to rewrite this as

\begin{displaymath}E(f)=h^3\int_0^1 \frac{u(u-1)}{2} f''(\xi(a+uh))\,du.\end{displaymath}

We would like to be able to simplify this error term so that we do not have an integral of an unknown function. It is the $\xi(x)$ term that causes the difficulty. We will use a theorem which is occasionally taught in calculus to allow us to produce a simplified estimate on the error.

Theorem (Weighted Mean Value Theorem)

If $f\in C[a,b],\, g$ is integrable on $[a,b]$ and $g$ does not change sign on $[a,b]$ then there exist a constant $c$ in $(a,b)$ such that

\begin{displaymath}
\int^b_a f(x)g(x)dx=f(c)\int^b_a g(x)dx
\end{displaymath}

Note: The reason for the name of the theorem is that the formula can be written as

\begin{displaymath}\bar{f}\equiv\frac{\int_a^b f(x)g(x)\, dx}{\int_a^b g(x)\, dx}=f(c),\end{displaymath}

and $\bar{f}$ is the weighted mean value (for cases where $g$ is non-negative.)

Proof: We will restrict in this proof to the case where $g(x)$ is piecewise continuous and $\int_a^b g(x)\,dx\neq0$ though the theorem is more general. The proof of this theorem is very similar to that of the mean value theorem. Suppose that no such $c$ exists. Let $\displaystyle \bar{f}=\frac{\int_a^b f(t)g(t)\,dt}{\int_a^b g(t)\,dt}.$ Since $f(x)$ is continuous, this means that either for all $x$ in $(a,b)$ $f(x) < \bar{f}$ or for all $x$ in $(a,b)$ $f(x) > \bar{f}.$ Without loss of generality, let's assume we are in the first case. Also without loss of generality assume $g(x)\geq 0$ on $(a,b)$. Then if we multiply the two inequalities we get $f(x)g(x) \leq \bar{f}g(x).$

At this point if we had the strict inequality, we would be done. Just integrate from $a$ to $b$ and the resulting formula would be

\begin{displaymath}\int_a^b f(x) g(x)\,dx < \bar{f} \int_a^b g(x) \,dx\end{displaymath}

and dividing through by the integral of $g$ and recalling the definition of $\bar{f}$ gives the contradictory conclusion that $\bar{f}<\bar{f}$. Thus we would conclude that the assumption that no $c$ in $(a,b)$ with $f(c)=\bar{f}$ exists is not correct, and the theorem would be proved.

To get the strict inequality for the integral, we use the continuity of $f(x),$ the assumption that $\int_a^b g(x)\, dx> 0$ and our assumption that $g(x)$ is piecewise continuous. This allows us to conclude that $g(d)> 0$ at some point $d$ in $(a,b)$ where $g(x)$ is continuous. (If not, then $g(x)=0$ except at a finite number of points, and then the integral would have to be zero). At that point $d$ we know that $f(d) < \bar{f}$. Let $\epsilon=(\bar{f}-f(d))/2.$ By continuity of $f(x)g(x)-\bar{f}g(x)$ at $d$, there is an interval $(d-\delta,d+\delta)\subset (a,b)$ where $f(x)g(x)\leq\bar(f)g(x)-\epsilon$. Integrating from $a$ to $b$ and splitting the interval into pieces we get

\begin{eqnarray*}
\int_a^b f(x)g(x)\,dx&=&\int_a^{d-\delta} f(x)g(x)\,dx
+\int_...
...\quad = \int_a^b g(x)\,dx - 2\delta\epsilon < \int_a^b g(x)\,dx.
\end{eqnarray*}



The case where $\int_a^b g(x)\, dx=0$ is not hard to check, but since we will not need it, we will skip it$\Box$

$\Box$

Note: $u(u-1)$ does not change sign on $[0,1]$ and is integrable

\begin{eqnarray*}
&&\int^{1}_{{0}}f''(\xi(a+hu))\frac{u(u-1)}{2}\,du=f''(\xi)\i...
...c{u^3}{6}-\frac{u^2}{4}
\bigg\vert^{1}_{0}=-\frac{1}{12}f''(\xi)
\end{eqnarray*}



Putting it all together we have

\fbox{\parbox{\textwidth}{
\begin{displaymath}\int^b_a f(x)dx=\frac{h}{2}\left(f...
...gin{displaymath}\mbox{where }h=b-a\mbox{ and } \xi \in (a,b).\end{displaymath}}}

Remark: The formula is exact if $f''=0$ (i.e. polynomial of degree 1 or less). This exactness on polynomials of degree less than or equal to 1, is (what we define to be) an order of accuracy of 1. Quadrature rules are of the $n^{th}$ order, if they are exact with an $n^{th}$-degree polynomial. Schematically, the situation in the Trapezoidal rule is shown in Figure 44

Figure 44: The trapezoidal rule approximates the area under $f(x)$ by a trapezoid.
\includegraphics[totalheight=3in]{trap.eps}


next up previous
Next: Simpson's Rule: Up: NUMERICAL INTEGRATION Previous: NUMERICAL INTEGRATION
Juan Restrepo 2003-04-12