# Example of continuous onto function with constrain differentiability

I need to find a continuous, onto $f: (0,2) \rightarrow (0,2)$ and an countably infinite $A \subset (0,2)$ such that $f$ is not differentiable at every point of $A$ and differentiable at every point of $(0,2) \backslash A$ ?

My attempt:

For a "non-diffrentiable function at every point" I can think of $$f(x) = \left\{ \begin{array}{} 1 , x \in \mathbb{Q} \\ 0, x \in \mathbb{Q}^c \end{array} \right.$$

or something similar to this, how can divide ythe domain $(0,2)$ such that in one domain I'll have some function similar to above and merge it with other continuous part of the function. The problem will be at the boundary. since there derivative limits should match.

Any hint on how should I proceed?

• You should draw a graph and build this such function. I think we would use the absolute function $|x|$
– ntt
Apr 7, 2017 at 11:49

$f(x) = \left\{ \begin{array}{} \frac1{b^2} , x \in \mathbb{Q} \text{ where }x=\frac{a}{b} \text{ and } \gcd(a,b)=1 \\ 0, x \in \mathbb{Q}^c \end{array} \right.$
A graph on $(0,1)$ stolen from another question, would look like this. The function is shown by the black circles, but the red lines show why irrational points have zero derivative. (The graph on $(1,2)$ would be the same and there would also be $f(1)=1$.)