Prove that the function $$f(x) = \left\{ \begin{array}{ll} x^2, & x \in \mathbb{Q} \\ 0, & x \in \mathbb{Q}^c \\ \end{array} \right.$$
is differentiable at $x = 0.$
I'm not sure how to calculate the limits for this function (the density of $\mathbb{Q}$ in $\mathbb{R}$ is confusing me). Any advice would be appreciated!
We have $$\lim_{x\to 0,x\in \Bbb {Q}}\dfrac{f(x)-f(0)}{x-0}=0$$ and $$\lim_{x\to 0,x\in \mathbb{R}\setminus\mathbb{Q}}\dfrac{f(x)-f(0)}{x-0}=0.$$ Hence, $f$ is differentiable at $x=0$.