For a convex function, the average value lies between $f((a+b)/2)$ and $(f(a) + f(b))/2$ Suppose that $f\in C^2$, $f''(x)\geq 0$ $\,\,\,\forall x \in [a,b]$. I want to show that $$\frac{1}{2}(b-a)(f(a)+f(b))\leq \int_a^bf(t)\,dt\leq (b-a)f\left(\frac{a+b}{2}\right).$$If we divide by $b-a$, we see that the left term is less than the right term by definition of convexity, and it remains to show that the average value of the function lies between $f\left(\frac{a+b}{2}\right)$ and $\frac{1}{2}(f(a)+f(b))$.
The mean value theorem for integrals implies that the average value is attained at some point $c\in (a,b)$. But it's not clear to me why $f(c)$ should lie in between two other points. Perhaps there's another theorem about integration we should apply. Any ideas?
 A: Here is an answer that doesn't assume $f$ is differentiable.
$f$ is convex iff $\frac{f(x)-f(y)}{x-y}$ is non-decreasing in both $x$ and $y$. If $f$ is convex, $f$ is continuous.
Assume $a\lt b$ and let $c=\frac{a+b}{2}$.
Since $\dfrac{f(x)-f(c)}{x-c}$ is non-decreasing,
$$
D^-=\sup_{x\lt c}\frac{f(x)-f(c)}{x-c}
\le\inf_{x\gt c}\frac{f(x)-f(c)}{x-c}=D^+\tag{1}
$$
Let $D=\frac{D^-{+}D^+}{2}$.
Inequality $(1)$ says
$$
f(x)-f(c)\ge D(x-c)\tag{2}
$$
Integrate $(2)$ over $[a,b]$ to get
$$
\begin{align}
\int_a^bf(x)\,\mathrm{d}x-(b-a)f(c)
&\ge D\left[\frac12x^2-cx\right]_a^b\\
&=D\left[\frac12(b^2-a^2)-\frac{a+b}2(b-a)\right]\\[6pt]
&=0\tag{3}
\end{align}
$$
For any $x\in[a,b]$, the convexity of $f$ implies
$$
\frac{f(x)-f(a)}{x-a}\le\frac{f(x)-f(b)}{x-b}\tag{4}
$$
therefore, since $(x-a)(x-b)\le0$, $(4)$ is equivalent to
$$
(x-b)(f(x)-f(a))\ge(x-a)(f(x)-f(b))\tag{5}
$$
Subtract $xf(x)$ from both sides of $(5)$ and integrate to get
$$
\frac12(b^2-a^2)(f(b)-f(a))+(bf(a)-af(b))(b-a)
\ge(b-a)\int_a^bf(x)\,\mathrm{d}x\tag{6}
$$
Divide both sides of $(6)$ by $b-a$ and regroup to get
$$
\begin{align}
\int_a^bf(x)\,\mathrm{d}x
&\le\frac12(a+b)(f(b)-f(a))+(bf(a)-af(b))\\
&=\frac12(b-a)(f(a)+f(b))\tag{7}
\end{align}
$$
Bringing $(3)$ and $(7)$ together yields
$$
(b-a)f\left(\frac{a+b}{2}\right)
\le\int_a^bf(x)\,\mathrm{d}x
\le\frac12(b-a)(f(a)+f(b))\tag{8}
$$
A: I think the inequality needs to be reversed. 
$\displaystyle \frac{b-a}{2}f\Big(\frac{b+a}{2}\Big)-\int_a^{\frac{b+a}{2}}f(t)\,dt=\int_a^{\frac{b+a}{2}}\int_t^{\frac{b+a}{2}}f'(s)\,ds\,dt\le\int_{\frac{b+a}{2}}^{b}\int_{\frac{b+a}{2}}^{t}f'(s)\,ds\,dt$ (since $f'(s)$ is bigger in the latter region and the integration is over a domain of the same size) $\displaystyle=\int_{\frac{b+a}{2}}^{b}f(t)\,dt-\frac{b-a}{2}f\Big(\frac{b+a}{2}\Big),$ hence $\displaystyle (b-a)f(\frac{b+a}{2})\le\int_a^b f(t)\,dt$. 
Other side:
$\displaystyle \int_a^{\frac{b+a}{2}}f(t)\,dt-\frac{b-a}{2}f(a)=\int_a^{\frac{b+a}{2}}\int_a^{t}f'(s)\,ds\,dt\le \int_{\frac{b+a}{2}}^{b}\int_{t}^{b}f'(s)\,ds\,dt=\frac{b-a}{2}f(b)-\int_{\frac{b+a}{2}}^b f(t)\,dt\,,$ hence $\displaystyle \int_a^b f(t)\,dt\le\frac{b-a}{2}(f(b)+f(a))\,.$
A: By a change of variable $t \rightarrow a + b - t$, you have $\int_a^bf(t)\,dt = \int_a^bf(a + b - t)\,dt$, so what you're trying to prove is equivalent to
$$(b-a)(f(a)+f(b))\leq \int_a^b(f(t) + f(a + b - t))\,dt\leq 2(b-a)f\left(\frac{a+b}{2}\right)$$
It then suffices to prove that for each $a < t < b$ that
$$f(a)+f(b)\leq f(t) + f(a + b - t)\leq 2f\left(\frac{a+b}{2}\right)$$
The result will then follow by integrating in $t$ from $a$ to $b$. By symmetry it suffices to just look at $a < t < {a + b \over 2}$. The left inequality can 
be rewritten as
$$f(b) - f(a + b - t) \leq f(t) - f(a)$$
By the mean-value theorem, the left-hand side is $(t - a)f'(c)$ for some $c > a + b - t > {a + b \over 2}$, and
the right-hand side is $(t-a)f'(d)$ for some $d < t < {a + b \over 2}$. Thus the fact that $f'' \leq 0$ gives the inequality.
Similarly, the right-hand inequality can be rewritten as 
$$f(a + b - t) - f(\frac{a + b}{2}) \leq f(\frac{a + b}{2}) - f(t)$$
The left-hand side is $(\frac{a + b}{2} - t)f'(d)$ for some $d > {a + b \over 2}$, and 
the right-hand side is $(\frac{a + b}{2} - t)f'(c)$ with $c < {a + b \over 2}$, so the condition that $f'' \leq 0$ gives the right-hand inequality as well.
Note you only need that $f'$ is decreasing, you don't actually need the second derivative to exist.
