Characterization convex function. [closed]
Suppose $f$ satisfies your condition but is not convex. Then for some $c < d$ we have $f((c+d)/2) > (f(c) + f(d))/2$. Let $$g(x) = f(x) - f(c) - \dfrac{f(d) - f(c)}{d-c} (x - c)$$ which satisfies the same conditions as $f$, and has $g(c) = g(d) = 0$ and $g((c+d)/2) > 0$. Let $y$ be the maximum value of $g$ on the interval $[c,d]$ (so $y > 0$), $p = \max \{x \in [c,d]: g(x) = y\}$, and $\epsilon > 0$ so $p + \epsilon \le d$ and $p - \epsilon \ge c$. Then $g(x) \le g(p)$ for $p-\epsilon \le x \le p$ and $g(x) < g(p)$ for $p < x \le p - \epsilon$, so
$$ \dfrac{1}{2\epsilon} \int_{p-\epsilon}^{p + \epsilon} g(x)\; dx < g(p) $$
contradicting your inequality (with $a = p-\epsilon$, $b = p+\epsilon$).