TITLE: Can there exist a non-constant continuous function that has a derivative of zero everywhere?
QUESTION [10 upvotes]: Somebody told me that there exists a continuous function with a derivative of zero everywhere that is not constant.
I cannot imagine how that is possible and I am starting to doubt whether it's actually true. If it is true, could you show me an example? If it is not true, how would you go about disproving it?

REPLY [7 votes]: Since there are no restrictions on the domain, it is actually possible. Let $f:(0,1)\cup(2,3)\to \mathbb R$ be defined by $f(x)=\left\{
 \begin{array}{ll}
  0  & \mbox{if } x \in (0,1) \\
  1 & \mbox{if } x\in (2,3)
 \end{array}
\right.$