If $f:[a,b]\rightarrow \mathbb{R}$ is continuous on $[a,b]$ and $f(a)\neq f(b)$, then $f$ is stricly monotonic on some segment $[c,d]\subseteq [a,b]$? Is the following statement true:

If $f:[a,b]\rightarrow \mathbb{R}$ is continuous on $[a,b]$ and $f(a)\neq f(b)$, then $f$ is stricly monotonic on some segment $[c,d]\subseteq [a,b]$?

It seems trivial when you draw an arbitrary curve and find the segment $[c,d]$. How about the proof? Indeed, if the statement is not correct, can we add some hypothesis to make it true?
Thanks a lot.
 A: If you assume that $f$ has continuous derivative, then the statement becomes true: by the mean value theorem,
$$
f(b)-f(a) = f'(\xi) (b-a)
$$
for some $\xi \in (a,b)$. But then,
$$
f'(\xi ) =\frac{f(b)-f(a)}{b-a}.
$$
Since $f(b)\neq f(a)$, you get that either $f'(\xi) >0$ (or $f'(\xi)<0$). Moreover, the function $f'$ will have constant sign in a neighborhood of $\xi$, say $(\xi-\varepsilon,\xi+\varepsilon)$, because it is continuous. Hence, we conclude that $f$ is strictly increasing (or decreasing) in $(\xi-\varepsilon,\xi+\varepsilon)$, which contains a closed interval $[c,d]$.
A: Let me provde an answer which is somehow different in spirit of those in the MSE question Nowhere monotonic continuous function .
As for many such questions, it is very tricky to construct counter-examples, whereas probability can "easily" tell us that there are more counter-examples than examples actually.
I first start with an easy problem: Are there transcendental numbers? We know that there are many of them just because of cardinality, but it is rather difficult to exhibit an explicit one (for example you must show that $e$ is trascendental).
Now let $B=B(\omega):[0,1]\to\mathbf R$ be a Brownian motion defined on some probability space $(\Omega,\mathcal{B},\mathbf P)$. In a short sentence, the Brownian motion is the random continuous function and for this reason it should have many of the properties that "most" of continuous functions satisfy.
One key fact, consequence of Blumenthal's $0$-$1$ law, is that with probability $1$, the random function $B$ takes both positive and negative values on any small neighbourhood of zero.
A second key fact (which is actually in the definition of BM) is that for any $t>0$, the function $s\to B(t+s)-B(t)$ has the same law of a BM. This implies,just using translation in time, that $B(t+s)$ takes values both greater than $B(t)$ and less than $B(t)$ in any right neighbourhood of $t$.
This implies that  with probability $1$, $B$ is nowhere monotonic.
