Derivation: composite midpoint

Generalising midpoint to n subintervals by using the centre of each block and summing local errors.

Summing centred rectangles

width hx₀x₁x₂x₃xₙm₀m₁m₂mᵢheights f(m_i)
Each rectangle has width hh and height f(mi)f(m_i).
Expand diagram

Each rectangle has width hh and height f(mi)f(m_i).

Formula for n subintervals
  1. Split [a,b][a,b] with step hh:

    xi=a+ih,h=banx_i=a+ih,\qquad h=\frac{b-a}{n}
  2. The centre of the subinterval [xi,xi+1][x_i,x_{i+1}] is:

    mi=xi+xi+12=a+(i+12)hm_i=\frac{x_i+x_{i+1}}{2}=a+\left(i+\frac12\right)h
  3. Apply simple midpoint on each subinterval:

    Mi=hf(mi)M_i=h f(m_i)
  4. Sum all rectangles:

    Mn=hi=0n1f(mi)M_n=h\sum_{i=0}^{n-1}f(m_i)
  5. Substituting the expression for mim_i gives the computable form:

    Mn=hi=0n1f ⁣(a+(i+12)h)M_n=h\sum_{i=0}^{n-1}f\!\left(a+\left(i+\frac12\right)h\right)
  6. The global error is obtained by summing the local errors of the simple midpoint rule:

    EM=h324i=0n1f(ξi)=ba24h2f(ξ)\begin{aligned}E_M&=\frac{h^3}{24}\sum_{i=0}^{n-1}f''(\xi_i)\\&=\frac{b-a}{24}h^2f''(\xi)\end{aligned}