Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

9.7 Mid-point rule

9.7.1Single interval

The trapezoidal rule approximates the integral as the area below the straight line approximation

∫abf(x)dx≈(b−a)f(a)+f(b)2\int_a^b f(x) \ud x \approx (b-a) \frac{f(a) + f(b)}{2}

Another approximation to the area is to use the function value at the mid-point

∫abf(x)dx≈(b−a)f(a+b2)\int_a^b f(x) \ud x \approx (b-a) f\left( \frac{a+b}{2} \right)

which is the area of the rectangle.

<Figure size 640x480 with 1 Axes>

Let c=(a+b)/2c=(a+b)/2. Using Taylor formula

f(x)=f(c)+(x−c)f′(c)+12(x−c)2f′′(ξx),ξx between x and cf(x) = f(c) + (x-c) f'(c) + \half (x-c)^2 f''(\xi_x), \qquad \textrm{$\xi_x$ between $x$ and $c$}

Integrating both sides

∫abf(x)dx−(b−a)f(a+b2)=12∫ab(x−c)2f′′(ξx)dx\int_a^b f(x) \ud x - (b-a) f\left( \frac{a+b}{2} \right) = \half \int_a^b (x-c)^2 f''(\xi_x) \ud x

Using integral mean value theorem, the error is

∫abf(x)dx−(b−a)f(a+b2)=12f′′(η)∫ab(x−c)2dx=(b−a)324f′′(η),η∈[a,b]\begin{align*} \int_a^b f(x) \ud x - (b-a) f\left( \frac{a+b}{2} \right) &= \half f''(\eta) \int_a^b (x-c)^2 \ud x \\ &= \frac{(b-a)^3}{24} f''(\eta), \qquad \eta \in [a,b] \end{align*}

9.7.2Composite rule

Let us partition [a,b][a,b] into nn intervals each of width h=(b−a)/nh = (b-a)/n. The mid-points of these intervals are

xj=a+(j−12)h,j=0,1,…,n−1x_j = a + (j-\shalf)h, \qquad j=0, 1, \ldots, n-1

The integral is given by

∫abf(x)dx=∑j=1n−1∫xj−1xjf(x)dx=∑j=1n−1hf(xj)+h324∑j=1nf′′(ηj),ηj∈[xj−1,xj]=:In(f)+En(f)\begin{aligned} \int_a^b f(x) \ud x &= \sum_{j=1}^{n-1} \int_{x_{j-1}}^{x_j} f(x) \ud x \\ &= \clr{red}{ \sum_{j=1}^{n-1} h f(x_j) } + \clr{blue}{ \frac{h^3}{24} \sum_{j=1}^n f''(\eta_j)}, \qquad \eta_j \in [x_{j-1}, x_j] \\ &=: \clr{red}{I_n(f)} + \clr{blue}{E_n(f)} \end{aligned}

where

In(x)=h[f0+f1+…+fn−1]I_n(x) = h[f_0 + f_1 + \ldots + f_{n-1}]

and the error is

En(f)=h324∑j=1nf′′(ηj)=nh324[1n∑j=1nf′′(ηj)]=(b−a)h224f′′(η),η∈[a,b]\begin{aligned} E_n(f) &= \frac{h^3}{24} \sum_{j=1}^n f''(\eta_j) = \frac{n h^3}{24} \clr{red}{\left[ \frac{1}{n} \sum_{j=1}^n f''(\eta_j) \right]} \\ &= \frac{(b-a)h^2}{24} \clr{red}{f''(\eta)}, \qquad \eta \in [a,b] \end{aligned}

9.7.3Integral error estimate

Using Taylor formula around x=cx=c with integral remainder term

f(x)=f(c)+(x−c)f′(c)+∫cx(x−t)f′′(t)dtf(x) = f(c) + (x-c)f'(c) + \int_c^x (x-t) f''(t) \ud t

The error in mid-point rule is

∫abf(x)dx−(b−a)f(c)=∫ab∫cx(x−t)f′′(t)dtdx\int_a^b f(x) \ud x - (b-a) f(c) = \int_a^b \int_c^x (x-t) f''(t) \ud t \ud x

By change of order of integration

∫ab∫cx(x−t)f′′(t)dtdx=∫cb∫tb(x−t)f′′(t)dxdt−∫ac∫at(x−t)f′′(t)dxdt=∫cb(b−t)22f′′(t)dt+∫ac(a−t)22f′′(t)dt\begin{aligned} \int_a^b \int_c^x (x-t) f''(t) \ud t \ud x &= \int_c^b \int_t^b (x-t) f''(t) \ud x \ud t - \int_a^c \int_a^t (x-t) f''(t) \ud x \ud t \\ &= \int_c^b \frac{(b-t)^2}{2} f''(t) \ud t + \int_a^c \frac{(a-t)^2}{2} f''(t) \ud t \end{aligned}

Using this estimate, the error of the composite rule is

∣En(f)∣≤h24∫ab∣f′′(t)∣dt|E_n(f)| \le \frac{h^2}{4} \int_a^b |f''(t)| \ud t