Right derivative of continuous function nonnegative implies increasing function?

See snapshot of Hardy's book question 19: enter image description here


As pointed out by Paramanand in the comments, without continuity no conclusion on monotonicity at right neighborhoods of points in the domain can be drawn, even though $$f'_+(x) = \lim_{h\rightarrow 0^+}\frac{f(x+h)-f(x)}{h} \geq 0$$ $\forall x\in\Bbb R$. I show in this answer, too, for completeness, a counterexample that I already posted here. It's a function $f(x)$ with a well defined, non negative right derivative in $\Bbb R$, which however has $f(0) = 0$ and $f(x) <0$ for $x>0$.

enter image description here

The red lines are parabolic envelopes with equations $y=-x|x|$ and $y=-\frac{1}{2}x|x|$ and the function is $$f(x) = \begin{cases}\frac{\sqrt{2^{-k}}-\sqrt{2^{-k+1}}}{\sqrt[4]{2^{-k+1}}-\sqrt[4]{2^{-k}}}(x+\sqrt[4]{2^{-k+1}})- \sqrt{2^{-k+1}} & \left(-\sqrt[4]{2^{-k+1}}\leq x<-\sqrt[4]{2^{-k}}; \ k\in \Bbb Z\right)\\ 0 & (x=0)\\ \frac{\sqrt{2^{-k}}-\sqrt{2^{-k+1}}}{\sqrt[4]{2^{-k+1}}-\sqrt[4]{2^{-k}}}(x-\sqrt[4]{2^{-k+1}})+ \sqrt{2^{-k+1}}& \left(\sqrt[4]{2^{-k}}\leq x<\sqrt[4]{2^{-k+1}}; \ k\in \Bbb Z\right) .\end{cases}$$


Let us now demonstrate the following

Theorem Let $f(x)$ be a continuous function in $[a,b]$ such that \begin{equation}f'_+(x) = \lim_{h\rightarrow 0^+}\frac{f(x+h)-f(x)}{h} \geq 0, \ \ \forall x\in[a,b).\tag{1}\label{eq:1}\end{equation} Then, for all $a\leq x \leq y\leq b$, $f(y)\geq f(x)$.

We will need the following variation of Rolle's Theorem.

Lemma If $f(x)$ a is continuous function in $[a,b]$ with well defined right derivative $f'_+(x)$, and such that $f(a) = f(b)$, then there are points $\alpha,\beta\in[a,b]$ for which $f'_+(\alpha)\geq 0$ and $f'_+(\beta)\leq 0$.

Since $f(x)$ is continuous in $[a,b]$, by Weierstrass Theorem it must reach its minimum and maximum in such interval. If $f(a) = f(b)$ is minimum and maximum then the function is constant and the Lemma is proved. If $f(a) = f(b)$ is a minimum, then the maximum must be $\beta \in (a,b)$, and we have $f(x) \leq f(\beta)$. Hence, if $x\in(\beta, b] $, then we obtain $\frac{f(x)-f(\beta)}{x-\beta}\leq 0$. Therefore $f'_+(\beta) \leq 0$. Also, by minimality of $a$, we have $f(x) \geq f(a)$ for $x\in [a,b]$ so that $f'_+(a) \geq 0$. Similary, we can prove the statement if $f(a) = f(b)$ is a maximum, and if both minimum and maximum are in the open interval $(a,b)$.$\square$

Now we are ready to prove the Theorem, by contradiction. Suppose there are $c_1, c_2\in[a,b]$ such that $c_1 < c_2$ and $f(c_1) > f(c_2)$.

As when proving the Mean Value Theorem, consider an auxiliary function $$F(x) = f(c_2)-f(x) + K(x-c_2),$$ with $$K = \frac{f(c_2)-f(c_1)}{c_2-c_1}< 0.$$ It is easy to verify that $F(x)$ satisfies the Lemma hypotheses in $[c_1,c_2]$, with $F(c_1) = F(c_2) = 0$, and \begin{equation}F'_+(x) = K-f'_+(x).\tag{2}\label{eq:2}\end{equation} By the Lemma there is a point $c\in[c_1,c_2]$ such that $$F'_+(c) \geq 0,$$ which, by \eqref{eq:2}, yields $$f'_+(c) \leq K < 0,$$ a contradiction. $\blacksquare$