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.
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$.