Proving continuity of $f$ at exactly one point We can check if some function $g(x) =...$ (some random function, irrelevant to this case) is continuous at a given point $x_{0}=c \iff \lim_{x\to c^+} g(x) = g(c) \quad\land\quad \lim_{x\to c^-} g(x) = g(c).$
If both conditions are satisfied, then the function is continuous at such point $x_{0} = c$. I suppose so far everything is correct, I hope?
I need to prove that the function $f(x) = \begin{cases}
             x  & \text{if } x \in \mathbb{Q} \\
             0  & \text{if } x \in \mathbb{R}/\mathbb{Q}
       \end{cases} \quad$ is continuous exactly at one point $x_{0}=0$. The domain is $D_{f}=\mathbb{R}$.
I am struggling because this is a function that is "made out of two sub-functions".
It is clear to me that the reason why this function is continuous only at $x_{0}=0$ is because $0$ is a rational number, so we get $f(0)=0$ for both "sub-functions" - and that is the only point in the graph where both "sub functions" (how do I call it properly?) are in the same spot (touching each other). Thus, function is continuous only at that specific point.
How can I finish the proof in a good, math-fashioned style using limits?
I came up with: $$ x_{0}=0\in \mathbb{Q} \rightarrow \lim_{x\to 0^+} x = 0 \quad \land \quad \lim_{x\to 0^-} x = 0,$$hence function is continuous at $x_{0}=0$. But I am afraid it's not good enough to be a completed proof. 
Hints, tips, advices to formalize this proof are appreciated. Thanks.
 A: Let $x \in \mathbb R$, $x$ constant. If $(\rho_n)$ be a sequence of rational numbers with $$\lim \rho_n = x \Rightarrow \lim f(\rho_n) = \lim \rho_n = x$$
If $(a_n)$ is a sequence of irrational numbers with 
$$\lim a_n = x \Rightarrow \lim f(a_n) = 0$$
then, it is 
$$\lim f(\rho_n)\neq\lim f(a_n) \Leftrightarrow x \neq 0$$
Thus, $f$ is not continuous at $\mathbb R \setminus \{0\}$.
We will now show that $f$ is continuous at $0$. It is $f(0) =0$. For all $|x| < 1$, we have :
$$|f(x) - f(0)| = |f(x)| \leq \max\{|x|,0\} = |x|$$
thus $\lim_{x\to 0} f(x) = f(0)$ which means that $f$ is continuous at $0$.
A: You need to deal with a point $a\in\mathbb{R} $ and consider the case $a=0$ and $a\neq 0$.
The use of $\epsilon, \delta$ definition is particularly very easy here and hence we follow that approach. Let's first prove that $f$ is continuous at $a=0$. Clearly we have $f(a) =f(0)=0$. Let $\epsilon >0$ be given and we choose $\delta =\epsilon $. If $0<|x-a|=|x|<\delta$ then for irrational $x$ we have $$|f(x) - f(a) |=|f(x) |=|x|<\delta =\epsilon $$ and for rational $x$ we have $|f(x) - f(a) |=0<\epsilon $ therefore by definition $\lim_{x\to a} f(x) =f(a) $ and $f$ is continuous at $a=0$.
For $a\neq 0$ we need to consider the cases when $a$ is rational and when $a$ is irrational. I show here the case when $a$ is rational and $a\neq 0$. Here $f(a) =0$ and $|f(x) - f(a) |=|f(x) |$. Let $\epsilon=|a|/2$ and choose any arbitrary $\delta>0$. Then there is an irrational number $x$ which satisfies $$0<|x-a|<\min(\epsilon,\delta)$$ and we have $$|f(x) - f(a) |=|x|=|a-(a-x) |\geq |a|-|a-x|>|a|-\epsilon=\epsilon$$ Thus the limit of $f(x) $ as $x\to a$ is not $f(a) $ and $f$ is discontinuous at $a$. You should prove in similar manner that $f$ is discontinuous at $a$ if $a$ is irrational. 
