There exists $c$ such that $\int_a^{(a+b)/2}f(x)dx=(b-a)/4(f(a)+f((a+b)/2))-(b-a)^3/96f''(c)$ I am struggling to understand a statement from a solution to a problem concerning integrals.
The hypotesis of the problem is that $f:[a,b]\to\mathbb{R}$ is twice differentiable with continuous second derivative and (but I don't think it is needed for this part) $\displaystyle \int_a^b f(x)\mathop{}\!\mathrm{d}x=0$.
The solution begins with the following statement which I can't prove: There exist $c_1\in\left( a,\frac{a+b}{2}\right)$ and $c_2\in\left(\frac{a+b}{2},b\right)$ such that:
$$\int_a^\frac{a+b}{2}f(x)\mathop{}\!\mathrm{d}x=\frac{b-a}{4}\left( f(a)+f\left(\frac{a+b}{2}\right)\right)-\frac{(b-a)^3}{96}f''(c_1)$$
and
$$\int_\frac{a+b}{2}^bf(x)\mathop{}\!\mathrm{d}x=\frac{b-a}{4}\left(f\left(\frac{a+b}{2}\right)+f(b)\right)-\frac{(b-a)^3}{96}f''(c_2).$$
I tried several aproaces including Taylor's formula or integrating by parts: $\displaystyle\int_a^\frac{a+b}{2}f(x)\mathop{}\!\mathrm{d}x=\int_a^\frac{a+b}{2}f(x)(x-c)'\mathop{}\!\mathrm{d}x=\ldots$.
 A: We have that
$$\int_a^\frac{a+b}{2}f(x)\mathop{}\!\mathrm{d}x=\int_{a}^\frac{a+b}{2}f(x)\left(x-\frac{3a+b}{4}\right)^\prime \mathop{}\!\mathrm{d}x=$$
$$=f(x)\left(x-\frac{3a+b}{4}\right)\Bigg|_a^\frac{a+b}{2}-\int_a^\frac{a+b}{2}f'(x)\left(x-\frac{3a+b}{4}\right)\mathop{}\!\mathrm{d}x=$$
$$=\frac{b-a}{4}\left(f\left(\frac{a+b}{2}\right)+f(a)\right)-\int_a^\frac{a+b}{2}f'(x)\left(\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}-\frac{(b-a)^2}{32}\right)^\prime \mathop{}\!\mathrm{d}x=$$
$$=\frac{b-a}{4}\left(f(a)+f\left(\frac{a+b}{2}\right)\right)-f'(x)\left(\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}-\frac{(b-a)^2}{32}\right)\Bigg|_a^\frac{a+b}{2}-\int_a^\frac{a+b}{2}f''(x)\left(\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}-\frac{(b-a)^2}{32}\right)\mathop{}\!\mathrm{d}x=$$
$$=\frac{b-a}{4}\left(f(a)+f\left(\frac{a+b}{2}\right)\right)+\int_a^\frac{a+b}{2}f''(x)\left(\frac{(b-a)^2}{32}-\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}\right)\mathop{}\!\mathrm{d}x.$$
Now notice that
$$\frac{(b-a)^2}{32}-\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}\geq 0$$
for any $x\in\left[a,\frac{a+b}{2}\right]$ so, by the Mean Theorem, there exists $c\in\left(a,\frac{a+b}{2}\right)$ such that the last integral is equal to
$$f''(c)\int_a^\frac{a+b}{2}\left(\frac{(b-a)^2}{32}-\frac{\left(x-\frac{3a+b}{4}\right)^2}{2}\right)\mathop{}\!\mathrm{d}x=$$
$$=f''(c)\left(\frac{(b-a)^3}{64}-\frac{(b-a)^3}{192}-\frac{(b-a)^3}{192}\right)=f''(c)\frac{(b-a)^3}{96},$$
which concludes the proof.
