to prove $f(x) $ is continuous for all irrational values of x For $x>0$, let $f(x) $=
$$\begin{equation}=
    \begin{cases}
      \frac{1}{q} \;\;\; \text{if} x= \frac{p}{q} \text{where p and q} > 0\\
     0 \;\; \text{if} \;x \;\text{is irrational} \\
    \end{cases}
  \end{equation}$$
p and q are relatively prime integers, then prove that $f(x) $  is continuous for all irrational values of x.
My doubt,
Here we can't apply LHL and RHL since we don't know if its irrational or rational ( which I think is similar to dirichlet function)
and also we cannot bring irrational number in $\frac{p} {q}$ form then it will be like we are assuming it to be rational number.
So I am not to able to move forward in this question.
 A: Let $x$ be an irrational number and let $x_n$ be any sequence such that
$$\lim_{n\to\infty}x_n=x$$
To show continuity, we must show
$$0=\lim_{n\to\infty}|f(x_n)-f(x)|=\lim_{n\to\infty}f(x_n)$$
Let $\epsilon>0$ be given. Now, there are two cases:
Case $1$: $x_n$ is made up of a finite number of rational numbers. Then take $N$ such that $x_n$ is irrational for $n\geq N$. Then for $n\geq N$ we have
$$f(x_n)=0<\epsilon$$
and we are done.
Case $2$: $x_n$ is made up of an infinite number of rational numbers. Let $b_k$ be the denominators in
$$x_{n_k}=\frac{a_k}{b_k}$$
(where $x_{n_k}$ is the subsequence made of all the rational members of $x_n$). Now, $b_k\to\infty$ (as well as $a_k$ but this is not important). If this were not the case, then there would be some subsequence of $b_k$ such that $b_{k_i}<M\in\mathbb{N}$ for all $i\in\mathbb{N}$. But then
$$0=\lim_{i\to\infty}\left| x-\frac{a_{k_i}}{b_{k_i}}\right|$$
Multiplying by $M!$ we have
$$0=\lim_{i\to\infty}\left| M!x-M!\frac{a_{k_i}}{b_{k_i}}\right|$$
But $M!x$ is irrational and $M!\frac{a_{k_i}}{b_{k_i}}$ is a natural number for all $i$. This is a contradiction as a sequence of natural numbers cannot approach an irrational number. Therefore, $b_k\to\infty$. Using this knowledge, let $N$ be the smallest natural number such that $\frac{1}{b_k}<\epsilon$ for $k\geq N$. Then
$$f(x_n)=\begin{cases}
      \frac{1}{b_k} & x_n\in\mathbb{Q}\\
     0 & x_n\not\in\mathbb{Q} \\
    \end{cases}\leq \frac{1}{b_k}<\epsilon$$
and we are done
