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?

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}
$$
