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

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

• If you are just trying to show it is continuous at $0$ and $1$, you can just evaluate the limit. – IAmNoOne Jul 5 '14 at 23:13
• How can I prove its discontinuity for other real values? (Case 3) – S.Dan Jul 5 '14 at 23:24
• Try finding a contradiction for the limit. You can use: Q is dense in R and x^2 < x for all x $\in$ ]0,1[ – Loreno Heer Jul 5 '14 at 23:28
• @S.Dan, see answer for sequential continuity. – IAmNoOne Jul 5 '14 at 23:29

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.

Continuing with the idea

case 2:

If $|x-1|< \delta$, if $x$ is rational $|f(x)-1|=|x-1|< \delta=\epsilon$

If $x$ is irrational $|x-1|< \delta$ then

$|f(x)-1|=|x^2-1|=|(x+1)(x-1)|=|(x+1)||(x-1)|<|(x+1)|\cdot\delta$

how $|x-1|< \delta$ then $|x+1|< (\delta+2)$ then $|(x+1)||(x-1)|< (\delta+2)\cdot\delta$

$|(x+1)||(x-1)|< (\delta+2)\cdot\delta=(\delta+1)^2-1$, then $\delta=\sqrt{\epsilon+1}-1$