TITLE: Prove that $f$ is not continuous for any value in $\mathbb R$.
QUESTION [5 upvotes]: I'm having some trouble in the following proof:
Let $f:\mathbb{R\to R}$ be given by:
$$
  f(x) = \begin{cases}
1,&x\in\mathbb Q
\\
0,&x\notin\mathbb Q
\end{cases}
$$
Prove that $f$ is not continuous for any value in $\mathbb R$.
Can anyone please help me with this?
Thank you!

REPLY [4 votes]: Let $x \in \mathbb{R}$.  Let $0 < \epsilon < 1$.   By the density of $\mathbb{Q}$ and $\mathbb{R} \setminus \mathbb{Q}$, for any $\delta > 0$, we can find a rational $q \in  (x - \delta, x + \delta)$ and an irrational $r \in  (x - \delta, x + \delta)$.  If $x \in \mathbb{Q}$, then $|f(x) - f(r)| = 1$.  Otherwise, $|f(x) - f(r)| = 1$.  Hence, $f$ is not continuous at $x$.