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$.
Then with $$ \frac{d}{dx}f[m,x]=\lim_{h\to 0}f[m,x,x+h]=f[m,x,x]=\frac12f''(\xi), $$ $m=\frac{a+b}2$ it follows that \begin{align} E(f)&=\int_a^bf(x)\,dx-f(m)(b-a)=\int_a^b(f(x)-f(m))\,dx \\ &=\int_a^bf[m,x](x-m)\,dx \\ &=\frac12\left[f[m,x]·(x-a)(x-b)\right]_a^b-\frac12\int_a^bf[m,x,x](x-a)(x-b)\,dx \\ &=0+\frac12f[m,c,c]\int_a^b(x-a)(b-x)dx \\ &=\frac{f''(\xi)}{4}·\left[(b-a)\int_a^b(x-a)dx-\int_a^b(x-a)^2\,dx\right] \\ &=\frac{(b-a)^3}{24}f''(\xi) \end{align} with $c,\xi$ some midpoints in the interval $[a,b]$ (more specifically, $\xi\in [m,c]$).