Continuous function on $\mathbb{Q}$ Let $f:\mathbb{Q}\to\mathbb{R}$ be a function defined as:
$$f(x) = 
\begin{cases}
    0 &  x^2 < 2\\
    1 &  x^2 \geq 2
\end{cases}
$$ Is this function continuous? How can we check the continuity around $\sqrt{2}$ since it's not in $\mathbb{Q}$?
 A: Because $\sqrt{2}$ is not in $\mathbb{Q}$, you don't have to check continuity at $\sqrt{2}$: it's completely irrelevant!
A: Hint: You are right, you need only check continuity around (i.e. nearby) $\sqrt 2$, not at $\sqrt 2$.
A: $f$ is continuous if it is continuous in every point in $\mathbb Q$. You don't have to check for continuity around a point that does not exist in the domain.
Hint: for all other points, you can see that there exists a neighborhood on which $f$ is constant.
A: Since the image of $f$ is discrete, we need only check that the fibers of $f$ are open. But
$$
f^{-1}(0)=(-\infty,\sqrt{2})\cap\mathbb Q
\quad\text{and}\quad
f^{-1}(1)=(\sqrt{2},\infty)\cap\mathbb Q
$$
so $f$ is continuous.
A: Try to apply the definition of the continuity. Here's my solution.
Let $\epsilon > 0$ and let $x_0 \in \mathbb{Q}$. Now set $\delta$ := |$\sqrt{2}-x_0$|. Then, clearly $\delta \neq 0$ and $\delta >0$.
Let $x \in \mathbb{Q}$ such that |$x-x_0$| < $\delta$
then if $x_0 > \sqrt{2}$ we have $x > \sqrt{2}$ and so $f(x)=1=f(x_0)$ 
and if $x_0 < \sqrt{2}$ we have $x < \sqrt{2} $ and so $f(x)=0=f(x_0)$
So we have | $f(x)- f(x_0)$ | $= 0 < \epsilon$ 
Hence $f$ is continuous in $x_0 \in \mathbb{Q}$ and since this calculation holds for any such $x_0 \in \mathbb{Q}$, we have that $f$ is continuous on $\mathbb{Q}$.
