$\begingroup$

I am trying to prove the following function is continuous for all irrationals:

$f(x) = \begin{cases} 0, & \text{if $x$ is irrational} \\ 1/n, & \text{if $x = m/n$} \end{cases}$

The question assumes $m/n$ is in lowest terms.

I have shown that it is discontinuous for all rationals, and now I believe I have to either use the $\epsilon-\delta$ definition of continuity or sequential continuity to show the function is continuous for when $x$ is irrational.

I split my attempt into two cases:

Our value of $x$ is irrational, then I want: $$\forall \epsilon > 0, \exists \delta > 0, |x-a| $a$ is irrational here.

Using that $x$ is irrational I get that $f(x) = 0$ as does $f(a)$ so no matter the $\delta$ we have our condition for continuity satisfied as $0 < \epsilon$ for all $\delta$

Our value of $x$ is rational i.e. $x = \frac{m}{n}$ subbing in we want: $$\forall \epsilon > 0, \exists \delta > 0, |\frac{m}{n}-a|

I am struggling to find the $\delta$ necessary. I am able to bound $|\frac{m}{n}-a|$ by $1+2|a|$ if I say that $\delta \le 1$. However I do not know how to find a $\delta$ to yield the second inequality.

Should I change my approach to sequential continuity?