Is $f:\Bbb Q\rightarrow \Bbb R$ continuous? Define $f:Q\rightarrow R$ such that $f= 1$ if  $x^2<2$  or  $f=0$ is  $x^2>2 $. Is this function continuous? All proofs are welcomed but i am more interested using the definitions  maybe the definition that the preimage of a continuous function sis an  οpen set or the ε,δ definition.My problem is that these definitions are for a single point.How can i use the definitions for every point?Trying to practice on using definitions and get a better understanding for continuity rather than that the graph of f is interrupted or has "holes".
 A: It is continuous.
One way to see this is by using the fact that $x \mapsto x^2$ is continuous in $\mathbb{Q}$. Hence, the sets $A=\{x \in \mathbb{Q} \mid x^2 <2\}, B=\{x \in \mathbb{Q} \mid x^2 >2\} $ are open. Since the pre-images of open sets of your function $f$ are $A,B,\emptyset$ and $\mathbb{Q}$, it follows that $f$ is continuous.
A: Here is a some direction for the kind of proof I think you are looking for:
$f: \mathbb{Q} \to \mathbb{R}$ is defined so that $f(x) = 1$ for $x^2 < 2$ and $f(x) = 0$ for $x^2 > 2$. We would like to show that $f$ is continuous.
In other words, we need to show that $f$ is continuous at any point $a \in \mathbb{Q}$. Because $\sqrt{2} \not\in \mathbb{Q}$, we can think of two exhaustive and exclusive cases: $a^2 > 2$ and $a^2 < 2$. I will show how to handle the first case, the second is similar.
Assume $a^2 > 2$. Then by the density of the rationals in the reals, there must exist another number $b \in \mathbb{Q}$ such that $\sqrt{2} < b < a$. Let $\varepsilon = a-b$. Now, by the definition of $f$, $f(x) = 0$ for all $x$ within $\varepsilon$ of $a$ (i.e. the "ball of radius $\varepsilon$ around $a$").
Can you finish the proof using the $\delta$-$\varepsilon$ definition of continuity of $f$ at $a$?
(I tried to keep this proof as self-contained as possible, but I did use the fact that the rationals are dense in the reals. For the purposes of this proof that means that there is a rational number strictly between any two real numbers. A proofs on MSE are provided in the link.)
A: Realize that your function f is continuous in R. Therefore, it is definitely continuous on a subset of R, which Q is. This is what you call f restricted to Q. Also, from a metric space standpoint, we know that Q is not a closed set since its complement R\Q is not open (you can prove this easily). Therefore, just use the definition of continuity as you pointed out. Take any open set, its pre image will be in Q, which is not closed. 
