Midpoint Rule

Summary

The composite midpoint rule approximates ∫abf(x)dx by summing rectangle areas with heights evaluated at subinterval midpoints. It is a second-order method for smooth integrands.

Prerequisites

Problem Type

Approximate I=∫abf(x)dx from samples of f .

Method Definition

Partition [a,b] into n equal parts of width h=(b−a)/n . On [xi−1,xi] with midpoint mi=xi−1+h/2 ,

∫xi−1xif(x)dx≈hf(mi).

Composite rule:[1]

∫abf(x)dx≈h∑i=1nf(a+(i−12)h).

Assumptions / Requirements

Algorithm

  1. Choose n , set h=(b−a)/n .
  2. Sum hf(a+(i−1/2)h) for i=1,…,n .

Error / Accuracy

If |f″(x)|≤M on [a,b] , the composite midpoint error satisfies

|E|≤(b−a)24h2M=(b−a)324n2M.

Order O(h2) , same order as the composite trapezoidal rule (with a smaller constant for many f ).

Worked Example

Approximate ∫01x2dx=1/3 with n=2 ( h=1/2 ).

Midpoints: 1/4 , 3/4 .

I≈12((1/4)2+(3/4)2)=12(116+916)=516=0.3125.

Error |1/3−5/16|=1/48≈0.0208 . Bound with f″=2 , M=2 :

(1)324⋅4⋅2=148,

sharp on this example.

Common Failure Modes

Connections

References


  1. Burden & Faires, Numerical Analysis, midpoint / rectangle rules; NIST DLMF Ch. 3, https://dlmf.nist.gov/3 ↩︎