Proof on showing $\frac{(b-a)}{2}(f(a) + f(b)) \leq \int_a^b f \leq (b-a) f(\frac{a+b}{2})$ for class $C^2$ function $f$ The task is as follows:

Given:
(a) function $f \in C^2$
(b) $f \geq 0$ and  (c) $f'' \leq 0$ on $[a,b]$
Goal:
Show 
$$\frac{(b-a)}{2}(f(a) + f(b)) \leq \int_a^b f \leq (b-a) f(\frac{a+b}{2})$$

To get an understanding of the problem, I tried specific function $f(x) = \sqrt x$ on interval $[ 1, 4 ]$
(1) For the first area (triangle with base $b-a$):
$\frac{(b-a)}{2}(f(a) + f(b))$ = $\frac{(4-1)}{2}(f(1) + f(4))$ = $\frac{9}{2}$
(2) For the second area (integral):
$\int_1^4 \sqrt x$ = $\frac{14}{3}$
I also tried adding up areas of sub-rectangles for this one, using right rectangles.
(3) For the third area = rectangle with length $b-a$ and width $f(\frac{a+b}{2})$ = $4.7$ (approximately)
So the conclusion clearly holds for this specific case.
But I have issue on how to generalize my example >_<
Well, by given information, I break function $f$ into 3 cases:
Case 1: If $f = 0$ i.e: zero function
Then there is nothing to prove, since area is always 0
Case 2: If $f = c$ i.e: constant function
Then the proof is quite easy, since all the 3 areas "shrink" down to be the area of the "big rectangle" with base $b-a$ and width $c$
Case 3: $f$ is convex or concave
This is the part that I don't know how to generalize what I found from my example.  
My thoughts:


*

*When I do the first area, I'm dealing with a triangle, thus I'm going below (or exactly on) the function $f$

*When I do the second area, I'm thinking about the upper Darboux sum. Thus the sub-rectangles exceed the original curve by some little fractional area, namely the upper left of the rectangles

*When I do the third area, I'm also exceed the original curve by some fractional area, but I think this extra part is a bit more than the fractional areas formed by the sub-rectangles.  Or thinking another way, if I double up this rectangle, I get an area which is way bigger than the other two areas.
But then... how should I generalize all these ideas ?
Would someone please help me on this question?
Thank you in advance ^^
 A: You already know that function is concave down ($f'' \leq 0$), therefore area of trapezoid is less than the  integral.
$$\frac{(b-a)}{2}(f(a) + f(b)) \leq \int_a^b f$$
Now the second part:
You can write the integral as:
$$\int _{ a }^{ b }{ f } =\int _{ a }^{ (a+b)/2 }{ f } +\int _{ (a+b)/2 }^{ b }{ f }$$
The function is increasing ($f'\ge0$), therefore
$$ \int _{ (a+b)/2 }^{ b }{ f } \ge \int _{ a }^{ (a+b)/2 }{ f } $$
In the first middle the rectangle has bigger area:
$$ \\ \int _{ a }^{ (a+b)/2 }{ f } \le \left( \frac { a+b }{ 2 } -a \right) f\left( \frac { a+b }{ 2 }  \right) $$
As a result:
$$\\ 2\int _{ a }^{ (a+b)/2 }{ f } \le \int _{ a }^{ b }{ f } \le \left( b-a \right) f\left( \frac { a+b }{ 2 }  \right) $$
A: This is a nice application of the slogan "convex functions lie above their tangents and below their secants", or rather its mirror image "concave functions lie below their tangents and above their secants".
Specifically this slogan says that for any $x\in[a,b]$ we have
$\frac{f(a)(b-x) + f(b)(x-a)}{b-a}\leq f(x) \leq f\left(\frac{a+b}{2}\right) + f'\left(\frac{a+b}{2}\right)\left(x-\frac{a+b}{2}\right)$.
Integrating $x$ from $a$ to $b$ now gives the result.
