Topic 8

Numerical Integration: Midpoint, Trapezoidal & Simpson's Rules

Each rule cuts [a,b][a, b] into nn of width Δx=b−an\Delta x = \dfrac{b-a}{n}. Then it swaps ff for simple shapes: flat tops (midpoint), straight lines (trapezoidal) or parabolas (Simpson's, nn even). An says how far off you can be. Solve it for nn to find how many pieces you need.

5 kinds of question. Open the one you are stuck on.

1

Approximate an integral using the midpoint rule

e.g. “Find the midpoint rule approximation to ∫abf(x) dx\displaystyle\int_a^b f(x)\,dx with n=…n = \dots”
  1. 1
    Find Δx=b−an\Delta x = \dfrac{b-a}{n}
  2. 2
    List the nn midpoints

    xˉj=a+(j−12)Δx\bar{x}_j = a + \left(j - \tfrac{1}{2}\right)\Delta x: the center of the jjth piece.

  3. 3
    Add ff at the midpoints and multiply by Δx\Delta x

Remember: Middle of each piece, times the width.

See it in a problem3 worked examples

Find the midpoint rule approximation to ∫131x dx\displaystyle\int_1^3 \frac{1}{x}\,dx with n=2n = 2.

  1. 1
    Find Δx=b−an\Delta x = \dfrac{b-a}{n}

    Δx=3−12=1\Delta x = \dfrac{3 - 1}{2} = 1.

  2. 2
    List the nn midpoints

    Midpoints: 1.51.5 and 2.52.5.

  3. 3
    Add ff at the midpoints and multiply by Δx\Delta x

    M2=1(23+25)=1615M_2 = 1\left(\dfrac{2}{3} + \dfrac{2}{5}\right) = \dfrac{16}{15}.

Answer:

M2=1615≈1.067M_2 = \dfrac{16}{15} \approx 1.067

Common mistakes2
  • Using endpoints. Midpoints never include aa or bb.
  • From a table, you need readings at the midpoints, so nn is half the number of gaps in the table.
2

Approximate an integral using the trapezoidal rule

e.g. “Use the trapezoidal rule with n=…n = \dots to estimate ∫abf(x) dx\displaystyle\int_a^b f(x)\,dx”
  1. 1
    Find Δx=b−an\Delta x = \dfrac{b-a}{n}
  2. 2
    List the values f(x0),f(x1),…,f(xn)f(x_0), f(x_1), \dots, f(x_n)

    n+1n + 1 values, from x0=ax_0 = a to xn=bx_n = b. From a table, these are the readings.

  3. 3
    Weight the ends 12\tfrac{1}{2}, the rest 11, add, then multiply by Δx\Delta x

Remember: Halve the ends, add, times the width.

See it in a problem3 worked examples

Use the trapezoidal rule with n=4n = 4 to estimate ∫131x dx\displaystyle\int_1^3 \frac{1}{x}\,dx.

  1. 1
    Find Δx=b−an\Delta x = \dfrac{b-a}{n}

    Δx=12\Delta x = \dfrac{1}{2}.

  2. 2
    List the values f(x0),f(x1),…,f(xn)f(x_0), f(x_1), \dots, f(x_n)

    At x=1,1.5,2,2.5,3x = 1, 1.5, 2, 2.5, 3:  1, 23, 12, 25, 13\ 1,\ \tfrac{2}{3},\ \tfrac{1}{2},\ \tfrac{2}{5},\ \tfrac{1}{3}.

  3. 3
    Weight the ends 12\tfrac{1}{2}, the rest 11, add, then multiply by Δx\Delta x

    T4=12[12(1)+23+12+25+12(13)]=12⋅6730=6760T_4 = \dfrac{1}{2}\left[\tfrac{1}{2}(1) + \tfrac{2}{3} + \tfrac{1}{2} + \tfrac{2}{5} + \tfrac{1}{2}\left(\tfrac{1}{3}\right)\right] = \dfrac{1}{2}\cdot\dfrac{67}{30} = \dfrac{67}{60}.

Answer:

T4=6760≈1.117T_4 = \dfrac{67}{60} \approx 1.117

Common mistakes3
  • Giving the end values full weight. Only the inside values count fully.
  • For a volume from diameters, integrate the area A=π(d2)2A = \pi\left(\tfrac{d}{2}\right)^2, not the diameter. From a circumference CC: A=C24πA = \dfrac{C^2}{4\pi}.
  • Concave up (f′′>0f'' > 0) on all of [a,b][a, b]: the trapezoids sit above the curve, so TnT_n is an overestimate. Concave down: an underestimate.
3

Approximate an integral using Simpson's rule

e.g. “Use Simpson's rule with n=…n = \dots to approximate ∫abf(x) dx\displaystyle\int_a^b f(x)\,dx”
  1. 1
    Check nn is even; find Δx=b−an\Delta x = \dfrac{b-a}{n}
  2. 2
    List the values f(x0),…,f(xn)f(x_0), \dots, f(x_n)
  3. 3
    Weight them 1,4,2,4,…,2,4,11, 4, 2, 4, \dots, 2, 4, 1 and add
  4. 4
    Multiply by Δx3\dfrac{\Delta x}{3}

Remember: 1, 4, 2, 4, …, 4, 1, then times a third of the width.

See it in a problem3 worked examples

Use Simpson's rule with n=2n = 2 to approximate ∫02x3 dx\displaystyle\int_0^2 x^3\,dx.

  1. 1
    Check nn is even; find Δx=b−an\Delta x = \dfrac{b-a}{n}

    n=2n = 2 is even; Δx=1\Delta x = 1.

  2. 2
    List the values f(x0),…,f(xn)f(x_0), \dots, f(x_n)

    At x=0,1,2x = 0, 1, 2:  0, 1, 8\ 0,\ 1,\ 8.

  3. 3
    Weight them 1,4,2,4,…,2,4,11, 4, 2, 4, \dots, 2, 4, 1 and add

    0+4(1)+8=120 + 4(1) + 8 = 12.

  4. 4
    Multiply by Δx3\dfrac{\Delta x}{3}

    S2=13(12)=4S_2 = \dfrac{1}{3}(12) = 4, exactly ∫02x3 dx\displaystyle\int_0^2 x^3\,dx.

Answer:

S2=4S_2 = 4, the exact value: Simpson's rule is exact for polynomials of degree at most 33.

Common mistakes3
  • Using an odd nn. Simpson's rule needs an even number of pieces.
  • Multiplying by Δx\Delta x instead of Δx3\dfrac{\Delta x}{3}.
  • Breaking the pattern: the values next to each end always get weight 44.
4

Find the error bound for the midpoint, trapezoidal or Simpson's rule

e.g. “Find a bound for the error in approximating ∫abf(x) dx\displaystyle\int_a^b f(x)\,dx using Simpson's rule with n=…n = \dots”
  1. 1
    Pick the bound for your rule

    ∣EM∣≤M(b−a)324n2|E_M| \le \dfrac{M(b-a)^3}{24n^2},  ∣ET∣≤M(b−a)312n2\ |E_T| \le \dfrac{M(b-a)^3}{12n^2},  ∣ES∣≤L(b−a)5180n4\ |E_S| \le \dfrac{L(b-a)^5}{180n^4}. The question usually gives these.

  2. 2
    Differentiate: f′′f'' for midpoint or trapezoidal, f(4)f^{(4)} for Simpson's
  3. 3
    Find M≥∣f′′∣M \ge |f''| (or L≥∣f(4)∣L \ge |f^{(4)}|) on all of [a,b][a, b]

    Use ∣sin⁡x∣,∣cos⁡x∣≤1|\sin x|, |\cos x| \le 1 and the . If ∣f′′∣|f''| only goes up or only goes down, check the endpoints. Any true upper bound is fine. Smaller is better.

  4. 4
    Plug in and simplify

Remember: Formula, derivative, bound it, plug in.

See it in a problem3 worked examples

Find a bound for the error in approximating ∫02e−x dx\displaystyle\int_0^2 e^{-x}\,dx using Simpson's rule with n=4n = 4.

  1. 1
    Pick the bound for your rule

    ∣ES∣≤L(b−a)5180n4|E_S| \le \dfrac{L(b-a)^5}{180n^4}.

  2. 2
    Differentiate: f′′f'' for midpoint or trapezoidal, f(4)f^{(4)} for Simpson's

    f(4)(x)=e−xf^{(4)}(x) = e^{-x}.

  3. 3
    Find M≥∣f′′∣M \ge |f''| (or L≥∣f(4)∣L \ge |f^{(4)}|) on all of [a,b][a, b]

    e−xe^{-x} is decreasing, so ∣f(4)(x)∣≤e0=1|f^{(4)}(x)| \le e^{0} = 1 on [0,2][0, 2]:  L=1\ L = 1.

  4. 4
    Plug in and simplify

    ∣ES∣≤1⋅25180⋅44=3246080=11440|E_S| \le \dfrac{1 \cdot 2^5}{180 \cdot 4^4} = \dfrac{32}{46080} = \dfrac{1}{1440}.

Answer:

∣ES∣≤11440≈0.00069|E_S| \le \dfrac{1}{1440} \approx 0.00069

Common mistakes3
  • Bounding f′′f'' at one point. MM must work for every xx in [a,b][a, b].
  • Using f′′f'' for Simpson's rule. It needs the fourth derivative.
  • Thinking the two forms differ: L(b−a)180(Δx)4\dfrac{L(b-a)}{180}(\Delta x)^4 is the same bound as L(b−a)5180n4\dfrac{L(b-a)^5}{180n^4}.
5

Find how many subintervals n guarantee a given accuracy

e.g. “How many subintervals are required to guarantee that the absolute error is less than …?”
  1. 1
    Find MM (or LL) on [a,b][a, b], as for an error bound
  2. 2
    Set the error bound less than or equal to the tolerance

    "Five decimal places" means error ≤0.000005\le 0.000005.

  3. 3
    Solve for nn
  4. 4
    Round up to a whole number; even, for Simpson's

Remember: Bound, inequality, solve, round up.

See it in a problem3 worked examples

How many subintervals guarantee the trapezoidal rule approximates ∫14x dx\displaystyle\int_1^4 \sqrt{x}\,dx with error at most 0.00050.0005?

  1. 1
    Find MM (or LL) on [a,b][a, b], as for an error bound

    f′′(x)=−14x−3/2f''(x) = -\tfrac{1}{4}x^{-3/2}, largest in size at x=1x = 1:  M=14\ M = \tfrac{1}{4}.

  2. 2
    Set the error bound less than or equal to the tolerance

    14(3)312n2≤0.0005\dfrac{\tfrac{1}{4}(3)^3}{12n^2} \le 0.0005.

  3. 3
    Solve for nn

    n2≥2748×0.0005=1125n^2 \ge \dfrac{27}{48 \times 0.0005} = 1125, so n≥33.54n \ge 33.54.

  4. 4
    Round up to a whole number; even, for Simpson's

    n=34n = 34.

Answer:

n=34n = 34 (any n≥34n \ge 34 works)

Common mistakes3
  • Rounding down. n≥28.28n \ge 28.28 means n=29n = 29.
  • Forgetting Simpson's nn must be even: n≥20.53n \ge 20.53 means n=22n = 22.
  • Working out f′′f'' yourself when ∣f′′∣≤M|f''| \le M is given. Use the MM you are given.

Need the formulas? Must memorize · Flashcards

Found this helpful? Leave us a review on Google ↗Spotted a mistake?

Which topics are you reviewing?

The topic list, Flashcards, Must memorize and Exam words will only show these. Change it any time with the Topics button above the topic list.

The integral
Techniques of integration
Applications
Sequences & series
7 of 20 topics selected