Michael Spivak Calculus Limits problem proof verification

calculusepsilon-deltalimitslimits-without-lhopitalsolution-verification

I would like to know whether my answer to the following exercise problem in Calculus by Spivak is correct.

The statement of the problem is:
Prove that if $f(x)=x$ for rational $x$, and $f(x) = -x$ for irrational $x$, then $\lim_{x\to a}f(x)$ does not exist when $a\neq0$

My answer:
Proof by contradiction: Let $\lim_{x\to a}f(x)=L$

Case 1: When $a > 0 $, $\exists\ \delta > 0 $ such that $0<|x-a|<\delta \implies |f(x)-L|<a$

Let $x_1 \in \mathbb{Q}$ and $x_2 \in \mathbb{R-Q}$ such that $x_1,x_2 \in (a, a+\delta)$, then
$|f(x_1)-L|<a$ and $|f(x_2)-L|<a$ and hence by the triangle inequality we have $|f(x_1) – f(x_2)|=|f(x_1)-L-(f(x_2)-L)| \leq |f(x_1) – L| + |f(x_2) – L| < a + a = 2a$

Therefore we have $|f(x_1)-f(x_2)| < 2a$

But, $f(x_1)=x_1 > a$ and $f(x_2)=-x_2 < -a$
Therefore $f(x_1) – f(x_2) = x_1 + x_2 > 2a > 0 \implies |f(x_1) – f(x_2)| > 2a$, a contradiction.

The case when $a<0$ is very similar, we just set $\epsilon = -a$ in the definition of the limit and let $x_1,x_2 \in (a-\delta, a)$

Best Answer

Here is another argument based on Denseness of rationals and irrationals, pick arbitrary $a \in \mathbb{R}$ and

since we know that $\mathbb{Q}$ is Dense in $\mathbb{R}$(rational numbers are Dense ) we have that there exists a sequence $(x_n \in \mathbb{Q}) \rightarrow a$ hence we have that

$$\lim_{ n \rightarrow \infty} f(x_n) = \lim_{n \rightarrow \infty} x_n =a $$

again, since we know that $\mathbb{I}$ is Dense in $\mathbb{R}$(irrational numbers are Dense) we have that there exists a sequence $(x_n \in \mathbb{I}) \rightarrow a$ hence we have that $$\lim_{n \rightarrow \infty} f(x_n) = \lim_{n \rightarrow \infty} -x_n = -a$$

hence we have that limit exists iff $a = -a $ which happens only when $a=0$