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

real-analysis

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

Best Answer

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} \;). $$