Consider $f:\Bbb{R} \rightarrow \Bbb{R}$ by$$f(x)=\begin{cases} \frac{p+\sqrt{2}}{q+\sqrt{2}}-\frac{p}{q} &\text{if}\;x=\frac{p}{q}\in\Bbb{Q}\;\text{with}\;\text{gcd}(p,q)=1\\ \\0 & \text{otherwise} \; \end{cases}$$
Prove: $f$ is continuous at $(\Bbb{R} \setminus \Bbb{Q}) \cup \{1\}$
Here's my try:
Let $x_n \in (\Bbb{R} \setminus \Bbb{Q}) $ so that $x_n \rightarrow x=p/q \in \Bbb{Q}$ , so $f(x_n)=0$.
Therefore we make $f$ continuous at this $x$,we have $f(x)=0$. But $f(x)=0$ only when $p=q$ and so $p/q=1$. So $f$ is continuous at $1$
Let $b$ be an arbitrary irrational number. Now check the continuity at $b$:
Whatever we make $\vert x-b \vert < \delta$, $\vert f(x)-f(b) \vert = \vert f(x) \vert < \epsilon$
Since $x \in (b-\delta,b+\delta)$ is irrational, then $f(x)=0<\epsilon$
and $x \in (b-\delta,b+\delta)$ is rational except $1$, so $x=p/q$ and note that $f(x)=\frac{p+\sqrt{2}}{q+\sqrt{2}}-\frac{p}{q}$ is irrational,since $p \neq q$, we conclude $f(x)=0< \epsilon$
Summary: For every $x \in N_\delta(b)$, $\vert f(x)-f(b) \vert < \epsilon$
Am I right? Any Thoughts?
First we try to simplify the function $$f(x)=\begin{cases} \frac{p+\sqrt{2}}{q+\sqrt{2}}-\frac{p}{q} &\text{if}\;x=\frac{p}{q}\in\Bbb{Q}\;\text{with}\;\text{gcd}(p,q)=1\\ \\0 & \text{otherwise} \; \end{cases}=\begin{cases} \dfrac{\sqrt{2}(q-p)}{q(q+\sqrt{2})}=\dfrac{\sqrt 2(1-x)}{q+\sqrt 2} &\text{if}\;x\in\Bbb{Q}\\ \\0 & \text{otherwise} \; \end{cases}$$for some $x_0\in \Bbb Q^c$ it is quite obvious that for $x\in \Bbb Q^c$ and $x\to x_0$ we have $f(x)=0$. If $x\in\Bbb Q$ notice that $x\to x_0$ and $q$ grows unbounded (why?), so the numerator of $\dfrac{\sqrt 2(1-x)}{q+\sqrt 2}$ remains bounded around $\sqrt 2(1-x_0)$ and the denominator goes to $\infty$. This means that $\dfrac{\sqrt 2(1-x)}{q+\sqrt 2}\to 0$ as $x\to x_0$ and therefore the function is continuous over $\Bbb R-\Bbb Q$ so in $x_0=1$ because $x=1$ is a root of $\dfrac{\sqrt 2(1-x)}{q+\sqrt 2}$ so that even if $q\not\to\infty$ we have $1-x\to 0$ and $f(x)\to 0$ which completes our proof.