Explanation of Proof for (Dis)continuity of Thomae's Function Can someone explain the proof for the continuity at irrationals but discontinuity at rationals for Thomae's function?
 More specifically, why if x is rational with $x = \frac{p}{q}$, and we choose $0<\epsilon<\frac{1}{q}$, does the condition for continuity fail? Please be detailed but not overly technical.
 A: Thomae's function is
$$ f(x) = \cases{1/q & if $x = p/q$ in lowest terms with $q > 0$\cr
                 0 & if $x$ is irrational\cr}$$
If $x =p/q$ is rational, and you take $0 < \epsilon < 1/q$ and any $\delta > 0$, there are irrational numbers $y$ with $|x-y| < \delta$, and then $|f(x) - f(y)| = 1/q > \epsilon$.  So $f$ is discontinuous at $x$.
If $x$ is irrational, for any $\epsilon > 0$, take $Q$ large enough that $1/q < \epsilon$ for $q \ge Q$.  Thus the only $y$ with $|f(y) - f(x)| \ge \epsilon$ are $p/q$ for $q < Q$.  There are only finitely many of these with $|y - x| < 1$, say $p_1/q_1, \ldots, p_n/q_n$.
So we can take $\delta < \min \{|p_i/q_i - x| \mid i = 1 \ldots n\}$.
A: Assume that $f$ is continuous at $x=\frac{p}{q}$ which means that for every $\epsilon > 0 \quad \exists \delta > 0$ such that $\vert f(y) - f(x) \vert < \epsilon $ whenever $\vert y-x \vert < \delta$. Choose $\epsilon < \frac{1}{q}$ which means that $\vert f(y)-\frac{1}{q}\vert < \frac{1}{q}$ whenever $\vert y-x \vert < \delta$. But with in $\delta$ neighbourhood of $x$ there exists a $y'$ which is irrational and $f(y')=0$ which implies that $\vert f(y')-\frac{1}{q}\vert < \frac{1}{q}$ which means $\frac{1}{q} < \frac{1}{q}$. A contradiction! Hence $f$ is not continuous at $x$
