TITLE: If a function is not-strictly-increasing, is there an interval on which it is weakly decreasing?
QUESTION [8 upvotes]: Suppose a continuous function $f$ is not strictly-increasing, i.e, there are $a,b$ such that $a<b$ and $f(a) \geq f(b)$. Does there exists an interval $a',b'$, with $a\leq a' < b' \leq b$, in which $f$ is weakly-decreasing, i.e:
$$
\forall x,y \in[a',b']: 
~
x<y \implies f(x)\geq f(y)
$$
?
Initially I thought it was trivial, but now I do not see how to prove it...
EDIT: if this is not true, what minimal assumption should be made on $f$ to make it true? (e.g, is it sufficient to assume that $f$ is differentiable? smooth?)

REPLY [5 votes]: I will copy your notation in my answer.
Suppose that $f$ is continuously differentiable on $[a,b]$. I claim that in this case there is an interval $(a',b')$ such that $f$ is weakly-decreasing on this interval.
Note that if $f'(c) < 0$, then there is an open neighborhood of $c$ such that $f'(x) < 0$ on this open neighborhood and hence $f$ is strictly decreasing on this open neighborhood.
Hence, we are done if there is any $c \in [a,b]$ such that $f'(c) < 0$. So suppose that $f'(x) \geqslant 0$ for all $x \in [a,b]$.
Now note, that if $f'(x) \geqslant 0$ for all $x \in [a,b]$, then we have $f(a) \leqslant f(b)$. With equality if and only if $f'(x) = 0$ for all $x \in [a,b]$. By assumption $f(a) \geqslant f(b)$. Hence $f(a) = f(b)$ and $f'(x) = 0$ for all $x \in [a,b]$ and hence $f(x) = f(a) = f(b)$ for all $x \in [a,b]$ and we are done.

Note that this proof generalizes to piecewise continuously differentiable $f$. Partition the interval $[a,b]$ into pieces $[a_{i},b_{i}]$ such that $f$ is continuously differentiable on each $[a_{i},b_{i}]$. If $f$ is strictly increasing on all pieces then $f$ is strictly increasing, a contradiction to the assumption that this is not so. Hence $f$ is not-strictly-increasing on at least one of the pieces $[a_{i},b_{i}]$ and the previous proof applies.

Some words about the minimality of this assumption. According to wikipedia, any function that is monotonic on an interval is differentiable almost everywhere. This shows that any function that is differentiable nowhere is a counter-example to your claim.
This means that the functions that we are not decided about yet are the functions that are almost everywhere continuously differentiable, but not piecewise differentiable. I must admit that I have trouble imagining what such a function would like.