# Finding formula for error in the basic midpoint rule

I wanted to derive the formula for the error in the basic midpoint rule.

For the error I found $$E(f)= \int_{a}^{b} f[\tfrac{a+b}{2},x](x-\tfrac{a+b}{2})\,dx.$$ I didn't know how to go from here so my teacher gave me the hint that this equals:

$$f[\tfrac{a+b}{2},x]\tfrac{1}{2}(x-a)(x-b) \Big|_{a}^{b}-\int_{a}^{b} \frac{d}{dx}f[\tfrac{a+b}{2},x]\frac{(x-a)(x-b)}{2}dx\tag{*}$$

I managed to find the solution from here, $$E(f)=\frac {f''(\xi)}{24}(b-a)^3,$$ but I don't see how:

$$E(f)= \int_{a}^{b} f[\tfrac{a+b}{2},x](x-\tfrac{a+b}{2})dx= (*)$$

I have tried to make the step in the hint myself, with information from websites like this, but I never got to *.

This is just partial integration $$\int_a^b uv'\,dx = uv\Big|_a^b-\int_a^bu'v\,dx$$ with $u=f[\frac{a+b}2,x]$ and $v=\frac12(x-a)(x-b)$, $v'=x-\frac{a+b}2$.