Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|cite|improve this question
are you looking for a hint or a solution? What did you try so far? – Ittay Weiss Jan 9 '13 at 21:59
Try with the sequential characterization of continuity, the density of $\mathbb{Q}$ in $\mathbb{R}$, and the density of $\mathbb{R}\setminus \mathbb{Q}$ in $\mathbb{R}$. – 1015 Jan 9 '13 at 22:00
Do you know the definition of what it means for $f$ to be continuous at some value of $R$? – MJD Jan 9 '13 at 22:01
@IttayWeiss For a solution. – Gabriel Bianconi Jan 9 '13 at 22:45
@MJD I've studied the definition in terms of limit (lim x->c f(x) = f(c)). – Gabriel Bianconi Jan 9 '13 at 22:46
up vote 6 down vote accepted

Let $x\in \Bbb R$, and $\epsilon=1/2$. If $f$ is continuous, then there should be a $\delta$ region around $x$ which is sent entirely inside $(f(x)-\epsilon, f(x)+\epsilon)$.

But what do you know about rationals and irrationals in intervals? Draw a picture for the two cases ($f(x)=1$ and $f(x)=0$) and you should see what's going on.

share|cite|improve this answer

Let $x\in\mathbb R$. Show that there is a sequence of rational numbers $q_n\to x$ and another sequence of irrational numbers $r_n\to x$.

We have that $\lim_{n\to\infty} q_n=\lim_{n\to\infty} r_n$. But what can you say about $\lim_{n\to\infty} f(q_n)$ and $\lim_{n\to\infty} f(r_n)$?

share|cite|improve this answer

Recall that if a function is continuous, then it is also sequentially continuous.

Now consider $x \in \mathbb{R}$.

If $x \in \mathbb{Q}$, consider the sequence $x_n = x - \dfrac1{n\sqrt2}$. Clearly, $x_n \in \mathbb{R} \backslash \mathbb{Q}$ and $x_n \to x$.

Hence, $f(x_n) = 0$ for all $x_n$, whereas $f(x) = 1$.

Do a similar argument when $x \in \mathbb{R} \backslash \mathbb{Q}$. Consider the sequence $x_n = \dfrac{\lfloor 10^n x \rfloor}{10^n}$. Clearly, $x_n \in \mathbb{Q}$ and $x_n \to x$.

Hence, $f(x_n) = 1$ for all $x_n$, whereas $f(x) = 0$.

share|cite|improve this answer

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

share|cite|improve this answer
Your answer was great too! However, I decided to accept rschwieb's answer because he posted it earlier. Thank you very much Brian! – Gabriel Bianconi Jan 9 '13 at 22:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.