TITLE: A function such that $f'(x)>0$, but not strictly monotone increasing.
QUESTION [7 upvotes]: This is Exercise 10.3.5 from Analysis Vol.1 by Terence Tao.
Give an example of a subset $X \subset \mathbb{R}$ and a function $f: X \to \mathbb{R}$ which is differentiable on $X$, is such that $f'(x)>0$ for all $x \in X$, but $f$ is not strictly monotone increasing.
Thanks.

REPLY [7 votes]: Since Terence Tao is a great mathematician, we must use some care in handling this exercise. Everybody knows that a function with positive derivative on an interval is increasing. However, Tao is asking for both a set and a function.
The easiest example is $X=(0,1) \cup (2,3)$, and
$$
f(x)=x \quad\text{for $x \in (0,1)$}, f(x)=x-100 \quad\text{for $x \in (2,3)$}.
$$
This function has $f'>0$ on $X$ but nevertheless it is not strictly increasing on $X$.