Proof regarding limits of a function $ f(x) = \begin{cases} x, & \text{if $x$ rational} \\ 0, & \text{if $x$ irrational} \end{cases}$

calculuslimits

I'm trying to prove that

$ f(x) =
\begin{cases}
x, & \text{if $x$ rational} \\
0, & \text{if $x$ irrational}
\end{cases}$

does not approach any limit near $a$ if $a\neq0$.

I noted this means that for any $a$ and for any $m$, $\lim \limits_{x \to a} f(x)\neq m$. Hence, I assumed $\lim \limits_{x \to a} f(x)=m$ and tried to find a contradiction, using proof by cases.

Firstly, for any interval around $a$, there is an $x_1$ for which $f(x_1)=x_1\neq0$ and an $x_2$ for which $f(x_2)=0$.

If $m\neq0$, then $\lvert f(x_2)-m\rvert=\lvert m\rvert\lt\epsilon$ is false if we let $\epsilon=\lvert \frac m2\rvert$

Now, the problem happens when $m=0$, since I don't know how to prove that $\lvert f(x_1)-m\rvert=\lvert x_1\rvert\lt\epsilon$ is false for some $\epsilon$.

Intuitively, I understand that if $x$ is very close to $a$ and $a\neq0$, then letting $\epsilon=\lvert \frac a2\rvert$ should lead to a contradiction, but I can't express this formally.

If possible, I'd prefer a simple proof, since the only calculus concepts I currently understand are limits and continuity.

Best Answer

The negation of the definition of $\lim_{x\to a}f(x)=L$ says the following:

there exists $\epsilon>0$ such that for every $\delta>0$ there exists $x$ with $x\in(a-\delta,a+\delta)\setminus\{a\}$ and $|f(x)-L|>\epsilon$.

  • If $L\ne 0$, set $\epsilon=\frac{|L|}{2}$. Then by the density of irrational numbers in $\mathbb{R}$, for every $\delta>0$, there exists an irrational number $x_0\in(a-\delta,a+\delta)\setminus\{a\}$ so that $$ |f(x_0)-L|=|L|>\epsilon. $$

  • If $L=0$ and $a> 0$, set $\epsilon=\frac{a}{2}$. Then by the density of rational numbers, for every $\delta>0$, there exists a rational number $r\in (a+\delta/2,a+\delta)\subset(a-\delta,a+\delta)\setminus\{a\}$ so that $$ |f(r)-L|=|r|>a>\epsilon. $$

  • If $L=0$ and $a< 0$, set $\epsilon=\frac{|a|}{2}$. Then by the density of rational numbers, for every $\delta>0$, there exists a rational number $r\in (a-\delta,a-\delta/2)\subset(a-\delta,a+\delta)\setminus\{a\}$ so that $$ |f(r)-L|=|r|>|a|>\epsilon. $$

Related Question