# $f:(0,1)\cup (1,2)\to \Bbb R$ and $f(x)=0$ if $x\in (0,1)$ otherwise $1$.

Till today, I always thought that if the derivative of a function is $0$ at every point in the domain, then the only functions possible for which this is true are constant functions. But, my teacher gave me the example $$f:(0,1)\cup (1,2)\to \Bbb R$$ with

$$f(x) = \begin{cases}0&\mathrm{\ if\ } 0<x<1 \\ 1 &\mathrm{\ if\ }1<x<2\end{cases}$$

This function is not constant but has derivative $0$ everywhere in domain.I know it is pretty much possible because of the domain he chose, but what is special there in this domain which makes this happen.

Can anybody give some other examples not of this form (which I gave above) having derivative $0$ without function being constant.

-

A differentiable function with zero derivative is constant on the connected components of its domain.

The function $\displaystyle f : \mathbb{R}-\mathbb{Z} \to \mathbb{R}$ given by $f(x) = \lfloor x \rfloor$ has derivative $0$ everywhere and it takes, not just 'more than one value', but in fact it takes infinitely many values $-$ you can't even bound it! But it is constant on all of the connected components of its domain; explicitly, $f|_{(n,n+1)}(x) = n$ for all $x \in (n,n+1)$.

In fact, any step-function will do, provided you remove the points at which it is not continuous from its domain.

-
so, if my domain is connected, then the only class of functions possible with given conditions is constant function, right?? – Aang Sep 11 '12 at 12:24
@Avatar: Yes $-$ if it's constant on the connected components of the domain, and the domain only has one connected component, then it must be constant on the whole domain! More generally, if the domain has $n$ connected components then $f$ can take $\le n$ distinct values. – Clive Newstead Sep 11 '12 at 12:24
thanks for the help; i got the idea now. – Aang Sep 11 '12 at 12:27

Have you considered the function $f: \mathbb R\setminus\{0\} \to \mathbb R$ defined by $f(x):=\arctan(x)+\arctan(1/x)$?

Anyway this is not a real answer to your question. Indeed, the following theorem holds true:

If $f\colon A\subset \mathbb R \to \mathbb R$ is differentiable at every point of $A$ with $f'(x) \equiv 0$ then $f$ is constant on every connected component of $A$.

So the "key" to understand the examples lays in the topological properties of the domain. If the set $A$ is connected then every differentiable function $f :A\to \mathbb R$ with zero derivative (everywhere) is constant.

Hope this helps.

-
thanks for your help too!! – Aang Sep 11 '12 at 12:27