Let $f:(a, b) \to \mathbb{R}^1$ and assume that $f''(x)$ exists for every $x\in (a, b)$. I am trying to prove:
$f'$ is monotonically increasing in $(a, b)$ iff $f''(x) \ge 0 \forall x \in (a, b)$.
My attempt:
$(\Leftarrow)$ We prove the contrapositive. Let $a< p < q< b$ and suppose $f'(p)> f'(q)$. Since $f''$ exists on $(a, b)$, $f'$ is continuous on $(a, b)$. Then, $f$ is a real continuous function on $[p, q]$ and is differentiable in $(p, q)$. By the Mean Value Theorem, $\exists x \in (p, q)$ at which $$\frac{f'(q)-f'(p)}{q-p} = f''(x).$$ Clearly, $q-p>0$ but $f'(q)-f'(p)<0$ which implies that $f''(x)<0$ for some $x \in (p, q) \subset (a, b)$.
$(\Rightarrow)$ Suppose $f'$ is monotonically increasing in $(a, b)$. Let $a<x<t<b$; then, $$f'(x) \le f'(t) \implies \lim_{t \to x}f'(x) \le \lim_{t \to x} f'(t).$$ Next, assume for contradiction that $\exists x \in (a, b)$ such that $f''(x)< 0$. Then, $$\lim_{t \to x}\frac{f'(t)-f'(x)}{t-x} < 0 \implies \frac{1}{t-x} \cdot \lim_{t \to x} \{f'(t)-f'(x)\} < 0 \implies \lim_{t \to x} f'(t) < \lim_{t \to x} f'(x)$$ and we have the desired contradiction.
Can someone please critique my proof and let me know if it has any inaccuracies? Thanks!
Edit: The last displayed equation is not correct. Can someone also suggest an alternative way to complete the proof?
In one direction, if $f'$ is monotone increasing on $(a, b)$ then for any $a < x < b$,
$$f''(x) = \lim_{h \rightarrow 0^+} \frac{f'(x+h) - f'(x)}{h} \geq 0,$$
since the numerator and denominator are both positive. (We may specify $h \rightarrow 0^+$ because existence of the two-sided limit $f''(x) = \lim_{h \rightarrow 0} \frac{f'(x+h) - f'(x)}{h}$ implies the one-sided limit exists and is equal.)
In the other direction, suppose $f''(x) \geq 0$ on $(a, b)$, then by the Mean Value Theorem or Rolle's Theorem, for arbitrary $x, y$ with $a < x < y < b$ there exists $c \in [x, y]$ so that $$f'(y) - f'(x) = f''(c)(y - x).$$ But $f''(c)(y - x) \geq 0$, QED.