Prove $f(x)$ is differentiable at a point. 
Let $f(x)$ be a funciton defined over $(0,1)$ such that
$$f(x)=\begin{cases} \dfrac{1}{p^3},&x=\dfrac{q}{p},\text{where} ~p,q
 \in \mathbb{N}, \text{and}~ {\rm GCD}(p,q)=1,\\ 0, &\text{otherwise}. 
 \end{cases}$$
Prove $f(x)$ is differentiable at $x=\dfrac{n\sqrt{2}}{m}$ for any
$m,n \in \mathbb{N}$.

Obviously, what we need to do is show that
$$\lim_{h \to 0}\dfrac{f\left(\dfrac{n\sqrt{2}}{m}+h\right)-f\left(\dfrac{n\sqrt{2}}{m}\right)}{h}$$
exists. Since $\dfrac{n\sqrt{2}}{m}$ is irrational, $f\left(\dfrac{n\sqrt{2}}{m}\right)=0$. Therefore
$$\lim_{h \to 0}\dfrac{f\left(\dfrac{n\sqrt{2}}{m}+h\right)-f\left(\dfrac{n\sqrt{2}}{m}\right)}{h}=\lim_{h \to 0}\dfrac{f\left(\dfrac{n\sqrt{2}}{m}+h\right)}{h}.$$
How to go on?
 A: The differential quotient
$$
\frac{f\left(x\right)-f\left(\frac{n\sqrt{2}}{m}\right)}{x - \frac{n\sqrt{2}}{m}}
$$
is zero for irrational $x$, therefore it remains to show that it tends to zero for rational numbers $x\to \frac{n\sqrt{2}}{m}$.
For $x=q/p$ is
$$
\left|\frac{f\left(x\right)-f\left(\frac{n\sqrt{2}}{m}\right)}{x - \frac{n\sqrt{2}}{m}} \right|
= \frac{1}{p^3\left| \frac qp - \frac{n\sqrt{2}}{m}\right|}
= \frac{m}{p^2|qm - pn \sqrt 2|} = \frac{m(qm+pn\sqrt 2)}{p^2|(qm)^2-2(pn)^2|} \, .
$$
Here we have expanded the fraction such that $|(qm)^2-2(pn)^2|$ in the denominator becomes a non-zero integer. It follows that
$$
\left|\frac{f\left(x\right)-f\left(\frac{n\sqrt{2}}{m}\right)}{x - \frac{n\sqrt{2}}{m}} \right|
\le \frac{m(qm+pn\sqrt 2)}{p^2} = \frac{m(xm+n\sqrt 2)}{p} \, .
$$
If $x_k = q_k/p_k$ converges to $\frac{n\sqrt{2}}{m}$ then necessarily $p_k \to \infty$, and therefore
$$
\frac{f\left(x_k\right)-f\left(\frac{n\sqrt{2}}{m}\right)}{x_k - \frac{n\sqrt{2}}{m}} \to 0 \, .
$$
This proves that $f'\left( \frac{n\sqrt{2}}{m}\right) = 0$.
