Let $f(x) = \begin{cases} 0 & \text{if $x$ is rational} \\ 1 & \text{if $x$ is irrational.} \end{cases}$

I want to show that $\lim_{x \to 0} f(x)$ does not exist. Suppose that $\lim_{x \to 0} f(x) = L$ for some real number $L$. This means that for all $\varepsilon > 0$, there exists a $\delta > 0$ such that $|f(x) - L| < \varepsilon$ for all $|x|<\delta$ with $x \in \mathbb R$. Since I wanted to prove the negation, I have to show that for all real numbers $L$, there exists an $\varepsilon > 0$ such that for all $\delta > 0$, there is a number $x \in \mathbb R$ such that $0 < |x|<\delta$ and $|f(x) - L|\ge \epsilon$.

I pick the case that $L=1$ for example, and I let $\varepsilon = 1/2$ and $\delta > 0$. Suppose that $\delta$ is irrational. In the case that $0 < \delta < 1$, if $x_0$ is irrational, then $f(x_0) = 1$ and so $|f(x_0) - L| = 0 < \epsilon$. This implies that $x_0$ cannot be an irrational number that satisfies $|f(x_0) - L| \ge \varepsilon$. So $x_0$ must be rational. The question is, how can I find a rational number $x_0$ such that $0 < x_0 < \delta$ for any arbitrary positive irrational number $\delta$ strictly less than one?

This has confused me a lot. Is there an easier way to prove that a limit does not exist? I've even tried doing a proof by contradiction, but that brings me to the same result.

  • 2
    $\begingroup$ $f(\frac{1}{n})\to 0$ whereas $f(\frac{\sqrt 2}{n})\to 1$ when $n\to \infty $. $\endgroup$
    – Surb
    Commented Jan 29, 2020 at 12:59
  • $\begingroup$ The only thing is that as n approaches infinity, you can't really tell when n is irrational or rational. It's possible that n could be a multiple of $sqrt(2)$, which could make $sqrt(2)/n$ rational. $\endgroup$
    – Tim
    Commented Jan 29, 2020 at 13:02

2 Answers 2


What you wrote doesn't make sense. You wrote “I have to show that for all real numbers $L$ […]” and then you stated that $L=1$.

Let $L$ be an arbitrary real number. Then $L$ cannot be equal to both $0$ and $1$. Suppose that $L\neq0$. Take $\varepsilon=\lvert L\rvert$. Now, let $\delta>0$. The interval $(-\delta,\delta)$ contains rational numbers and for each such rational number $x$, $f(x)=0$. So, we have $\lvert x\rvert<\delta$ and $\bigl\lvert f(x)-L\bigr\rvert\geqslant\varepsilon$.

The case in which $L\neq1$ is similar (take $\varepsilon=\lvert L-1\rvert$).

  • $\begingroup$ I was doing a case by case basis, using L as a separate one. My intention was to do the cases when L>1, L=1, 0<L<1, L=0, and L<0. But I'm confused about why you said that L cannot be equal to 1? $\endgroup$
    – Tim
    Commented Jan 29, 2020 at 13:05
  • $\begingroup$ Exactly where did I say that $L$ cannot be equal to $1$? $\endgroup$ Commented Jan 29, 2020 at 13:08
  • $\begingroup$ "The L cannot be equal to both 0 and 1" $\endgroup$
    – Tim
    Commented Jan 29, 2020 at 13:09
  • $\begingroup$ I think that it is quite trivial that no number can be simultaneously equal to $0$ and to $1$. Do you disagree? $\endgroup$ Commented Jan 29, 2020 at 13:11
  • 1
    $\begingroup$ Actually, I wrote $(-\delta,\delta)$, not $(-\delta,-\delta)$. Anyway, $0\in(-\delta,\delta)$ and $0$ is rational, right?! More generally, you can use the fact that the rationals are dense: every interval $(a,b)$ of real numbers contains rational numbers. $\endgroup$ Commented Jan 29, 2020 at 13:20

If possible let $f(x) \to L \neq 0$ so $|f(x)-L| <\frac {|L|} 2 $ for $|x| <\delta$ for some $\delta$. Choosing $x$ rational with $|x| <\delta$ we get $|L| <\frac {|L|} 2$. This is a contradiction so we must have $L=0$. Now there is a $\delta $ such that$|f(x) |<\frac 1 2 $ for $|x| <\delta$ and we get contradiction again by taking $x$ irrational with $|x| <\delta$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .