Consider the function $f: (0, 1) \to \mathbb{Q}$ defined by $$f(x) = \begin{cases} 0, & x\text{ irrational} \\ 1/q, & x = p/q\text{ in lowest terms.} \end{cases}$$ The problem is to show that $\lim\limits_{x \to a}f(x) = 0$, using $\delta$-$\epsilon$, for all $a \in (0, 1)$. That is, for all $\epsilon >0$ there is a $\delta > 0$ such that for all $x$ satisfying $0 < |x - a| < \delta$, $|f(x)-0| <\epsilon$.
If $x$ is irrational, this is trivial. Edit: as discussed in the comments, this isn't as trivial as I thought it was.
But what if $x$ is rational? Then $f(x) = 1/q$ as shown above, so $$\left|\dfrac{1}{q}\right| < \epsilon\text{.}$$ I'm used to $\delta$-$\epsilon$ problems where I can "work backwards" to find $\delta$, but obviously $1/q$ isn't a function of $x$, and I'm lost as to what to do here. I sort of understand the discussion in Spivak, but I'm not quite getting how the discussion helps me find $\delta$, so I thought someone here could enlighten me.
As mentioned in the comments, I don't agree that this is a duplicate.