Counterexample to two-sided limit must equal one sided limits if they exist and are equal We learned that the two sided limit must equal the one-sided limits if they both exist and are the same. And I don't seem to get it, because I think I found a counterexample (I hate when this happens!).
Consider $f(x) = (1 \text{ if } x=0)(0 \text{ otherwise})$.
If we have a sequence $x_n$ with $x_n <0$ for all $n \in \mathbb{N}$ and $\lim_{n\to \infty} x_n= 0$, then we have $\lim_{n\to\infty} f(x_n) = 0$. Therefore $\lim_{x\to 0^-} f(x) = 0$. Likewise $\lim_{x\to 0^+} f(x) = 0$. Hence, it should be true that $\lim_{x\to 0} f(x) = 0$
But $(x_n) = (0,0,0,0,\ldots)$ is a sequence with $\lim_{n\to\infty} x_n= 0$ and $\lim_{n\to\infty}= f(x_n) = 1$. Therefore the limit does not exist!
Thank you in advance.
 A: You are not using the correct definition of (two-sided) limit.
We say that $\lim_{x\to a}f(x)=b$ if for every $\epsilon>0$ there exists $\delta>0$ such that for all $x$ with $\color{red}{0<}|x|<\delta$ we have $|f(x)-b|<\epsilon$.
As you have observed, it may happen that there are sequences with $\lim_{n\to\infty}x_n=a$ and $\lim_{n\to\infty} f(x_n)\ne \lim_{x\to a}f(x)$.
A: 
Definition: (continuity at a point)
If $f(x)$ is defined on an open interval containing $c$, then $f(x)$ is said to be continuous at $c$ if and only if
$$\lim_{x \rightarrow c} f(x) = f(c)$$

In your case $c=0$ with $f(0)=1$ but $\lim_{x \to 0 }f(x)=0$. The limit of $f(x)$ refers to the behavior of $f$ as $x$ approaches the point. This has to do very much with the understanding of the notion of the limit, so your question is indeed very meaningful. As you "stand on $f$" and you approach $x=0$ then you will be approaching $0$. But exactly at $0$, $f$ makes a jump. This is not the limit, this is the value of $f$ at $x=0$.
