Given that $f(x) = -1$ if $f$ is irrational and $f(x)=1$ if $f$ is rational, show that $f$ is not continuous anywhere.

  1. Let's show that between any 2 rationals there is always an irrational number

Let's consider $a,b \in Q$ such that $a<b$, there is an infinite number of rational $r$ such that $a<r<b$. Where $r=\frac{a+b}{n}$ where $n \in Z$

Also $$a<r<b$$, $$ a +\sqrt{2}<r<b+\sqrt{2}$$ , $$a<r- \sqrt{2}<b$$

It follows that we have always an irrational between any two rationals

  1. Between any two irrationals, we always have a rational.

Here I am not sure how to proceed.

  1. One can find a rational in between two irrationals and vice versa an irrational between two rationals.

Therefore as the value of $x$ approaches a value from the left or right of $r$ , $x$ will oscillates between a rational and irrational infinitely. Therefore limits will oscillate between $1$ and $-1$ infinitely. it shows that $$f(r^-) \neq f(r^+) \neq f(r)$$

it follows that there no continuity anywhere on $D_f$

Is this correct? Is there a more efficient (clean) way to show the discontinuity?

Any input is much appreciated

| cite | improve this question | | | | |
  • 1
    $\begingroup$ For another approach: Take two sequences approaching to $c$: one sequence has only rationals, the other only irrationals. Now your function converges to two different limits as $x \to c$, hence discontinuous at $x=c$. $\endgroup$ – Anurag A Jul 11 '17 at 22:20
  • 1
    $\begingroup$ As written, $f$ is actually continuous. Assume $f(x)=-1$, then $f$ is rational ($-1$ is a rational number), a contradiction, since $f(x)=-1$ only if $f$ is irrational. Thus, $f(x)=1$ for all $x$. $\endgroup$ – Simply Beautiful Art Jul 11 '17 at 23:51

Take a rational $x $ and the irrational sequence $x_n=x+\frac {\pi}{n}$ such that $$\lim_{\infty}x_n=x$$ then

$$\lim_{\infty}f (x_n)=-1\ne f (x) $$ hence, $f $ is not continuous at $x $.

Take an irrational $y $ and the rational sequence $y_n=\frac {\lfloor 10^ny \rfloor}{10^n} $ such that $$\lim_{\infty}y_n=y $$ then $$\lim_{\infty}f (y_n)=1\ne f (y) .$$ You can conclude.

| cite | improve this answer | | | | |
  • $\begingroup$ If $y$ is irrational then how can $y_n+\frac{1}{n}$ be a "rational" sequence converging to $y$?? $\endgroup$ – Anurag A Jul 12 '17 at 3:06
  • $\begingroup$ I think you are missing the point. I am "not" saying that a rational sequence cannot converge to an irrational number, in fact that is the very thing I have written myself in the comments above. What I am saying is that if $y$ is an irrational number then $y+1/n$ will be irrational for all $n \geq 1$, hence it cannot be the sequence of "rational" terms converging to $y$. $\endgroup$ – Anurag A Jul 12 '17 at 16:17
  • $\begingroup$ @AnuragA Hello, You're right. i edited.Thanks. $\endgroup$ – hamam_Abdallah Jul 12 '17 at 21:55

Pick a real number $x$. We will show that $f$ is discontinuous at $x$.

Side Remark: Discontinuity of $f$ at $x$ can be shown by exhibiting at least once sequence $y_{n}$ that converges to $x$, yet violates the requirement $$ \lim_{n \rightarrow \infty} f(y_{n}) = f(\; \lim_{n \rightarrow \infty} y_{n} \;). $$ (Essentially, $f$ is continuous at $x$ if and only if $f$ commutes with the limit operation of convergence to $x$.)

Now, the proof:

Case 1: $x$ is rational. Then there exists a sequence $y_{n}$ of irrational numbers that converges to $x$. Thus, $$ \lim_{n \rightarrow \infty} f(y_{n}) = -1 \neq 1 = f(\; \lim_{n \rightarrow \infty} y_{n} \;). $$

Case 2: $x$ is irrational. Then there exists a sequence $y_{n}$ of rational numbers that converges to $x$. By an argument analogous to that in Case 1, $$ \lim_{n \rightarrow \infty} f(y_{n}) \neq f(\; \lim_{n \rightarrow \infty} y_{n} \;). $$

| cite | improve this answer | | | | |

The key is exactly that between two real numbers there are a rational number and an irrational number.

Your final argument is a bit vague. You can make it rigorous by recalling that, when a function is continuous and positive at a point, it assumes only positive values in a neighborhood of the point. Let's state it more precisely.

Suppose $f$ is continuous at $c\in\mathbb{Q}$; then there exists $\delta>0$ such that, for $|x-c|<\delta$, $f(x)>0$.

There exists $x$ irrational such that $c-\delta<x<c+\delta$: contradiction.

Similarly for $c$ irrational.

More generally, the function $$ g(x)=\begin{cases} a & x\in\mathbb{Q} \\[4px] b & x\in\mathbb{R}\setminus\mathbb{Q} \end{cases} $$ is nowhere continuous when $a\ne b$, because $$ f(x)=\frac{2(g(x)-b)}{a-b}-1 $$

| cite | improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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