TITLE: Derivative and constant function
QUESTION [10 upvotes]: Problem
Suppose that $f:(a,b)\to\Bbb R$ is differentiable and $f^\prime(x)=0$ on $D$, where $D$ is dense on $(a,b)$. Can we conclude that $f$ is a constant function?
Background
In calculus course, I'm told that there's a theorem stated when $D=(a,b)$. In fact, it's reducible. For example, if $D=(a,b)\backslash C$ where $C$ is at most countable, we have $f^\prime(x)=0$ for all $x\in(a,b)$, because if $k_0=f^\prime(x_0)\neq0$ for some $x_0\in C$, there's some $\xi\in C$ such that $f^\prime(\xi)=\eta$ for all $0\le\eta\le k_0$, so $C$ is uncountable.

REPLY [3 votes]: There is an everywhere differentiable non-constant function such that the set $Z=\{x: f'(x) = 0 \}$ is dense. The following paper gives an example of such a function:
Y. Katznelson and Karl Stromberg. Everywhere Differentiable, Nowhere Monotone, Functions. The American Mathematical Monthly , vol. 81, no. 4 (Apr., 1974), pp. 349-354. 
According to this paper:

Examples of such functions are seldom given, or even mentioned, in books on real analysis. The first explicit construction of such a function was given by Kopcke (1889). An example due to Pereno (1897) is reproduced in [1], pp. 412-421.
...
[1] E. W. Hobson, Theory of Functions of a Real Variable II, Dover, New York, 1957