Is there any function continuous in $R$ and differentiable in rational numbers with zero derivative? I'm looking for a function continuous in $R$ and differentiable in all rational numbers and it's derivative should be $0$.But not the constant function.
And there is a same question about irrational numbers.
Can any one help??
 A: An example of a strictly increasing function with derivative $0$ at rationals is the Minkowski's question mark function, which is defined as follow :
given $x$ whose continued fraction representation is $[a_0, a_1, a_2, ... ]$, let $?(x) = a_0 - 2 \sum \limits_{n=1}^{\infty} \frac{(-1)^n}{2^{a_1+\cdot \cdot \cdot + a_n}}$.
You can prove that this function's derivative is $0$ over the rationals, but yet it is strictly increasing, so there is no interval on which it is constant.
(PS : continued fraction : $x = a_0 + \frac{1}{a_1+\frac{1}{a_2+\frac{1}{...}}} $ where $a_0 \in Z$, and $a_1,a_2 > 0$ integers. You have existence and unicity of this decomposition (and the list $(a_0,a_1,...)$ is finite iff $x$ is rational) )

$ $
Concerning your second question, if $f$ is continuous, differentiable at irrational numbers and with derivative $0$ at irrational numbers, then $f$ is constant.
More generally, if $f$ is continuous and its derivative exists and is $0$ at the complement of a countable set, then you can prove that $f$ is constant.
$ $
To prove this, first fix $\varepsilon > 0$


*

*if $f'(x) = 0$, then it exists $\delta > 0$ such that $\forall s \in [x-\delta, x+\delta],\ \mid f(s) - f(x) \mid < \varepsilon \mid s - x \mid$.
So the variation of $f$ over any subinterval of $[x - \delta, x+\delta]$ is less than $2\varepsilon$ times the length of the subinterval (*).

*let us note $(x_n)$ the (countable) other points where  the derivative is not defined or not $0$. Using continuity, for all $n$, it exists $\delta$ such that $\forall s\in [x_n - \delta, x_n + \delta],\ \mid f(s) - f(x_n) \mid < \frac{\varepsilon}{2^{n}}$
Hence, the variation over all those intervals when $n$ is an integer is less than $2 \sum \limits_{n\in\mathbb{N}} \frac{\varepsilon}{2^n} = 4\varepsilon$


To be clearer, we can define for all $x$, $\delta(x)$ equals the $\delta$ mentioned in the first case or the second depending on $x$ 
(hence for all $x$, $[x-\delta(x), x+\delta(x)]$ is a neighborhood of $x$ over which the variation of $f$ is tiny).
$ $
Then let us fix $a<b$. We can prove that there exists $a = a_0 < a_1 < \cdot \cdot \cdot < a_r = b$ and $t_1,...,t_r$ such that for all $i \geqslant 1$, $t_i \in [a_{i-1}, a_i]$ and $a_i - a_{i-1} < \delta(t_i)$.
(the proof consists of considering the set of $y \in [a,b]$ such that it exists $a = a_0 < \cdot \cdot \cdot < a_s = y$ with the previous property. This set is non-empty ($a$ is in it), and bounded, so it has a supremum. If this supremum $c$ is  $<b$, you can add to your partition $e>c$ such that $e<c+\delta(c)$, and $e$ is in the set, there is a contradiction. So the supremum is $b$, and we have the property we were looking for. )
Using triangular inequality we have : $\mid f(b) - f(a) \mid \leqslant \sum \limits_{k=1}^r \mid f(a_k) - f(a_{k-1}) \mid$.
So $\mid f(b) - f(a) \mid \leqslant 4\varepsilon + \sum \limits_{k=1}^r 2\varepsilon(a_k - a_{k-1})$ : an upper bound is the sum of the variations in the second case and also in the first case mentionned earlier. For the first case, we need to add that if $f'(t_k) = 0$ (that is, if we are in the first case), then $[a_{k-1},a_k]$ is a subset of $[t_k - \delta(t_k), t_k + \delta(t_k)]$ and we can use (*) : $\mid f(a_k) - f(a_{k-1}) \mid \leqslant 2\varepsilon (a_k - a_{k-1})$.
$ $
Hence $\mid f(b) - f(a) \mid \leqslant 4\varepsilon + 2\varepsilon(b-a)$, and this holds for all $\varepsilon$. Thus $f(a) = f(b)$ : $f$ is constant.
A: Cover the rationals by an open set $U$ of finite length, and let $g\ge 0$ be any integrable function that vanishes on $U$, but is not identically equal to zero. Then $f(x)=\int_{-\infty}^x g(t)\, dt$ has the required properties.
