Numerical Methods – Derive the Error for the Midpoint Rule

numerical methodsproof-explanation

Problem statement

Let $[a,b]$ be divided into $n$ subintervals by $n+1$ points $x_0 = a, x_1 = a+h , x_2 = a+2h , \dots , x_n = a+nh =b$.

Show that
$$
I- I_M = \frac{1}{24}(b-a)h^2 f''(z)
$$

for some $z \in [a,b]$.

Attempt at solution

$$
I_M = h \sum_{i=0}^{n-1} f\left( a + \left( i + \frac12\right)\right) := h\sum_{i=0}^{n-1}f(x_i)
$$

\begin{align}
I -I_M &= \int_a^b f(x) \mathrm{d}x – h\sum_{i=0}^{n-1}f(x_i)\\
&= \sum_{i=0}^{n-1} \left( \int_{x_i}^{x_{i+1}} f(x) \ \mathrm{d}x – hf(x_i)\right)
\end{align}

Here I am stuck. I know I need to use Taylor's theorem in conjunction with Mean-Value Theorem but I don't know how to proceed.

I suspect that for $x\in [x_i ,x_{i+1}]$ the Taylor expansion is
$$
f(x) = f(x_i) + (x-x_i)f'(x_i) + \frac12 (x-x_i)^2 f''(z_x) \quad \text{for } z_x \in [x_i , x_{i+1}]
$$

but then If I substitute this in the above I get
\begin{align}
&= \sum_{i=0}^{n-1}\left( \int_{x_i}^{x_{i+1}} (f(x_i) + (x-x_i)f'(x_i) + \frac12 (x-x_i)^2 f''(z_x))\mathrm{d}x – hf(x_i)\right)\\
\end{align}

and I don't see what I have accomplished

Does anyone know If I am on the right track and if yes how to continue this derivation ?

Best Answer

You can start by obtaining the rule for a single interval, say \begin{align*} \int_{x_i}^{x_{i+1}} f(x) dx -hf(c_i) &= \int_{x_i}^{x_{i+1}}(f(x)-f(c_i))dx\\ & = \int_{x_i}^{x_{i+1}} \left(f(c_i)+f'(c_i)(x-c_i) + \frac{f''(\xi_i(x))}{2}(x-c_i)^2\;-\;f(c_i)\right) dx\\ & = \frac{f''(\xi_i)}{2}\int_{x_i}^{x_{i+1}}(x-c_i)^2 dx = \frac{f''(\xi_i) h^3}{24} \end{align*}

Now, if you take the sum over the $n$ intervals, you get the error term

$$ \sum_{i=1}^n \frac{f''(\xi_i) h^3}{24} = \frac{h^2(b-a)}{24}\left(\frac 1n \sum_{i=1}^n f''(\xi_i)\right) = \frac{h^2(b-a) f''(\xi)}{24}. $$


Some notes:

  1. I used the mean value theorem for integrals. Since $(x-c_i)^2$ does not change sign, we know that $$ \int_{x_i}^{x_{i+1}} \frac{f''(\xi_i(x))}{2}(x-c_i)^2 dx = \frac{f''(\xi_i)}{2} \int_{x_i}^{x_{i+1}} (x-c_i)^2 dx $$

  2. If we assume the $f\in C^2$, the term $\frac 1n \sum f''(\xi_i)$ is an average of values of $f''$, hence between the minimum and maximum of $f''$. The intermediate value theorem says that it will correspond to $f''(\xi)$, for some $\xi \in (a,b)$.

Related Question