next up previous
Next: About this document ...


Section 9.4: Approximation of Definite Integrals
Review of Riemann Sums

If $a < b$, $f(x)$ is a function on $[a,b]$, and $a = x_0 \leq a_0 \leq x_1 \leq a_1 \leq \cdots a_{n-1} \leq x_n = b$, then the Riemann sum associated to these data is


\begin{displaymath}\sum_{i=0}^{n-1} f(a_i) (x_{i+1} - x_i)\end{displaymath}

By definition, the integral, $\int_a^b f(x) dx$ is the limit (if it exists) of these Riemann sums as maximum of $\vert x_{i+1} - x_i\vert$ tends to zero.

(Applet illustrating Riemann sums)


Uniform divisions

For the sake of convenience, we often assume that the interval $[a,b]$ has been decompose into $N$ pieces of equal length, for some positive integer $N$. The length of each piece is then $\Delta := \frac{b-a}{N}$.

So, $x_i = a + i \Delta$ and $x_i \leq a_i \leq x_{i+1}$ and for such a uniform decomposition, the Riemann sum is

\begin{eqnarray*}
\sum_{i=0}^{N-1} (f(a_i) (x_{i+1} - x_i) ) & = & \sum_{i=0}^{N...
...elta
- a - i \Delta)) \\
& = & \sum_{i=0}^{N-1} f(a_i) \Delta
\end{eqnarray*}


Left- and Right-hand rules

Let $a \leq b$, $N$, and $f(x)$ be given. Then the lefthand Riemann sum approximating $\int_a^b f(x) dx$ with $N$ subdivisions is given by setting $a_i := x_i = a + i \Delta$ where $\Delta = \frac{b-a}{N}$.


\begin{displaymath}L = \sum_{i=0}^{N-1} f(a + i \Delta) \Delta\end{displaymath}

The righthand Riemann sum is given by setting $a_i := x_{i+1} = a+ (i+1) \Delta$.


\begin{displaymath}R = \sum_{i=0}^{N-1} f(a+(i+1)\Delta) \Delta\end{displaymath}


Example

Compute the left and the right approximations to $\int_1^9 x^2 dx$ with $N = 4$ subdivisions.


Solution

In this case $\Delta = \frac{9 - 1}{4} = 2$. So,

\begin{eqnarray*}
L & = & \sum_{i=0}^3 (1 + i 2)^2 2 \\
& = & (1^2 + 3^2 + 5^2 + 7^2) 2 \\
& = & (1 + 9 + 25 + 49) 2 \\
& = & 168
\end{eqnarray*}


Solution, continued

\begin{eqnarray*}
R & = & \sum_{i=0}^3 (1 + (i+1)2)^2 2 \\
& = & (3^2 + 5^2 + 7^2 + 9^2) 2 \\
& = & (9 + 25 + 49 + 81) 2 \\
& = & 328
\end{eqnarray*}


Midpoint rule

The midpoint approximation (to the integral $\int_a^b f(x) dx$ with $N$ subdivisions) is given by taking $a_i$ to be the midpoint of the interval $[x_i,x_{i+1}]$ where $x_i = a + i \Delta$ and $\Delta = \frac{b-a}{N}$. Thus, $a_i = a + (i + \frac{1}{2}) \Delta$ and


\begin{displaymath}M = \sum_{i=0}^{N-1} f(a_i) \Delta =
\sum_{i=0}^{N-1} f(a + (i + \frac{1}{2}) \Delta) \Delta\end{displaymath}


Example

Approximate $\int_1^9 x^2 dx$ using the midpoint rule and $N = 4$ subdivisions.


Solution

\begin{eqnarray*}
M & = & \sum_{i = 0}^{3} (1 + ( (i + \frac{1}{2})2 ))^2 2 \\
...
...2 + 6^2 + 8^2) 2 \\
& = & (4 + 16 + 36 + 64) 2 \\
& = & 240
\end{eqnarray*}


Trapezoidal rule

Rather than approximating the area bounded by a function by rectangles, one may use other shapes. For example, one may use trapezoids. The area of the trapezoid with corners at $(a,0)$, $(b,0)$, $(a,f(a))$, and $(b,f(b))$ is $\frac{1}{2} (f(a) + f(b)) (b-a)$.

The trapezoidal approximation to $\int_a^b f(x) dx$ with $N$ subdivisions is


\begin{displaymath}T = \sum_{i=0}^{N-1} \frac{1}{2} (f(x_i) + f(x_{i+1})) \Delta\end{displaymath}

