# Showing that the Dirichlet function has no limit

Let $$f(x) = 0$$ if $$x$$ is rational and $$f(x)=1$$ if $$x$$ is irrational. Prove that $$\lim_{x\to a} f(x)$$ does not exist for any $$a$$.

Proof attempt:

Let $$a\in\mathbb{R}$$. The only two possible values for a limit of $$\lim_{x\to a}f(x)$$ are $$0,1$$, since otherwise there will always be a constant gap between the valules of $$f$$ and the limit, and hence $$f$$ would not get arbitrarily small.

However, $$\lim_{x\to a}f(x) \not = 1$$ for the following reason: Set $$\epsilon = 1/2$$ and let $$\delta > 0$$. Then there exists a rational number $$x_0$$ in $$0<|x_0-a|<\delta$$ by the density of the rationals. However, $$|f(x_0)-1| = |0-1| = 1 \not < 1/2$$, and so $$\lim_{x\to a}f(x) \not = 1$$.

Also, $$\lim_{x\to a}f(x) \not = 0$$ for the following reason: Set $$\epsilon = 1/2$$ and let $$\delta > 0$$. Then there exists a irrational number $$x_0$$ in $$0<|x_0-a|<\delta$$ by the density of the irrationals. However, $$|f(x_0)-0| = |1-0| = 1 \not < 1/2$$, and so $$\lim_{x\to a}f(x) \not = 0$$.

• Exactly what are you asking? What point is the one you are unsure about? – Will M. Nov 21 '18 at 4:13
• I am unsure of whether my proof is correct. For example, is assuming that the only possible limits are 0 and 1 a correct assumption? Then do I correctly rule these out as limits? – Wesley Nov 21 '18 at 4:15
• Ok, technically speaking, you need to consider a value, whatever it may be, $L \in \mathbf{R},$ and then rule it out as a possible limit. You can divide three cases: (1) $L \neq 0, 1$ (2) $L = 0$ and (3) $L=1.$ – Will M. Nov 21 '18 at 4:17
• Is at least my reasoning for cases (2) and (3) correct? – Wesley Nov 21 '18 at 4:30

Your proof is complete and fine. Only one minor correction : "hence $$f$$ would not get arbitrarily small" should be changed to "hence $$f$$ would not get arbitrarily close to the possible limit", in the first paragraph of the proof (or changed to "hence $$f-L$$ would not get arbitrarily small, where $$L \neq 0,1$$ is a possible limit").
There is another proof that will avoid the breaking of $$L$$ into cases : indeed, given $$a \in \mathbb R$$, by density of rationals and irrationals, there is a sequence of rationals and irrationals converging to $$a$$. But, $$\lim_{x \to a} f(x)$$ exists if and only if for any two sequences $$a_n, b_n \to a$$ we have $$\lim a_n = \lim b_n$$, and here the sequence of rationals and irrationals produce different values, namely $$0$$ and $$1$$.