# Counter example for continuity and limit

Can someone please show me one example of a continuous function: $$f : X\subset \mathbb{R} \rightarrow \mathbb{R}$$ but $$\lim_{x\rightarrow a} f(x) \neq f(a)$$ with $$a \in X$$?

The converse is clear for me, that means if $$\lim_{x\rightarrow a} = f(a)$$ then $$f$$ is continuous at $$a$$.

I was trying to look for some definition of $$f$$ where we'd have $$a \in X' \setminus X$$...

I'd appreciate some help! Thanks!

• I'm a little confused - if a function $f$ is continuous at a point, then doesn't $f(a) = \lim_{x \to a} f(x)$? – paulinho Jun 23 at 18:42
• @paulinho That is valid iff $a \in X \cap X'$. – Bruno Reis Jun 23 at 18:45
• @BrunoReis what is $X'$? – ArsenBerk Jun 23 at 18:50
• @ArsenBerk $X'$ is the set of accumulation points of the domain of our function. – Bruno Reis Jun 23 at 18:52
• Then how would you define $f(a)$ for $X'\setminus X$? You only define it on $X$ in your question – Severin Schraven Jun 23 at 18:56

I think your confusing things here: it $$\;f:X\to\Bbb R\;$$ is continuous, then for any $$\;a\in X\;$$ it must be true that

$$\lim_{x\to a\\x\in X}f(x)=f(a)\;$$

This is just part of definition (or of what follows from it, depending on your particular definition of continuity).

The above has nothing to do with the fact that if $$\;\{x_n\}\subset X\;$$ , then $$\;\lim\limits_{n\to\infty} x_n=x\in X\iff x\in X'\;$$ , which is perhaps what you're thinking of.

• It makes sense... I'm thinking about that because that was a question in a test, to find that counterexample... So I was thinking that what was written on a test was true, and it seems that it's not. – Bruno Reis Jun 23 at 19:03
• Most probably the wording of the question was different and they meant something else, or perhaps that was a mistake. It occurs all the time... – DonAntonio Jun 23 at 19:05
• Thank you anyway @DonAntonio. Now what if $X = (a,b) \cup \{c\}$ where $c \notin (a,b)$ ? Then we can't talk about limit in $c$ since $c \notin X'$... – Bruno Reis Jun 23 at 19:09
• Well, if we require $\;x\to a\,,\,\,x\in X\;$ then yes: that cannot be. What is important here is that everything must happen within $\;X\;$ , which is the definition domain of $\;f\;$ . – DonAntonio Jun 23 at 19:11
• When you mean everything, you mean that necessarily $a \in X$? – Bruno Reis Jun 23 at 19:20

If $$f: X=(0,1) \cup \{2\} \to \mathbb{R}$$ is defined by $$f(x)=\sin(\frac1x)$$ for $$x \in (0,1)$$ and $$f(2)=42$$ then $$f$$ is continuous on $$X$$ (continuity is trivial on isolated points: take $$\delta=1$$ for any $$\epsilon>0$$, e.g.) but $$\lim_{x \to 2} f(x)$$ does not exist as $$2 \notin X'$$ (but $$2 \in X$$); and as a bonus $$\lim_{x\to 0} f(x)$$ does not exist even though we do have $$0 \in X'$$.

Or take any function defined on $$X=\mathbb{Z}$$. No limit exists to points of $$X$$ (or outside) as $$X'=\emptyset$$.

• This is not what was asked. For the examples to be relevant you should have $\;f(1),\,f(0)\;$ or something of the like...which you cannot as you defined your function not on those points . – DonAntonio Jun 23 at 21:58
• @DonAntonio No, $\lim_{x \to 2} f(x)$ does not exist (so is not equal to $f(2)$), even though $2 \in X$, so it's a valid example. – Henno Brandsma Jun 23 at 22:00
• No, it's not since there's an open neighborhood of $\;a=2\;$ in which the function isn't even defined ...you cannot take the limit $\;\lim\limits_{x\to 2}f(x)\;$ ! This is the main point (with a twist) that I tried to explain the OP... – DonAntonio Jun 23 at 22:02
• @DonAntonio Exactly, that's why the limit is not equal to $f(2)$: it does not exist.. We seem to agree and not agree at the same time. – Henno Brandsma Jun 23 at 22:03
• I try to abide by the very basic definitions of these very basic things. For me to be even able to talk about $\;\lim\limits_{x\to a}f(x)\;$ , the function $\;f\;$ must be defined in some open neighborhood of $\;a\;$, otherwise the whole thing is meaningless... – DonAntonio Jun 23 at 22:05