To prove continuity using sequential definition of continuity I have to show that the function   
$$f(x) = \begin{cases}\;\; x &, \text{ if } x \text{ is rational} \\ - x &, \text{ if } x \text{ is irrational} \end{cases}$$
is continuous at $0$ and nowhere else.
ATTEMPT
I first consider a point which is not equal to $0$. Now there exists a sequence of irrationals (say $i_n$) which converge to $x_0\neq0$. $f(i_n)=-i_n$ which converges to $-x_0$. Thus violating definition of continuity. I am having doubt as to how to prove continuity at $0$ and about existence of such sequences of rationals and irrationals.
Thanks 
 A: For any real number $r$ there are a sequence $(r'_n)_{n\in\mathbb{N}}$ consisting of rational numbers and a sequence $(r''_n)_{n\in\mathbb{N}}$ consisting of irrational numbers such that
$$
r=\lim_{n\to\infty}r'_n=\lim_{n\to\infty}r''_n
$$
I'll prove this later. Now, let $r\ne0$; then
$$
\lim_{n\to\infty}f(r'_n)=\lim_{n\to\infty}r'_n=r
$$
whereas
$$
\lim_{n\to\infty}f(r''_n)=\lim_{n\to\infty}-r''_n=-r
$$
So the function $f$ is not continuous at $r$.
Suppose, instead, that $\lim_{n\to\infty}a_n=0$ (with no other hypothesis on the terms of the sequence. Then $\lim_{n\to\infty}|a_n|=0$ and, since $-|a_n|\le f(a_n)\le |a_n|$, the squeeze theorem tells you that
$$
\lim_{n\to\infty}f(a_n)=0
$$
so the function $f$ is continuous at $0$.
How to define the two sequences? The key is that, given $a<b$, there are $c$ and $d$ such that


*

*$a<c<b$, $a<d<b$

*$c$ is rational

*$d$ is irrational


So, define $r'_n$ to be a rational number in the interval $(r,r+1/n)$ and $r''_n$ to be an irrational number in the interval $(r,r+1/n)$. The squeeze theorem says that
$$
\lim_{n\to\infty}r'_n=r=\lim_{n\to\infty}r''_n
$$
A: About the continuity at $x_0 = 0$. 
We know that a function $f$ is continuous at a point $a$ when:
$$f(x_n) \to f(a), \text{ whenever } x_n \to a.$$ We take any sequence of irrational numbers $\{x_n\}$ such that $x_n \to 0$. Then, we have that $$f(x_n) = - {x_n} \to 0 = f(0).$$

Additional to comment:
The answer  comes from topology. We know that $\overline{\mathbb {R} \setminus \mathbb Q} =\text{cl} (\mathbb R \setminus \mathbb Q ) =\mathbb R$ is the set of all limits of convergent sequences in $\mathbb R \setminus \mathbb Q$. Thus, every $x \in  \mathbb R$ can be approached by a sequence in $\mathbb R \setminus \mathbb Q$.
A: Continuity at $0$: We have $f(0)=0$ and $|f(x)| = |x|.$ Thus $|f(x)-0|=|x|\to 0$ as $x\to 0.$
