Is it possible for a function to be differentiable at a discrete real subset, whose compliment is also discrete? Is it possible to have a continuous function $f:\mathbb R \rightarrow\mathbb R$, such that its differentiable, when $x$ is an element of $A$, where $A$ is such that $A$, $\mathbb R\setminus A$ are both discrete i.e. contain no intervals?
I can't imagine how to attack this, I realize that there might be a function which is only differentiable at a set of discrete points (very similar to a problem that was answered on this website). However the idea of the function asked breaks my head.
 A: There are several ways to produce a continuous function that is differentiable exactly at the irrationals. I think one of the cleanest and simplest goes like this.
Suppose $\{q_n\}$ is an enumeration of the rationals, and let $g$ be the greater-than-zero indicator function, that is
$$
g(x) = \begin{cases}
0 & x \leq 0, \\
1 & x > 0.
\end{cases}
$$
The idea is that we want to have a sum of functions $g(x - q_n)$, as $g(x - q_n)$ prevents differentiability at $q_n$. So consider the function
$$ f(x) = \sum_{n \geq 1} 2^{-n} g(x - q_n).$$
This is a monotonic, positive function, but it's not continuous. To produce a continuous function, we consider the antiderivative of $f$,
$$ F(x) = \int_0^x f(t) dt.$$
I would remind that monotonic functions are integrable, so we know that we can do this.
Then it's clear that $F$ is continuous. It has cusps at every rational, and so it is not differentiable there. Further, $F$ is differentiable at $x$ if and only if $f$ is continuous at $x$.
So $F$ is a continuous monotonic function from $\mathbb{R}$ to $[0,1]$ that is differentiable at exactly the irrationals.
