Discontinuity of Thomae Function on $\mathbb{Q}$

I know there are many answers for this question. I had read almost every answer And try get arguments But something that goes missing in each time. I had been stuck on this problem since half day but not understating. Please help me in this regard.
Let $f$ be defined on $[0,1]$;

$$ \begin{align} f(x) = \begin{cases} 0 & \text{if $x$ is irrational}\\ \frac{1}{q} & \text{if $x = \frac{p}{q}$ where $(p,q) = 1$ and $q$ > 0}. \end{cases} \end{align} $$
For the rational numbers, I consider a sequence of irrational points $x_n$ converging to some rational number say $m/n$.
If this function is continuous for any rational say $m/n$ then this must hold: $\forall \epsilon >0$ ,$\exists \delta>0$ such that $|1/n|<\epsilon $ whenever $|x_n-m/n|<\delta$.
But for any particular $m/n,1/n$ need not be small. Therefore function is discontinuous at the rational points.

For the irrational points, consider rational sequence $y_n$ converging to $a$, irrational number. Consider $y_n \to a$ therefore $\forall \epsilon >0 $, $\exists N$ such that $|y_n-a|<\epsilon $ $\forall n>N$
In case the function is continuous at $a$ then it must satisfy following
$\forall \epsilon >0 $ ,$\exists \delta>0$ such that|$f(y_n)$|<$\epsilon $ whenever $|y_n-a|<\delta$.
I wanted to make that $f(y_n)$ small for that $y_n$ in neighborhood of $a$.From this I am not able convince myself from last answers.

This is not a duplicate, since I specified my particular problem with this proof. Please help me.


Solution 1:

Let $x$ be irrational. $\epsilon>0$. We know that there are finitely many $q\in\mathbb{N}$ such that $\frac{1}{q}\geq \epsilon$. We also know that for each such $q$, there are finitely many $p\in\mathbb{Z}$ such that $|x-\frac{p}{q}|<1$, because $-q+qx<p<q+qx$ for finitely many $p\in\mathbb{Z}$.

This means that there are finitely many $\frac{p}{q}\in\mathbb{Q}$ with $\text{gcd}(p,q)=1$ such that $|x-\frac{p}{q}|<1$ and $f(\frac{p}{q})=\frac{1}{q}\geq \epsilon$, so call this (finite) set $R$ (the set of these chosen rationals), and we may take $\delta=\frac{1}{2}\min_\limits{r\in R}\{1,|x-r|\}$. This $\delta$ makes sure that we throw out these kind of rationals that have $\frac{1}{q}\geq \epsilon$.

So for $|x-\frac{p}{q}|<\delta$ with $\text{gcd}(p,q)=1$ we have $|f(\frac{p}{q})|=\frac{1}{q}< \epsilon$. Therefore $f$ is continuous in the irrationals.


Remark: We saw that there are finitely many $\frac{p}{q}$ with $p\in\mathbb{Z}$ and $q\in\mathbb{N}$ such that $|x-\frac{p}{q}|<1$ and $f(\frac{p}{q})=\frac{1}{q}\geq \epsilon$. Now adding the restriction $\text{gcd}(p,q)=1$ gives us even fewer of these rationals, so of these there are also finitely many.