where $\Delta = \frac{b-a}{N}$ and $x_i = a + i \Delta$.


Example

Compute the trapezoidal approximation to $\int_1^9 x^2 dx$ with $4$ subdivisions.


Solution

\begin{eqnarray*}
T & = & \sum_{i=0}^3 \frac{1}{2} ( (1 + i 2)^2 + (1 + (i+1)2)^...
...2 \\
& = & (1 + 9 + 9 + 25 + 25 + 49 + 49 + 81) \\
& = & 248
\end{eqnarray*}


Other formulae for the trapezoidal rule

\begin{eqnarray*}
T & = & \sum_{i=0}^{N-1} \frac{1}{2} (f(x_i) + f(x_{i+1}) \Del...
...um_{i=0}^{N-1} f(x_{i+1}) \Delta)] \\
& = & \frac{1}{2} [L + R]
\end{eqnarray*}


Another formula for $T$

\begin{eqnarray*}
T & = & \sum_{i=0}^{N-1} \frac{1}{2} (f(x_i) + f(x_{i+1}) ) \D...
...rac{1}{2} [f(x_0) + 2 (\sum_{i=1}^{N-1} f(x_i)) + f(x_N)] \Delta
\end{eqnarray*}


Simpson's Rule

Simpson's rule for approximating integrals is based on approximating $\int_{x_i}^{x_{i+1}} f(x) dx$ by the area bounded by the parabola passing through $(x_i,f(x_i))$, $(\frac{x_i + x_{i+1}}{2}, f(\frac{x_i + x_{i+1}}{2}))$, and $(x_{i+1}, f(x_{i+1}))$.

Rather than deriving Simpson's rule from its geometric description, we write the Simpson's rule approximation in terms of the midpoint and trapezoidal approximations.


\begin{displaymath}S = \frac{2}{3} M + \frac{1}{3} T\end{displaymath}


Another formula for Simpson's rule

Directly,

\begin{eqnarray*}
S & = & \frac{1}{6} [f(a) + 4 f(a + \frac{1}{2} \Delta) + 2 f(...
... \\
& & + 2 (\sum_{i=1}^{N-1} f(a + i \Delta)) + f(b)] \Delta
\end{eqnarray*}


Example

Compute the Simpson's rule approximation to $\int_1^9 x^2 dx$ with $N = 4$ subdivisions.


Solution

\begin{eqnarray*}
S & = & \frac{1}{6} [1^2 + 4 (2^2 + 4^2 + 6^2 + 8^2) \\
& & ...
...66 + 81] \\
& = & \frac{1}{3} [656] \\
& = & 242 \frac{2}{3}
\end{eqnarray*}


Comparison

The exact value of $\int_1^9 x^2 = \frac{1}{3} x^3 \vert_{1}^9 =
\frac{1}{3}[9^3 - 1^3] = \frac{728}{3} = 242 \frac{2}{3}$.

Approximations for $N = 4$.

Left $168$
Midpoint rule $240$
Simpson's rule $242 \frac{2}{3}$
Exact value $242 \frac{2}{3}$
Trapezoidal rule $248$
Right $328$


Error Analysis

The error of an approximation $\alpha$ is the absolute value of the difference between $\alpha$ and the exact value of the itegral.


Example

How many subdivisions do we need to guarantee that a midpoint approximation to $\int_1^2 \frac{dx}{x}$ approximates $\ln(2)$ to two decimal points.


Solution

We need to have an error of less than $0.005$. So, we want

\begin{displaymath}0.005 > \frac{A(2-1)^2}{24 N^2}\end{displaymath}

where $A = \max \{ \vert f''(x)\vert \vert  1 \leq x \leq 2 \}$.

We compute $f'(x) = -x^{-2}$ and $f''(x) = 2 x^{-3}$. This function is decreasing between $1$ and $2$. So, $A = 2$. So, we want $N^2 > \frac{2 \times 200}{24}
= 16 \frac{2}{3}$. Thus, $N = 5$ suffices.

We compute

\begin{eqnarray*}
\ln(2) & = & \int_1^2 \frac{1}{x} dx \\
& \approx & (1/(1.1)...
.../(1.3) + 1/(1.5) + 1/(1.7) + 1/(1.9)) .2 \\
& = & 0.6919\ldots
\end{eqnarray*}




next up previous
Next: About this document ...
Thomas Scanlon 2004-03-08