Left Endpoint, Right Endpoint and Midpoint Rules
There are two possible situation when we need numerical approximation:
- To calculate `int_a^bf(x)dx` we need to know antiderivative of `f(x)`. In some cases, it is difficult, or even impossible to find antiderivative. For example, `int_1^3 (sin(x))/xdx` and `int_1^2 sqrt(u^3+1)du` can't be found exactly.
- The function is determined from a scientific experiment through instrument readings or collected data. There may be no formula for the function.
Actually we already made approximations when we introduced Definite Integral. We approximated area under curve by dividing interval into `n` subintervals, where i-th subinterval is `[x_(i-1),x_i]` and calculate sum of areas of `n` rectangles. Then we said that when `n->oo` then sum of areas of those rectangles is `int_a^bf(x)dx` :
`int_a^b f(x)dx=lim_(n->oo)sum_(i=1)^nf(x_i^(**))Delta x` , where `Delta x=(b-a)/n` and `x_i^(**)` lies in interval `[x_(i-1),x_i]`.
This gives us ability to approximate definite integral: `int_a^b f(x)dx~~sum_(i=1)^nf(x_i^(**))Delta x`.
If we choose `x_i^(**)` to be left endpoint `x_(i-1)` of interval `[x_(i-1),x_i]` then this approximation is called Left Endpoint Approximation: `int_a^bf(x)dx~~L_n=sum_(i=1)^(n)f(x_(i-1))Delta x`.
If we choose `x_i^(**)` to be right endpoint `x_i` of interval `[x_(i-1),x_i]` then this approximation is called Right Endpoint Approximation: `int_a^bf(x)dx~~R_n=sum_(i=1)^(n)f(x_i)Delta x`.
If we choose `x_i^(**)` to be midpoint of interval `[x_(i-1),x_i]` , i.e. `x_i^(**)=1/2(x_(i-1)+x_i)` then this approximation is called Midpoint Rule Approximation: `int_a^bf(x)dx~~M_n=sum_(i=1)^(n)f(1/2(x_(i-1)+x_i))Delta x`.
Example. Approximate `I=int_1^2 1/x^2 dx` using above three methods with `n=5`.
We have `f(x)=1/x` , `a=1`, `b=2`, `n=5`, so `Delta x=(b-a)/n=(2-1)/5=0.2`.
Interval is divided into `n=5` subintervals: `[1,1.2]`, `[1.2,1.4]`, `[1.4,1.6]`, `[1.6,1.8]` and `[1.8,2]`.
Left endpoint approximation gives (left endpoints of intervals are 1, 1.2, 1.4, 1.6, 1.8)
Right endpoint approximation gives (right endpoints of intervals are 1.2, 1.4, 1.6, 1.8, 2)
Midpoint approximation gives
We deliberately chose integral that can be integrated directly to compare true value with approximations.
True value of integral is `I=int_1^2 1/x^2dx=-1/x|_1^2=-(1/2-1/1)=1/2=0.5`.
As can be seen midpoint rule gave better approximation then endpoint approximations.
We will get more accurate approximations when we increase the value of `n`. (But very large values result in so many arithmetic operations that we have to beware of accumulated round-off error).
As can be seen errors in the left and right endpoint approximations are opposite in sign.
Also, left endpoint approximation overestimated integral, while two other approximations underestimated it.
- if function `f(x)` is increasing then left endpoint approximation underestimates value of integral, while right endpoint approximation overestimates it.
- If function `f(x)` is decreasing then left endpoint approximation overestimates value of integral, while right endpoint approximation underestimates it.
- If function `f(x)` is concave up then midpoint rule underestimates value of integral, if function `f(x)` is concave down then midpoint rule overestimates value of integral.
When we approximate integral we will always have some error: `E=int_a^bf(x)dx-App` where `App` is approximation and `E` is error.
Error Bound for Midpoint Rule. Suppose `|f''(x)|<=M` for `a<=x<=b` then `|E|<=(M(b-a)^3)/(24n^2)` .
Example. How large should we take `n` in order to guarantee that the Midpoint Rule approximation for `int_1^2 1/x^2 dx` is accurate to within 0.0002?
Here `a=1`, `b=2`, `f(x)=1/x^2`.
Then `f'(x)=-2/x^3` and `f''(x)=6/x^4`.
Therefore `|f''(x)|<=6` for `1<=x<=2`.
Thus, `(6(2-1)^3)/(24n^2)<0.0002` or `n^2>1/(0.0008)`.
Therefore, we should take `n=36` (the closest integer that is greater than 35.36).