In which case is $\int_a^b f(x) dx \simeq f\left(\frac{a+b}{2}\right) (b-a) $ a good approximation? I was wondering as I stated in the question title in which case is
$$\int_a^b f(x) dx \simeq f\left(\frac{a+b}{2}\right) (b-a) $$ a good approximation.
As I can see it depends on the $f(x)$ and also on the integration interval chosen, and I doubt that there is a general rule about it, but there are particular cases (e.g the function is a well known function as the gaussian, there are particular symmetries etc.) in which the approximation is good ? (with good I intend that we can estimate the error commited).
And also, there is a rule of thumb in which one can use this approximation not commiting such big error ?
 A: The answer is rather simple: when the average value of $f(x)$ in the interval is close to $f(\frac{a+b}{2})$
$$\bar{f}(x) \Big | _a^b=\frac1{b-a}\int_a^b f(x) dx \simeq f\left(\frac{a+b}{2}\right)$$
Regarding the symmetry, the integrating behavior to the left and to the right of the central point are canceling up to the median value. Other than that it is difficult to say anything else.
A: I'll give a derivation of the asymptotic error. Without loss of generality, we can assume $a = -h$ and $b = h$ for some $h > 0$. Suppose $f \in C^4([-h, h])$. For any function $g$, let $E(g) = g(0) \cdot 2h - \int_{-h}^{h}g(x)\,dx$, the error of the approximation on $g$. By Taylor's theorem,
$$f = f(0) + f'(0)x + \frac{f''(0)}{2}x^2 + \frac{f^{(3)}(0)}{3!}x^3 + \frac{f^{(4)}(c(x))}{4!}x^4.$$
By direct computation, $E(1) = E(x) = E(x^3) = 0$. By linearity of $E$,
$$E(f) = f(0)E(1) + f'(0)E(x) + \frac{f''(0)}{2}E(x^2) + \frac{f^{(3)}(0)}{3!}E(x^3) + E(\frac{f^{(4)}(c(x))}{4!}x^4) = \frac{f''(0)}{2}E(x^2) + O(h^5).$$
By direct computation, $E(x^2) = \frac{2}{3}h^3$. Thus
$$E(f) = \frac{f''(0)}{3}h^3 + O(h^5) = \frac{f''(0)}{24}(b - a)^3 + O((b - a)^5).$$
