# error bound for midpoint rule - exact error

I noticed that I get the exact error, using midpoint rule error bound formula, but with $$f''(\frac{b-a}{2})$$ for $$K$$, i.e. :

$$E_m \leq$$ $$\frac{K(b-a)^3} {24n^2}$$

$$E_{m2} =$$ $$\frac{f''(\frac{b-a}{2} ) (b-a)^3} {24n^2}$$

See my demonstration here (where $$f''(x)$$ is $$i(x)$$) :

https://www.desmos.com/calculator/rsnxcn2yf7

$$E_{m2}$$ is the exact error (line 14).

How to explain why I get exact error that way ?

Of course it must be related to the fact that the second derivative is a line, but I can't find out why.

• You mean the derivative at the midpoint, $f''(\frac{a+b}2)$. For symmetry reasons, the best guess for the unknown point in the mean value theorem is often the midpoint, that's also the reason the midpoint method works so well. Note that you can also write the leading error term as $\frac{h^2}{24}\int_a^bf''(x)dx=\frac{h^2}{24}(f'(b)-f'(a))$. Jan 18, 2022 at 17:10
• Thanks, but why $\frac{h^{2}}{24}\int_{a}^{b}f''\left(x\right)dx$ ? What is $h$ ? Jan 18, 2022 at 21:51
• I used the step size $h=(b-a)/b$. In the subdivision of the composite method, the sum of the errors of the segments can be seen as a Riemann sum. Jan 18, 2022 at 22:26
• Well, $\frac{\left(\frac{\left(b-a\right)}{b}\right)^{2}}{24}\int_{a}^{b}f''\left(x\right)dx$ ... I still don't get it. And what do you mean by "subdivision of the composite method" ? Jan 18, 2022 at 22:45
• Using the formula, I get 2.33... which doesn't make sense to me : desmos.com/calculator/jhjbngdeju (line 15) Jan 18, 2022 at 23:01

To highlight this, consider that the integral value over $$[0,a]$$ is the same as the one for the symmetrized function $$f_e(x)=\frac12(f(x)+f(a-x)).$$ For this modified function the second derivative is a constant, the linear contributions of both terms in it are complementary. This constant has the value $$f_e''(x)=f_e''(a/2)=f''(a/2),$$ so that indeed all the error formulas are correct when inserting this value.
• Fantastic! Thank you so much. So, the symmetrized version of the function makes all of that clear. Since $f_{e}''\left(x\right)$ is constant, the error bound formula always give the exact error. Excellent ! Jan 19, 2022 at 16:26