TITLE: If $f'(x) = 0$ for all $x \in \mathbb{Q}$, is $f$ constant?
QUESTION [27 upvotes]: Let $f$ be a differentiable function on $\mathbb{R}$ such that
$$f'(x)=0,\forall x\in \mathbb Q.$$
Prove or disprove that
$$f(x)=c$$
for some constant $c$. I've heard this problem is true, but I'm not sure. Can you prove it or provide a counterexample?
Auxiliary question: I wonder the converse of it, if $f′=0$ for all irrational, can we say that $f$ is constant?

REPLY [7 votes]: It's false, you can find an answer here. (French)

The proposed function is 
  $$
g(x)= \inf\{d(x,E_k)^{1/k}: k\in \mathbb{N}\} 
$$
  where $E_k$ is the closed discrete set $\{p/2^k : p\in \mathbb{Z}\}$