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$?

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$.


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.


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.