# Does there exist a function such that $\lim_{x \to a} f(x) = L$ for all $a \in \mathbb R$ but $f(x)$ is never $L$?

Does there exist a function $f:\mathbb R \to \mathbb R$ such that $\lim_{x \to a} f(x) = L$ for all $a \in \mathbb R$ but $f(x) \neq L$ for all $x$?

I found such a function in $\mathbb Q \to \mathbb Q$, where $f(\frac{p}{q})= \text{first p+q digits of }\pi$ satisfies the above condition. However, I have not been able to extend it to reals. So, is such a function possible, and if it is, is there any explicit example preferably related to the above function in rationals?

• Another example on the rationals is $f(p/q)=L-(1/q)$. – Gerry Myerson May 27 '16 at 9:28
• It is instructive to consider what happens when the limit $L$ is not same for every point $a$. The conclusion in still true. See math.stackexchange.com/q/980022/72031 for more details. – Paramanand Singh May 27 '16 at 10:13
• The limit for points where your function is defined is the function value at that point, so how could it be unequal to all function values??? – hkBst May 27 '16 at 10:55
• @hkBst: The limit for points ... is not necessarily the function value at that point. Remember a limit is defined in terms of values of a function, but it may not itself be a value of the function. – Paramanand Singh May 27 '16 at 11:26
• also see this beautiful answer math.stackexchange.com/a/3802/72031 for the general problem mentioned in my previous comment. This answer avoids the notion of uncountability and instead relies of completeness of real number system. – Paramanand Singh May 30 '16 at 19:34

Let's consider an arbitrary closed interval $[a, b]$. Let $\epsilon > 0$ be arbitrarily given. For each point $c$ of $[a, b]$ there is a neighborhood $I_{c}$ of $c$ such that $$|f(x) - L| < \epsilon$$ for all $x \in I_{c} \setminus \{c\}$. Clearly all such intervals $I_{c}$ form an open cover for $[a, b]$ and by Heine Borel Theorem a finite number of such intervals say $I_{c_{1}}, I_{c_{2}}, \ldots, I_{c_{m}}$ cover $[a, b]$.

It thus follows that $|f(x) - L| < \epsilon$ for all $x \in [a, b]$ except for a finite number of points $c_{1}, c_{2}, \ldots, c_{m}$. Now we choose specific values of $\epsilon$. For each positive integer $n$ we have a finite number, say $k_{n}$, of points in $[a, b]$ for which $|f(x) - L| \geq 1/n$. Let the set of points in $[a, b]$ for which $|f(x) - L| \geq 1/n$ be denoted by $A_{n}$. Then $A_{n}$ is a finite set of cardinality $k_{n}$ and since the set of points in $[a, b]$ for which $f(x) \neq L$ is obviously contained in the union $\bigcup_{n = 1}^{\infty}A_{n}$ it follows that the set of points in $[a, b]$ for which $f(x) \neq L$ is countable. It follows that $f(x) = L$ on $[a, b]$ for uncountably many points $x$.

• Yeah your argument is much more creative (+1) – Tim kinsella May 27 '16 at 10:08
• @Timkinsella: Thanks man! but I will do have a look on wiki for Baire Category just in order to understand your proof better. – Paramanand Singh May 27 '16 at 10:09

No. Suppose this is true of $f(x)$. Consider $A_n:= \{x: |f(x)-L|>1/n\}$. $\cup_n A_n=\mathbb{R}$ by assumption. If none of the $A_n$ had an accumulation point, then $\mathbb{R}$ would be a countable union of sets whose compliments are open and dense. Such a union must have open dense compliment by the Baire category theorem. This is a contradiction. Maybe theres a more elementary way to do it though.

As user254something points out, you don't need Baire category. Just observe that discrete implies countable. Then $\mathbb{R}$ is a countable Union of countable sets. Contradiction.

• I have tried to use similar argument in my answer via Heine Borel Theorem, but I am not familiar with Baire Category Theorem so can't really comment on your answer. – Paramanand Singh May 27 '16 at 9:59
• If $A_n$ is discrete then $A_n$ is countable, because $A_n \cap [m, m+1]$ must be finite for every $m\in Z.$ – DanielWainfleet May 27 '16 at 16:25
• @user254665 That's a good point. – Tim kinsella May 27 '16 at 21:52
• @Tim kinsella, Can there exist $f:R\to R$ such that $L(x)=\lim_{y\to x, y\ne x}f(y)$ exists for all $x,$ but$f(x) \ne L(x)$ for all $x$? – DanielWainfleet May 28 '16 at 2:02
• @user254665 If there were such an $f$, then $f(x)-L(x)$ would be a function which is never 0 but has limit 0 at every point. – Tim kinsella May 28 '16 at 2:37

Suppose $f$ is such a function. Like @Tim kinsella did, set $A_n = \{x\in [0,1]: |f(x) - L| > 1/n\}.$ Then $[0,1] = \cup A_n.$ Hence some $A_{n_0}$ must be infinite. By Bolzano-Weierstrass, $A_{n_0}$ has an accumulation point $x_0.$ Thus $x_0$ is a limit of a sequence $x_m$ such that $|f(x_m) - L| > 1/n_0$ for every $m.$ Since $\lim_{x\to x_0} f(x) = L,$ we have a contradiction.