# Is there a function having a limit at every point while being nowhere continuous?

Is there a function $\,f:\mathbb{R}\rightarrow\mathbb{R},\,$ which has a limit at every $x\in\mathbb R$ and is everywhere discontinuous?

• It's a question from a graduate exam. – Curious Droid Oct 18 '14 at 21:45
• Yeah this looks like a standard general exam question. – R.. GitHub STOP HELPING ICE Oct 19 '14 at 3:05
• – Martin Sleziak Oct 21 '14 at 13:18

Instead, the following is true: If a function $f:\mathbb R\to\mathbb R$ has a limit for every $x\in\mathbb R$, then $f$ is discontinuous in a set of points which is at most countable.

More specifically, we have the following facts:

Fact A. If $g(x)=\lim_{y\to x}f(y)$, then $g$ is continuous everywhere.

Fact B. The set $A=\{x: f(x)\ne g(x)\}$ is countable.

Fact C. The function $\,f\,$ is continuous at $\,x=x_0\,$ if and only if $\,f(x_0)=g(x_0)$, and hence $f$ is discontinuous in at most countably many points.

For Fact A, let $x\in\mathbb R$ and $\varepsilon>0$, then there exists a $\delta>0$, such that $$0<\lvert y-x\rvert<\delta\quad\Longrightarrow\quad g(x)-\varepsilon<f(y)<g(x)+\varepsilon,$$ but the above inequality implies that for every $z$, with $|z-x|<\delta$, $$g(x)-\varepsilon \le g(z)=\lim_{y\to z}f(y) \le g(x)+\varepsilon,$$ and hence $g$ is continuous.

For Fact B, define for $\varepsilon>0$ the set $$A_\varepsilon=\{x: \lvert\,f(x)- g(x)\rvert>\varepsilon\}.$$ This set cannot have a limit point, for otherwise, $f$ would not have a limit there. Thus $A_\varepsilon$ is at most countable. Next observe that $$A=\bigcup_{n\in\mathbb N}A_{1/n},$$ and hence $A$, the set of discontinuities of $f$, is at most countable.

Fact C is straight-forward.

• what a great answer! :) – Ant Oct 18 '14 at 21:58
• One wonders what happens if one has a model of set theory such that "a countable union of a countable sets is countable" is false. – Baby Dragon Oct 18 '14 at 21:58
• Actually, the proof of this requires the Axiom of Choice, and hence your question is indeed plausible. – Yiorgos S. Smyrlis Oct 18 '14 at 22:03
• It doesn't require AC in full; much weaker forms of choice, which you can't do much analysis without, will do. – R.. GitHub STOP HELPING ICE Oct 19 '14 at 3:04
• Since those sets are discrete subsets of a second-countable space, they can be given canonical enumerations. $\:$ (Take a countable basis, and enumerate each set according to the first basic subset whose intersection with the discrete set in exactly the given element.) $\:$ Thus the Axiom of Choice is not needed for the OP. $\;\;\;\;$ – user57159 Oct 19 '14 at 6:13