Error esimate given the midpoint estimation of an integral. I calculated an approximate integral $\left (\int_0^{3.2} f(x)dx \right )$ using midpoints and given data from a table, and got $23.44$. The second derivative of $x$ is said to be between $-4$ and $1$ inclusively. What is the error estimate?
I tried to integrate the inequality twice and got that the integral of $f(x)$ is between $\frac{-2x^3}{3}$ and $\frac{x^3}{3}$ inclusively. I then evaluated the integrals from $0$ to $3.2$ and got that the integral of $f(x)$ should be between $-21.84533$ and $5.4613$ inclusively. I don't know if this is correct but this is what I have tried. I am stuck from here. Thank you.
 A: An error bound for approximating the integral $\displaystyle \int_a^bf(x)\,dx$ using the midpoint rule is 
$$E = \sup_{x \in [a,b]}|f''(x)|\frac{(b-a)^3}{24n^2}$$.
In your case this is
$$E = 4\frac{3.2^3}{24n^2}.$$
Now substitute the number of points $n$ used in the evaluation.
Derivation
The midpoint rule is
$$\int_{a}^{b}f(x)dx \approx \frac{b-a}{n}\sum_{j=1}^{n}f(\bar{x}_j),$$
where $x_j = a + j(b-a)/n$ and $\bar{x}_j = (x_{j-1}+x_j)/2.$
The absolute error is 
$$E = \left|\int_{a}^{b}f(x)dx - \frac{b-a}{n}\sum_{j=1}^{n}f(\bar{x}_j)\right| = \left|\sum_{j=1}^{n}\int_{x_{j-1}}^{x_{j}}[f(x)-f( \bar{x}_j)]dx \right|.$$
Using Taylor's theorem,
$$f(x) = f(\bar{x}_j)+f'(\bar{x}_j)(x-\bar{x}_j) + \frac1{2}f''(\xi_x)(x-\bar{x}_j)^2,  $$
where $\xi_x$ is between $x$ and $\bar{x}_j$ and $|f''(\xi_x)| \leq K= \sup_{x \in [a,b]}|f''(x)|$.
Substituting and integrating we get 
$$E =  \left|\sum_{j=1}^{n}\frac1{2}\int_{x_{j-1}}^{x_{j}}f''( \xi_x)(x-\bar{x}_j)^2dx \right| \\ \leq \frac1{2}\sum_{j=1}^{n}\int_{x_{j-1}}^{x_{j}}|f''( \xi_x)|(x-\bar{x}_j)^2dx  \leq \frac{K}{24}\sum_{j=1}^{n}(x_j-x_{j-1})^3 = \frac{K}{24}\sum_{j=1}^{n}\left(\frac{b-a}{n}\right)^3\\= \frac{K(b-a)^3}{24n^2}$$
