[Math] Prove that f is discontinuous at all the real points except 0 and 1

continuity

My problem is as follows-

Let $f : \mathbb R \to \mathbb R$ be defined in the following manner

$$f(x) = \begin{cases} x & \text{if $x$ is rational,} \\x^2 & \text{if $x$ is irrational.} \end{cases}$$

Prove that $f$ is discontinuous at all the real points except $0$ and $1$.

I tried it like this-

[$f$ is continuous at $a$] $= \forall \epsilon >0, \exists \delta >0, \forall x \in \mathbb R, \text{ s.t. }|f(x)-f(a)|< \epsilon, |x-a|< \delta$

~[f is continuous at a ] = ~[ $\forall \epsilon >0, \exists \delta >0, \forall x \in \mathbb R, s.t. |f(x)-f(a)|< \epsilon, |x-a|< \delta$]

f is discontinuous at a = $\exists \epsilon >0, \forall \delta >0, \exists x \in \mathbb R, s.t. |f(x)-f(a)|> \epsilon, |x-a|< \delta$

Case 1: a=0

f(a)=0 and |x-a|=|x|

$\therefore \exists \epsilon >0,\forall \delta >0, \exists x \in \mathbb R, s.t. |f(x)|> \epsilon, |x|< \delta $ is false.

$\therefore$ f is continuous at 0

Case 2: a=1

f(a)=1 and |x-a|=|x|-1

I don't know how to prove this and the following case.

Case 3: a $\neq$ 0 and a $\neq$ 1

Best Answer

If $a=1$ or $a=0$, both $x$ and $x^2$ approaches 1 and 0 respectively, so limit of $f$ exists and equals $f(1)$, $f(0)$ so are continuous at both $x=1$ and $x=0$.

Suppose that $a\neq 0,1$.

i) If $a\in \mathbb{Q}$, for every $n\in \mathbb{N}$ there exists an irrational $x_n \in (a-\cfrac{1}{n},a)\cup (a,a+\cfrac{1}{n})$. Then $\lim_{n\rightarrow\infty}x_n=a$ but $\lim_{n\rightarrow\infty}f(x_n)=a^2\neq a=f(a)$. So $f$ is discontinuous at $a$.

ii) if $a$ is irrational, then similar arguments with rational sequence $x_n$ shows that $f$ is not continuous at a.