Does the following function have a limit as x approaches a?

$f(x) = 0$ if x is irrational, $f(x) = 1$ if x is rational.

Answers given in terms of delta-epsilon please!

My thoughts so far:

(1.) Its graph seems to show this function acting as though it were two constant functions

(2.) Between any two rational numbers there are infinitely many rational numbers; between any two rational numbers there are infinitely many irrational numbers. So I cannot think of any interval where rational numbers wouldn't interrupt irrational numbers, or irrational numbers interrupt rational numbers.

I'm sorry to have so little to add to the question. This is just one of those functions which goes beyond anything you've learned.

  • $\begingroup$ Similar (math.stackexchange.com/questions/403338/…) $\endgroup$ Nov 24, 2018 at 18:34
  • $\begingroup$ Consider for example $x=1$ and $x_n = 1 + \frac{\sqrt{2}}{n}$. Show that $x_n$ is irrational for any integer $n$. Apply the definition of continuity. $\endgroup$
    – Winther
    Nov 24, 2018 at 19:50

2 Answers 2


You are correct that there is no limit: in particular, you can find sequences $(x_n)$ and $(y_n)$ converging to $a$ such that all $x_n$ are rational and all $y_n$ are irrational (this follows from your density argument: simply pick some rational $x_0$ and irrational $y_0$, and construct your sequences by repeatedly choosing a rational/irrational from the interval centred on $a$ of length $|a - x_0|$ / $|a - y_0|$ (not including $a$): the sequences thus produced have the required properties.

Thus, for every potential limit $c$, choose $\varepsilon = \frac{1}{2}$. Then for any $\delta > 0$, there is some $n$ such that $x_n$ and $y_n$ lie in $(a-\delta,a+\delta)\setminus \{a\}$. Finally, note that either $|f(x_n) - c| = |1 - c| \geq \varepsilon$ or $|f(y_n) - c| = |c| \geq \varepsilon$ (since if $|c| < \frac{1}{2}$, then $c < \frac{1}{2}$, so $|1 - c| = 1 - c \geq \frac{1}{2}$). Thus, $\lim\limits_{x\to c}f(x)$ does not exist.


Intuitively, a function being continuous means that if you nudge the input just a little bit, the output also changes just a little bit.

Let's consider $a=5$. We know $f(5)=1$. Now if you nudge the input by a very small irrational number $c$, we get $f(5+c) = 0$, so the output, $0$, is relatively far from the output of our $a$ value. The nail in the coffin is that you can take $c$ to be as small as you want, and you will always get a relatively far output. This is exactly a property which discontinuous functions have.

With continuous functions on the other hand, if you make that $c$ smaller and smaller, the distance between the outputs should get smaller and smaller too, not stay the same (or get bigger).


You must log in to answer this question.

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