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)$) :


$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.

  • $\begingroup$ 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))$. $\endgroup$ Jan 18, 2022 at 17:10
  • $\begingroup$ Thanks, but why $\frac{h^{2}}{24}\int_{a}^{b}f''\left(x\right)dx$ ? What is $h$ ? $\endgroup$
    – trogne
    Jan 18, 2022 at 21:51
  • $\begingroup$ 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. $\endgroup$ Jan 18, 2022 at 22:26
  • $\begingroup$ 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" ? $\endgroup$
    – trogne
    Jan 18, 2022 at 22:45
  • $\begingroup$ Using the formula, I get 2.33... which doesn't make sense to me : desmos.com/calculator/jhjbngdeju (line 15) $\endgroup$
    – trogne
    Jan 18, 2022 at 23:01

1 Answer 1


What you observe happens because your test example is cubic, so that its second derivative is linear. This gives a certain symmetry about the midpoint.

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.

  • $\begingroup$ 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 ! $\endgroup$
    – trogne
    Jan 19, 2022 at 16:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .