Prove Discontinuity of the following function f(x)=1, x belongs to rational numbers      and
      =0, x belongs to irrational numbers
Prove that the above function is discontinuous over all real x.
I could not figure out any approach.
 A: We consider two cases.
1) If $x$ is a rational number then there is sequence of irrational numbers which tends to $x$. Since $\sqrt{2}$ is irrational then $x_n=x+\frac{\sqrt{2}}{n}$ is irrational, $x_n\to x$ and $f(x_n)=0$. Hence
$$\lim_{n\to\infty }f(x_n)=0\not=1=f(x)$$
and $f$ is not continuous at $x$.
2) If $x$ is an irrational number then there is sequence of rational numbers which tends to $x$. Since $\mathbb{Q}$ is dense in $\mathbb{R}$ (see Proof that $\mathbb{Q}$ is dense in $\mathbb{R}$), for any $n>0$ there is a rational number $x_n$ between $x$ and $x+\frac{1}{n}$, then $x_n\to x$ and $f(x_n)=1$.
Hence
$$\lim_{n\to\infty }f(x_n)=1\not=0=f(x)$$
and $f$ is not continuous at $x$.
P.S. A function is not continuous at $x$ if there is a sequence $x_n\to x$, such that $\lim_{n\to\infty }f(x_n)\not=f(x)$.
P.P.S. The fact that $\mathbb{Q}$ is dense in $\mathbb{R}$ can be also stated in this way: between two distinct real numbers there is at least a rational number.
A: Hint: for each $x$, choose a sequence of rationals and irrationals $r_n, i_n$ that converges to $x$. Apply $f$ to them.
A: Hint: say $x$ is rational, then $f(x)=1$. In order for $f$ to be continuous, for all $\epsilon > 0$, there would have to be a ball $B_\delta(x)$ so that $|f(x)-f(y)| = |1 - f(y)|< \epsilon$ on $B_\delta(x)$, i.e. $1-\epsilon<f(y)<1+\epsilon$. However, since $\Bbb{R}-\Bbb{Q}$ is dense in $\Bbb{R}$, there will be $y$ values arbitrarily close to $x$ so that $y\notin \Bbb{Q}$, and so $f(y)=0$. So, you just need to find a value for $\epsilon$ for which the definition of continuity doesn't work. The process will be similar for irrational $x$. 
