Prove that solutions to $\dot x=f(x)$ are monotonic

I have the following problem: let $f(x)$ be a continuous function with real argument. Consider the following equation:

$\dot x=f(x) \tag{1}$

Prove that all of its solutions are monotonic.


Here is the solution I came up with: let $U=\{x:f(x)=0\}$. If $x_0\in U$, then the function $x\equiv x_0$ satisfies the equation and it is monotonic.

Now let $x_1\notin U$. Let

$$ m_1=\sup\{u\in U:u<x_1\}\\ M_1=\inf\{u\in U:x_1<u\} $$

By the theorem of existence and uniqueness, there exists a unique solution for any starting condition of kind $x(t_0)=x_0$ where $t\in\mathbb R,x_0\in U$ and we found such a solution above: $x\equiv x_0$. Therefore solutions to problems of kind $x(t_0)=x_1$ where $t_0\in\mathbb R,x_0\in U$ may not cross the line $x=x_0$ for any $x_0\in U$, therefore $x(t)\in \langle m_1,M_1\rangle\;\;\forall t\in\mathbb R$ where the interval is open on the corresponding end if $m_1\in U$ or $M_1\in U$ and closed otherwise.

Since $f$ is continuous, it has constant sign on this interval $\langle m_1,M_1\rangle$, because it never reaches zero on this interval, therefore $\dot x=f(x)>0\;\;\forall t\in\mathbb R$ or $\dot x=f(x)<0\;\;\forall t\in\mathbb R$, which means $x$ is strictly monotonic. Obviously, every solution can be expressed as a solution to a problem with starting conditions $x(t_0)=x_2$ where $t_0\in\mathbb R$ and $x_2\in U$ or $x_2\notin U$, therefore every solution is either constant or strictly monotonic.


However someone pointed out to me that the problem didn't state that $f$ is everywhere differentiable, which means that the theorem of existence and uniqueness doesn't quite hold, like for $f(x)=x^{2/3}$ solutions $x(t)=0$ and $x(t)=t^3/27$ intersect, yet they are both monotonic. And I am not sure what to do with that, because the statement of the problem is still supposed to be true. How can it be proved without using differentiability of $f$?


I think the result is correct:

Assume that $x:J \to \mathbb{R}$ is a solution of $x'(t)=f(x(t))$ which is neither decreasing nor increasing on the interval $J$ (note that $x \in C^1(J)$). Then, there exist $a, b \in J$ such that $x'(a) > 0$ and $x'(b) < 0$. Without loss of generality consider the case $a < b$ and $x(a) \le x(b)$. Let $\tau \in (a,b)$ be such that $x (\tau) = \max\{x(t):t \in [a,b]\}$ (note that $x(\tau)>x(b)$), and let $\sigma := \max \{t \in [a,\tau]:x(t) = x(b)\}$. We have $\sigma < \tau$ and $x(t) > x(\sigma)$ $(t \in (\sigma,\tau] )$. Hence $x'(\sigma) \ge 0$. Since $x(\sigma) = x(b)$ we get $$ 0 > x'(b) = f(x(b)) = f(x(\sigma)) = x'(\sigma) \ge 0, $$ a contradiction.