# a problem on continuity on rational and irrational point

Let $f$ be the function on $\mathbb{R}$ defined by $f(t) = \frac{p+\sqrt{2}}{q+\sqrt{2}}−\frac{p}{q}$ if $t = \frac{p}{q}$ with $p, q \in \mathbb{Z}$ and $p$ and $q$ coprime to each other, and $f(t) = 0$ if $t$ is irrational.

1. At which irrational numbers $t$ is $f$ is continuous?

2. At which rational numbers $t$ is $f$ continuous?

I am totally stuck in this problem. How should I able to solve this problem?

-

Suppose $f$ is continuous on the rational number $t=\frac{p}{q}$. This means that if $x_n \to t$ then $f(x_n) \to f(t)=\frac{p+\sqrt{2}}{q+\sqrt{2}}-\frac{p}{q} = \frac{\sqrt{2}(q-p)}{q(q+\sqrt{2})}$. Since the irrationals are dense, there's a sequence of irrational numbers $y_n$ tending to $t$, in which case we must have $0=f(y_n) \to \frac{\sqrt{2}(q-p)}{q(q+\sqrt{2})}$, proving $\frac{\sqrt{2}(q-p)}{q(q+\sqrt{2})}=0$, i.e. $p=q$, or: $t=1$.
We'll prove that $f$ is indeed continuous on $1$. Let $x_n$ be a sequence of numbers tending to $1$. We can assume that it consists of rational numbers $\frac{a_n>0}{b_n>0}$ (since irrationals always give the value of the limit). We need to show $\frac{a_n+\sqrt{2}}{b_n+\sqrt{2}} - \frac{a_n}{b_n} \to 0$, or $\frac{a_n+\sqrt{2}}{b_n+\sqrt{2}} \to 1$, or $\frac{a_n-b_n}{b_n+\sqrt{2}} \to 0$ , or $\frac{\frac{a_n}{b_n}-1}{1+\frac{\sqrt{2}}{b_n}} \to 0$, which is true since the nominator goes to 0 and the denominator is bounded from below by 1.
Time for part 1. Say $f$ is continuous at the irrational $t$. Since $f(t)=0$, we need to determine when $\frac{a_n}{b_n} \to t$ implies $f(\frac{a_n}{b_n}) = \frac{\sqrt{2}(b_n-a_n)}{b_n(b_n+\sqrt{2})} = \sqrt{2} (1-\frac{a_n}{b_n})\frac{1}{b_n+\sqrt{2}}\to 0$. Since $\sqrt{2} (1-\frac{a_n}{b_n}) \to \sqrt{2}(1-t)\neq 0$, we need to understand when $\frac{a_n}{b_n} \to t$ implies $|b_n + \sqrt{2}| \to \infty$, i.e. $|b_n| \to \infty$.
This is always implied, since an irrational $t$ cannot be approximated by rational numbers with bounded denominator. Consider the set $A=\{ \frac{a}{b} | 1 \le |b| \le M \}$. We'll show that $c_{M}=\min_{x \in A} |x-t|$ exists and is positive. It exists since for any option of $b$ (there are finitely many), there's a best suitable $a$: this amounts to finding the closest integer to a number, $\min_{a \in \mathbb{Z}} |\frac{a}{b}-t| = \frac{1}{b}\min_{a \in \mathbb{Z}} |a-tb|$. It is positive since $t$ is irrational. This shows that for any $M$, there's $N$ such that $n \ge N \implies |b_n| > M$, just take $N$ such that $|\frac{a_n}{b_n}-t| < c_M$ for $n\ge N$.
In conclusion: $f$ is continuous on $1$ and on irrational numbers, i.e. whenever it attains 0.