Problem with using mean value theorem Suppose $f:\mathbb{R} \rightarrow \mathbb{R}$ is a continuous and convex function over $[a,b]$ which has first derivative over $[a,b]$. prove that:
$f'(a)\leq \frac{f(b)-f(a)}{b-a} \leq f'(b)$
I know that  this is easy through mean value theorem, however, I think that the function should be twice differentiable and the second derivative should be continuous, otherwise I think the result above is not true.
Am I right? If yes, could you give me a counterexample? I tried but I didn't find anyone.

Assume $f$ is convex and $f'(a),f'(b)$ exist.

Fix $x\in (a,b)$.

Then letting $t={\large{\frac{x-a}{b-a}}}$, we have
$$
\left\lbrace
\begin{align*}
&0 < t < 1\\[4pt]
&x=(1-t)a+tb\\[4pt]
\end{align*}
\right.
$$
hence by convexity of $f$ we have
$$
f(x)\le (1-t)f(a)+tf(b)=f(a)+t\bigl(f(b)-f(a)\bigr)
$$
hence
\begin{align*}
\frac{f(x)-f(a)}{x-a}
&\le
\frac{t\bigl(f(b)-f(a)\bigr)}{x-a}
\\[4pt]
&=
\bigl(f(b)-f(a)\bigr)
\left(
\frac{t}{x-a}
\right)
\\[4pt]
&=
\bigl(f(b)-f(a)\bigr)
\left(
\frac{1}{b-a}
\right)
\\[4pt]
&=
\frac{f(b)-f(a)}{b-a}
\\[4pt]
\end{align*}
hence from
$$
f'(a)=\lim_{x\to a^+} \frac{f(x)-f(a)}{x-a}
$$
it follows that
$$
f'(a)\le \frac{f(b)-f(a)}{b-a}
$$
as was to be shown.

The inequality
$$
f'(b)\ge \frac{f(b)-f(a)}{b-a}
$$
can be proved analogously.
