0:00 / 0:00

The Midpoint Rule

We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a left or right hand approximation, we can place our rectangles so the function touches the midpoint of the rectangle.


Midpoint Rule

abf(x)dx i=1nf(xi)Δx=Δx(f(x1)+f(x2)+f(x3)+...+f(xn1)+f(xn))\boxed{\displaystyle \int_a^bf\left(x\right)dx\ \approx\sum_{i=1}^nf\left(\overline{x_i}\right)\Delta x=\Delta x\left(f\left(\overline{x_1}\right)+f\left(\overline{x_2}\right)+f\left(\overline{x_3}\right)+...+f\left(\overline{x_{n-1}}\right)+f\left(\overline{x_n}\right)\right)}

where Δx=ban,  xi=a+iΔx,  xi=xi1+xi2\displaystyle \Delta x=\frac{b-a}{n}, \ \ x_i=a+i\Delta x , \ \ \overline{x_i}=\frac{x_{i-1}+x_i}{2} and nn is the number of subintervals.

0:00 / 0:00

Example: The Midpoint Rule

Use the midpoint approximation for

04ex2dx\displaystyle \int_0^4e^{x^2}dx

using 4 sub intervals.


abf(x)dx i=1nf(xi)Δx=Δx(f(x1)+f(x2)+f(x3)+...+f(xn1)+f(xn))\displaystyle \int_a^bf\left(x\right)dx\ \approx\sum_{i=1}^nf\left(\overline{x_i}\right)\Delta x=\Delta x\left(f\left(\overline{x_1}\right)+f\left(\overline{x_2}\right)+f\left(\overline{x_3}\right)+...+f\left(\overline{x_{n-1}}\right)+f\left(\overline{x_n}\right)\right)


Δx=ban=404=1\displaystyle \Delta x=\frac{b-a}{n}=\frac{4-0}{4}=1

04ex2dx1(f(.5)+f(1.5)+f(2.5)+f(3.5)) =(e.52+e1.52+e2.52+e3.52)\displaystyle \int_0^4e^{x^2}dx\approx1\left(f\left(.5\right)+f\left(1.5\right)+f\left(2.5\right)+f\left(3.5\right)\right)\ =\left(e^{.5^2}+e^{1.5^2}+e^{2.5^2}+e^{3.5^2}\right)

=(e.25+e2.25+e6.25+e12.25)=\left(e^{.25}+e^{2.25}+e^{6.25}+e^{12.25}\right)
0:00 / 0:00

The Trapezoidal Rule

We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a rectangle approximation, we can place trapezoids on the graph to approximate area.



Trapezoid Rule

abf(x)dx i=1nf(xi1)+f(xi)2=Δx2(f(x0)+2f(x1)+2f(x2)+...+2f(xn1)+f(xn))\boxed{\int_a^bf\left(x\right)dx\ \approx\sum_{i=1}^n\frac{f\left(x_{i-1}\right)+f\left(x_i\right)}{2}=\frac{\Delta x}{2}\left(f\left(x_0\right)+2f\left(x_1\right)+2f\left(x_2\right)+...+2f\left(x_{n-1}\right)+f\left(x_n\right)\right)}

where Δx=ban,  xi=a+iΔx\displaystyle \Delta x=\frac{b-a}{n} , \ \ x_i=a+i\Delta x , and nn is the number of subintervals.

0:00 / 0:00

Example: The Trapezoid Rule

Use a trapezoid approximation for

04ex2dx\displaystyle \int_0^4e^{x^2}dx

using 4 sub intervals.


abf(x)dx i=1nf(xi1)+f(xi)2=Δx2(f(x0)+2f(x1)+2f(x2)+...+2f(xn1)+f(xn))\displaystyle \int_a^bf\left(x\right)dx\ \approx\sum_{i=1}^n\frac{f\left(x_{i-1}\right)+f\left(x_i\right)}{2}=\frac{\Delta x}{2}\left(f\left(x_0\right)+2f\left(x_1\right)+2f\left(x_2\right)+...+2f\left(x_{n-1}\right)+f\left(x_n\right)\right)


Δx=ban=404=1\displaystyle \Delta x=\frac{b-a}{n}=\frac{4-0}{4}=1

