# Thread: Proving a function is discontinuous

1. ## Proving a function is discontinuous

Let $f(x)=1$ if $x\in \mathbb{Q}$ and $f(x)=0$ if $x\notin \mathbb{Q}$. Show that $f$ is discontinuous for all $x\in \mathbb{R}$

I know that I should find a sequence $(x_{n})$ where $\lim_{n\to \infty}x_{n} = x$, where $x_{n}$ is rational for even $n$ and irrational for odd $n$ (or vice versa), but I do not know how to find such a sequence.

2. You just need to find one sequence in $\mathbb Q$ with limit in $\mathbb R - \mathbb Q$

For example

$x_1=1$
$x_2=1+\frac{1}{2}$
$x_3=1+\frac{1}{2+\frac{1}{2}}$

etc

This sequence is obviously made of rationals but its limit is $\sqrt{2}$

so

$\lim f(x_n)=\lim 1 = 1 \not = 0 = f( \lim x_n) = f(\sqrt{2})$

But any such sequence works! For example a sequence of rationals with $\pi$ as limit.

3. But that is for specific values of $x$, is there any way to have a generalized case? Because the general idea and hint that the book suggests is that when you have $x_{n}$ be rational for even $n$ and irrational for odd $n$, so that the sequence $f(x_{n})$ does not converge at all. Because to me, it seems that all you've shown is that the function is discontinuous for irrational $x$ (because I believe there is a lemma that states that any real number is the limit of a sequence of rational numbers).

Edit: Nevermind, if we have $x\in \mathbb{Q}$, then $\lim_{n\to \infty}(x + \frac{1}{\sqrt{2} + n}) = x$, but all the terms of the sequence $x_{n} = x + \frac{1}{\sqrt{2} + n}$ are irrational.

4. Given any $a\in \mathbb{R}$ there is a sequence of rationals $\left(q_n\right)\to a$.
There is a sequence of irrationals $\left(\gamma_n\right)\to a$.
Now define a new sequence $x_n = \left\{ {\begin{array}{rl} {q_n ,} & {\text{n is even}} \\ {\gamma _n ,} & {\text{n is odd}} \\ \end{array} } \right.$

5. Thanks. I know it's not the topic, but could you perhaps prove that? We never proved in my class that any real number is the limit of a sequence of rationals or irrationals.

Edit: D'oh, I guess the sequence I suggested in my previous post shows the irrational part of the proof, but how is the rational part proven?

6. Originally Posted by Pinkk
Thanks. I know it's not the topic, but could you perhaps prove that? We never proved in my class that any real number is the limit of a sequence of rationals or irrationals.
Theorem: Between any two numbers there is a rational number and an irrational number.
So between $a~\&~a+1$ there is a rational number $q_1$.
Between $a~\&~a+0.5$ there is a rational number $q_2$.
In general, between $a~\&~a+2^{-n+1}$ there is a rational number $q_n$.
Thus $\left(q_n\right)\to a$.

The same for the irrational case.

7. Ah okay, gotcha, that makes sense. Thanks again.

8. Originally Posted by Pinkk
Let $f(x)=1$ if $x\in \mathbb{Q}$ and $f(x)=0$ if $x\notin \mathbb{Q}$. Show that $f$ is discontinuous for all $x\in \mathbb{R}$

I know that I should find a sequence $(x_{n})$ where $\lim_{n\to \infty}x_{n} = x$, where $x_{n}$ is rational for even $n$ and irrational for odd $n$ (or vice versa), but I do not know how to find such a sequence.
I'm not sure this is what Plato did...it looks different...

Let $x\in\mathbb{R}$ since both $\mathbb{Q},\mathbb{R}-\mathbb{Q}$ are dense in $\mathbb{R}$ there exists sequences of points $\{q_n\},\{i_n\}$ which lie in both. Now, if we assume that $f$ is continuous at $x$ then $1=\lim\text{ }f(q_n)=f(x)=\lim\text{ }f(i_n)=0$. Contradiction.

Alternatively, assume that $f$ is continuous at $x$ and WLOG assume that $f(x)=1$. Clearly then $0\notin B_{\frac{1}{2}}(f(x))$ but by continuity we should be able to find some $B_{\delta}(x)$ such that $f\left(B_{\delta}(x)\right)\subseteq B_{\varepsilon}(f(x))$. See a problem?