Let $$f(x) = \begin{cases} \dfrac{1}{q^2}, & \text{if $x=\dfrac{p}{q} $ is rational and in lowest terms;} \\[2ex] 0, & \text{if $x$ is irrational} \end{cases}$$ Where is f continuous? Is f differentiable anywhere?
My attempt: I can prove that $\lim_{x \to c}f(x)=0$ for any point real value c.
for each positive number $\epsilon$, the set $(c-1,c) \cup(c,c+1)$ contains only finitely many rational numbers p/q with $1/q^2 \geq \epsilon$ (namely , $q^2 \leq 1/\epsilon$). Then I let $\delta$ be the distance between $c$ and the closest such rational number. Then for all x satisfying $0<|x-c|<\delta$, we have $0\leq f(x)=f(p/q)=1/q^2 \leq \epsilon$.
Thus, I prove that $\lim_{x \to c}f(x)=0$ for any point real value c. So this means f(x) is continuous at every irrational number, and discontinuous at every rational number.
For differentiability, I only know f(x) is not differentiable at every rational number, because its discontinuous there. But how to prove f(x) also not differentiable at every irrational number?
Hint: For any irrational number c, there are infinitely many fractions p/q in lowest terms such that $|c-p/q|<1/q^2$. But I don't know this hint is is used in the continuous part ot differentiable part, since I already proved the continuous part.