TITLE: 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]$?
QUESTION [5 upvotes]: 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.

REPLY [5 votes]: 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]$.