Skip to article frontmatterSkip to article content

Mid-point rule

1Single interval

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

abf(x)dx(ba)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(ba)f(a+b2)\int_a^b f(x) \ud x \approx (b-a) f\left( \frac{a+b}{2} \right)

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

f(x)=f(c)+(xc)f(c)+12(xc)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(ba)f(a+b2)=12ab(xc)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(ba)f(a+b2)=12f(η)ab(xc)2dx=(ba)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*}

2Composite rule

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

xj=a+(j12)h,j=0,1,,n1x_j = a + (j-\shalf)h, \qquad j=0, 1, \ldots, n-1

The integral is given by

abf(x)dx=j=1n1xj1xjf(x)dx=j=1n1hf(xj)+h324j=1nf(ηj),ηj[xj1,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 \\ &= \sum_{j=1}^{n-1} h f(x_j) + \frac{h^3}{24} \sum_{j=1}^n f''(\eta_j), \qquad \eta_j \in [x_{j-1}, x_j] \\ &= I_n(f) + E_n(f) \end{aligned}

where

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

and the error is

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

3Integral error estimate

Using Taylor formula with integral remainder term

f(x)=f(c)+(xc)f(c)+cx(xt)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(ba)f(c)=abcx(xt)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

abcx(xt)f(t)dtdx=cbtb(xt)f(t)dxdtacat(xt)f(t)dxdt=cb(bt)22f(t)dt+ac(at)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)h44abf(t)dt|E_n(f)| \le \frac{h^4}{4} \int_a^b |f''(t)| \ud t

This error is more than that of trapezoidal rule, which seems strange.