TITLE: Modified Dirichlet function non-differentiability
QUESTION [6 upvotes]: I need some ideas to start with this problem. Show that the modified Dirichlet function defined as $D_M(x)=\begin{cases}0&\mbox{if }x \notin \mathbb{Q} , \\ \frac{1}{b}&\mbox{for } x = \frac{a}{b} \mbox {with}\gcd(a,b) = 1\;.\end{cases}$
Is not differentiable for any $x_0 \in(c,d)\subset\mathbb{R}$

REPLY [4 votes]: We only need to check this for irrational numbers (since they are continuity points).
So let $x_0\notin\mathbb Q$. We ask whether the limit
$$\lim_{x\to x_0} \frac{f(x)-f(x_0)}{x-x_0}$$ exists.
Now, if $x\notin\mathbb Q$ then $\frac{f(x)-f(x_0)}{x-x_0}=0$.
For rationals we use Dirichlet's approximation theorem:
For a given irrational $x_0$, the inequality
$$\left| x_0 -\frac{p}{q} \right| < \frac{1}{q^2}$$
is satisfied by infinitely many integers p and q. 
Now, for given $\varepsilon>0$ we can choose q such that $\frac1{q^2}<\varepsilon$ and thus $\left| x_0 -\frac{p}{q} \right| < \frac{1}{q^2} < \varepsilon$.
For $x=\frac pq$ we get
$$\left|\frac{f(x)-f(x_0)}{x-x_0}\right| = \frac{\frac1q}{\left|x_0 -\frac{p}{q}\right|} > \frac{\frac1q}{\frac1{q^2}} = q.$$
This shows that $\frac{f(x)-f(x_0)}{x-x_0}$ is unbounded in any neighborhood of $x_0$ (since $q$ can be chosen arbitrarily high). 

After answering the question I tried to google for differentiable "thomae function". Already the first result provides the following article - containing a much simpler proof:  

Kevin Beanland, James W. Roberts and Craig Stevenson: Modifications of Thomae's Function and Differentiability, The American Mathematical Monthly, Vol. 116, No. 6 (Jun. - Jul., 2009), pp. 531-535. link at author's blog, jstor.  

(I saw that I need large denominators, which reminded me of Dirichlet and I overlooked the simple way.)
A little later I've noticed that the simple proof was already suggested in one of joriki's comments - which I've overlooked too.

I think it's worth mentioning different names used for this function (personally, I like popcorn function) - I quote from Wikipedia:
Thomae's function, named after Carl Johannes Thomae, also known as the popcorn function, the raindrop function, the ruler function, the Riemann function or the Stars over Babylon (by John Horton Conway) is a modification of the Dirichlet function.