Trying to prove the inequality $\frac{e^b - e^a}{b-a} \leq \frac{e^a + e^b}{2}$ using convexity of $e^x$ and integration. Non-rigorously looking at the graph, the area under the curve is less than the trapezoidal area so I get $$e^b - e^a = \int_a^b e^xdx \leq \frac{1}{2}(e^a + e^b)(b-a)$$
But I want to prove for any convex and differentiable function $f:[a,b] \to \mathbb{R}$:
$$\int_a^b f(x)dx \leq \frac{1}{2}(f(a) + f(b))(b-a)$$
I used the mean value theorem to get
$$f(x) = f(a) + f'(\alpha(x))(x-a), \,\, a < \alpha(x)< x\\f(x) = f(b) + f'(\beta(x))(x-b), \,\, x < \beta(x)< b$$
and after combining and integrating
$$\int_a^bf(x)dx - \frac{1}{2}(f(a) + f(b))(b-a) \\= \frac{1}{2}\int_a^b f'(\alpha(x))(x-a)dx + \frac{1}{2}\int_a^b f'(\beta(x))(x-b)dx $$
(a) I'm not sure how to show the right side is $\leq 0$. I really can't say much about $\alpha$ and $\beta$
(b) Is it necessary that the derivative $f'$ be continuous?
This bound can be proven without any differentiation. If $f$ is convex on $[a,b]$, then it is bounded above by its secant: $$f(x)\leq \left(\frac{b-x}{b-a}\right)f(a)+\left(\frac{x-a}{b-a}\right)f(b)\text{.}$$ Consequently, $$\begin{split}\int_a^bf(x)\mathrm{d}x &\leq \int_a^b\left(\left(\frac{b-x}{b-a}\right)f(a)+\left(\frac{x-a}{b-a}\right)f(b)\right)\mathrm{d}x\text{.}\\ &=\frac{b-a}{2}f(a)+\frac{b-a}{2}f(b)\end{split}$$