Example of a function of a convergent sequence with limit $l$ whose limit is not $f(l)$ Give an example of a real function $f$ and a convergent sequence $\{x_n\}$ with limit $l$ for which $\{f(x_n)\}$ is convergent but its limit is not $f(l)$.
I know $f$ must be discontinuous but can't think of a simple example that makes sense. Any hints would be appreciated. Does anyone have any advice on how I should be approaching "give an example" problems in general? 
Many thanks.
 A: To find an example where something breaks, take an example where it works and change the thing that makes it work.
Pick your favorite convergent sequence $\{x_n\}$ with limit $l$, and pick your favorite continuous function $g$. Then (as you know) $\{g(x_n)\}$ is a convergent sequence with limit $g(l)$. 
Then define your desired function $f$ by
$$f(x)=\begin{cases}
g(x) & \text{ if }x\neq l,\\
\text{anything other than }g(l) & \text{ if }x=l.
\end{cases}$$
(technically this only works if there isn't an $N$ such that $x_n=l$ for all $n\geq N$, but that'd be a pretty boring convergent sequence to have as your favorite).
A: The general thing to keep in mind with these problems is to just build your example a step at a time, keeping everything as simple as possible.
First we need a convergent sequence $x_n$. The simplest possible convergent sequence is a constant sequence, but that can't work here. The next simplest is probably $x_n=1/n$, converging to $0$.
Now we need $f(x_n)$ to converge. Again, the simplest way for this to happen is for $f(x_n)$ to be constant, so let's set $f(1/n)=0$ for all $n$.
Finally, we need $f(l)$ to not be the limit of $f(x_n)$. In other words, $f(0)$ has to not equal $0$. This is easily accomplished, just set $f(0)=1$ say.
All that remains is to define $f$ for all other points. Since $f$ already satisfies all the conditions, we can do this however we like. For the sake of argument, we could set $f(x)=0$ wherever $f(x)$ wasn't already defined.