04ex2dx12(f(0)+2f(1)+2f(2)+2f(3)+f(4)) =12(e02+2e12+2e22+2e32+e42)\displaystyle \int_0^4e^{x^2}dx\approx\frac{1}{2}\left(f\left(0\right)+2f\left(1\right)+2f\left(2\right)+2f\left(3\right)+f\left(4\right)\right)\ =\frac{1}{2}\left(e^{0^2}+2e^{1^2}+2e^{2^2}+2e^{3^2}+e^{4^2}\right)

=12(1+2e+2e4+2e9+e16)\displaystyle =\frac{1}{2}\left(1+2e+2e^4+2e^9+e^{16}\right)
Which of the following is the integral approximation of
13cos(x3)dx\int_1^3 \cos (x^3)dx
using the trapezoid rule with n=3n=3?
0:00 / 0:00

Simpson's Rule

We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a rectangle approximation, we can place quadratics on the graph to approximate area.

Simpson's Rule Approximation

abf(x)dx Δx3(f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+...+4f(xn1)+f(xn))\boxed{\displaystyle \int_a^bf\left(x\right)dx\ \approx\frac{\Delta x}{3}\left(f\left(x_0\right)+4f\left(x_1\right)+2f\left(x_2\right)+4f\left(x_3\right)+2f\left(x_4\right)+...+4f\left(x_{n-1}\right)+f\left(x_n\right)\right)}

where Δx=ban,  xi=a+iΔx\displaystyle\Delta x=\frac{b-a}{n}, \ \ x_i=a+i\Delta x, and nn is the number of subintervals.

0:00 / 0:00

Example: Simpson's Rule

Use a Simpson's Rule approximation for

04ex2dx\displaystyle \int_0^4e^{x^2}dx

using 4 sub intervals.


abf(x)dx Δx3(f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+...+4f(xn1)+f(xn))\displaystyle \int_a^bf\left(x\right)dx\ \approx\frac{\Delta x}{3}\left(f\left(x_0\right)+4f\left(x_1\right)+2f\left(x_2\right)+4f\left(x_3\right)+2f\left(x_4\right)+...+4f\left(x_{n-1}\right)+f\left(x_n\right)\right)


Δx=ban=404=1\displaystyle \Delta x=\frac{b-a}{n}=\frac{4-0}{4}=1

04ex2dx13(f(0)+4f(1)+2f(2)+4f(3)+f(4)) =13(e02+4e12+2e22+4e32+e42)\displaystyle \int_0^4e^{x^2}dx\approx\frac{1}{3}\left(f\left(0\right)+4f\left(1\right)+2f\left(2\right)+4f\left(3\right)+f\left(4\right)\right)\ =\frac{1}{3}\left(e^{0^2}+4e^{1^2}+2e^{2^2}+4e^{3^2}+e^{4^2}\right)

=13(1+4e+2e4+4e9+e16)=\frac{1}{3}\left(1+4e+2e^4+4e^9+e^{16}\right)
Using the Simpson's rule with n=4n=4, find the integral approximation of

04x2dx\displaystyle \int_0^4 x^2 dx.

0:00 / 0:00

Error of Integral Approximations

Approximations aren't perfect - however, we are able to bound the error on them. By increasing nn (the number of rectangles) we can reduce the error created by our area approximations

Error for the Midpoint Approximation

Suppose f(x)<K2|f''\left(x\right)|<K_2 for axba\le x\le b. Then the error using a definite integral Midpoint approximation is

EN=MNActual|E_N|=|M_N-\text{Actual}|
and the error can be bounded by

EN<K2(ba)324n2\boxed{|E_N|<\frac{K_2\left(b-a\right)^3}{24n^2}}


PAGE BREAK

Error for the Trapezoid Approximation

Suppose f(x)<K2|f''\left(x\right)|<K_2for axba\le x\le b. Then the Error using a definite integral Trapezoid approximation is

EN=TNActual|E_N|=|T_N-\text{Actual}|
and the error can be bounded by

EN<K2(ba)312n2\boxed{|E_N|<\frac{K_2\left(b-a\right)^3}{12n^2}}

Error for the Simpson's Approximation

Suppose f(4)(x)<K4|f^{(4)}\left(x\right)|<K_4 for axba\le x\le b. Then the Error using a definite integral Simpson's approximation is
EN=SNActual|E_N|=|S_N-\text{Actual}|
and the error can be bounded by

EN<K4(ba)5180n4\boxed{|E_N|<\frac{K_4\left(b-a\right)^5}{180n^4}}

How large does n have to be to guarantee that the integral approximation of 02x5dx\displaystyle \int_0^2x^5dx
using the Midpoint rule is accurate to within 0.0001?

