$\forall x\in\mathbb{R}\setminus\mathbb{Q}:f'(x)=0$. Does it follow that f is constant? Function $f:\mathbb{R}\rightarrow\mathbb{R}$ is continuous and $\forall x\in\mathbb{R}\setminus\mathbb{Q}:f'(x)=0$. Does it follow that f is constant?
 A: Yes, $f$ must be constant.
Suppose it is not, so without loss of generality there are $a < b$ such that $f(a) < f(b)$. For $a \leqslant x < y \leqslant b$ define
$$Q( x, y ) = \frac{f(y)-f(x)}{y-x}$$
which is the slope of the secant of the graph of $f$ going through $x$ and $y$. Then $Q(a, b) = 2 \varepsilon$ for some $\varepsilon > 0$. Since $f$ is continuous, so is $Q$.
Enumerate all rationals in $[a, b]$ in the sequence $\left< q_n : n \geqslant 0 \right>$. We inductively construct a sequence $\left< I_n : n \geqslant 0 \right>$ of closed subintervals $I_n = [a_n, b_n] \subseteq [a, b]$ such that for each $n \geqslant 0$:

*

*$I_{n+1} \subseteq I_n$

*$q_n \notin I_{n+1}$

*$Q(a_n, b_n) \geqslant \varepsilon \left( 1 + \frac{1}{2^n} \right)$.

We start with $I_0 = [a, b]$. Now suppose $I_n = [a_n, b_n]$ has already been defined. If $q_n \notin I_n$, we let $I_{n+1} = I_n$.
Otherwise we first define $[a_n', b_n'] = I_n' \subseteq I_n$ such that $q_n$ is one of its endpoints and $Q(a_n', b_n') \geqslant \varepsilon \left( 1 + \frac{1}{2^n} \right)$. If $q_n$ is already one of the endpoints of $I_n$, we simply let $I_n' = I_n$. Otherwise observe that for $\lambda = \frac{q_n-a_n}{b_n-a_n} \in (0, 1)$ we have
$$\lambda \cdot Q(a_n, q_n) + (1-\lambda) \cdot Q(q_n, b_n) = Q(a_n, b_n) \geqslant \varepsilon \left( 1 + \frac{1}{2^n} \right)$$
so either $Q(a_n, q_n) \geqslant \varepsilon \left( 1 + \frac{1}{2^n} \right)$ or $Q(q_n, b_n) \geqslant \varepsilon \left( 1 + \frac{1}{2^n} \right)$, which in either case lets us define $I_n'$ in the way we declared.
Now since $Q$ is continuous, we can slightly shorten $I_n'$ from the side of $q_n$ and obtain $[a_{n+1}, b_{n+1}] = I_{n+1} \subseteq I_n'$ such that $q_n \notin I_{n+1}$ and $Q(a_{n+1}, b_{n+1}) \geqslant \varepsilon \left( 1 + \frac{1}{2^{n+1}} \right)$. This completes the construction.
Now the intersection $\displaystyle I = \bigcap_{n=0}^{\infty} I_n$ is a non-empty closed interval that does not contain any rational number, so $I = \{ c \}$ for some irrational number $c$. Then $a_n \nearrow c$ and $b_n \searrow c$ so since $f'(c) = 0$, $\displaystyle \lim_{n \to \infty} Q(a_n, c) = \lim_{n \to \infty} Q(c, b_n) = 0$. But for each $n$ either $Q(a_n, c) \geqslant \varepsilon$ or $Q(c, b_n) \geqslant \varepsilon$, which is a contradiction.
