Consider the function
$$f(x)=\begin{cases} x^2 & x \in \mathbf{Q}, \\ 0 & x \notin \mathbf{Q} \end{cases} $$
$f$ is continuous only at $0$ and now I need to show that at this point it is also differentiable. So
$$f'(0) = \lim_{x \to 0 } \frac{f(x)}{x}$$
How do I continue from here? All suggestions are welcome. Thank you.
Since $|f(x)| \le x^2$, we have $f(0) = 0$ and $\left| {f(x) - f(0) \over x } \right| \le |x|$. This gives $\lim_{x \to 0} \left| {f(x) - f(0) \over x } \right| = 0$. Hence $\lim_{x \to 0} {f(x) - f(0) \over x } = 0$. Since $f'(0) = \lim_{x \to 0} {f(x) - f(0) \over x } = 0$, we see that $f$ is differentiable at $x=0$ and the derivative is $f'(0) = 0$.
Aside: If $|x_n| \to 0$, we must have $x_n \to 0$. This follows from $-|x_n| \le x_n \le |x_n|$.