# Question regarding Thomae's function continuity proof

The function defined by $$f(x)=\begin{cases} \frac{1}{q} & x=\frac{p}{q}\in\mathbb{Q}, (p,q)=1 \\ 0 & x\in\mathbb{I} \end{cases}$$ is continuous at every irrational in $$]0,+\infty[$$, but discontinuous at every rational in $$]0,+\infty[$$.

Proof that it's continuous at every non-negative irrational:

Let $$b>0$$ be irrational and $$\varepsilon>0$$. We have to show that there exists a $$\delta>0$$ such that $$|x-b|<\delta\implies |f(x)-f(b)|<\varepsilon.$$ By the archimedian property, there exists a natural number $$n_0$$ such that $$\frac{1}{n_0}<\varepsilon$$.

The interval $$(b-1,b+1)$$ contains finitely many rationals with denominator smaller than $$n_0$$. Therefore, we can choose a $$\delta>0$$ sufficiently small such that the interval $$(b-\delta,b+\delta)$$ does not contain any rational with denominator smaller than $$n_0$$.

It follows that, for $$|x-b|<\delta$$ with $$x>0$$, we have $$|f(x)-f(b)|\leq\frac{1}{n_0}<\varepsilon.$$

I was able to understand the proof, but how can I show that the interval $$(b-1,b+1)$$ contains finitely many rationals with denominator smaller than $$n_0$$?

• Induction?$~~~~~~~$ Commented Oct 24, 2020 at 1:16
• Or pigeon hole principle probably actually Commented Oct 24, 2020 at 1:19

Well.. this is an interval of length $$2$$. Fractions with denominator $$2$$ are within a $$1/2$$ distance from each other, so no more than $$4$$ of those within the given interval. Fractions with denominator $$3$$ are $$1/3$$ distance from each other, so no more than $$6$$ etc. Fractions with denominator less than a given $$n_0$$ are a finite number by the same reasoning.