Approximate Integration

Sometimes it's impossible to calculate the exact value of a definite integral. Instead, we can approximate the value by treating it like the area underneath a curve and follow these steps:
  1. We divide the area under the curve into equal width shapes like rectangles or trapezoids
  2. We calculate the area of each of these "nice shapes"
  3. We add up all of these areas to get the approximate total area (i.e. approximate value of the definite integral)


Wize Tip
The question will usually tell you
  • the function f(x)f\left(x\right)
  • the bounds of the integral x=a, x=bx=a,\ x=b
  • the nn value (the number of shapes we are dividing the area into)
  • which rule we should use for our approximation

PAGE BREAK
Rule 1: Left Endpoint Approximation
Ln=i=1nf(xi1)Δx=Δx[f(x0)+f(x1)+...+f(xn1)]\displaystyle L_n=\sum_{i=1}^nf\left(x_{i-1}\right)\Delta x=\Delta x[f(x_0)+f(x_1)+...+f(x_{n-1})]
  • Δx=ban\Delta x=\frac{b-a}{n}
  • xi=a+iΔxx_{i}=a+i\Delta x

Rule 2: Right Endpoint Approximation
Rn=i=1nf(xi)Δx=Δx[f(x1)+f(x2)+...+f(xn)]\displaystyle R_n=\sum_{i=1}^nf\left(x_{i}\right)\Delta x=\Delta x[f(x_1)+f(x_2)+...+f(x_{n})]
  • Δx=ban\Delta x=\frac{b-a}{n}
  • xi=a+iΔxx_{i}=a+i\Delta x

Rule 3: Midpoint Rule Approximation
Mn=i=1nf(xi)Δx=Δx[f(x1)+f(x2)+...+f(xn)]\displaystyle M_n=\sum_{i=1}^nf\left(\overline{ x_i}\right)\Delta x=\Delta x[f(\overline {x_1})+f(\overline {x_2})+...+f(\overline{x_n})]
  • Δx=ban\Delta x=\frac{b-a}{n}
  • xi=12(xi1+xi)\overline{x_{i}}=\frac{1}{2}(x_{i-1}+x_i) (the midpoint of [xi1,xi][x_{i-1},x_i]

Rule 4: Trapezoidal Rule Approximation
Tn=Δx2[f(x0)+2f(x1)+2f(x2)+...+2f(xn1)+f(xn)]\displaystyle T_n=\frac{\Delta x}{2}\left[f\left(x_0\right)+2f\left(x_1\right)+2f\left(x_2\right)+...+2f\left(x_{n-1}\right)+f\left(x_n\right)\right]
  • Δx=ban\Delta x=\frac{b-a}{n}
  • xi=a+iΔxx_{i}=a+i\Delta x
Rule 5: SImpson's Rule Approximation
Sn=Δx3[f(x0)+4f(x1)+2f(x2)+4f(x3)+...+2f(xn2)+4f(xn1)+f(xn)]\displaystyle S_n=\frac{\Delta x}{3}\left[f\left(x_0\right)+4f\left(x_1\right)+2f\left(x_2\right)+4f\left(x_3\right)+...+2f\left(x_{n-2}\right)+4f\left(x_{n-1}\right)+f\left(x_n\right)\right]
  • nn must be even
  • Δx=ban\Delta x=\frac{b-a}{n}
  • xi=a+iΔxx_{i}=a+i\Delta x
PAGE BREAK
Error Bounds for Trapezoidal & Midpoint Rule Approximations

If f(x)K\displaystyle \left|f''\left(x\right)\right|\le K then ETK(ba)312n2\displaystyle \left|E_T\right|\le\frac{K\left(b-a\right)^3}{12n^2} and EMK(ba)324n2\displaystyle \left|E_M\right|\le\frac{K\left(b-a\right)^3}{24n^2}
  • This means that if we can find an upper and lower bound for the second derivative of the function, then we can calculate an error bound (upper and lower bound) for our Trapezoidal and Midpoint rule approximation
Error Bounds for Simpson's Rule Approximations
If f(4)(x)K\displaystyle \left|f^{(4)}\left(x\right)\right|\le K then ESK(ba)5180n4\displaystyle \left|E_S\right|\le\frac{K\left(b-a\right)^5}{180n^4}
  • This means that if we can find an upper and lower bound for the fourth derivative of the function, then we can calculate an error bound (upper and lower bound) for our Simpson's rule approximation