Show that the limit of functions is continuous Let $f_n$ be a sequence of not necessarily continuous functions $\mathbb{R} \rightarrow \mathbb{R}$ such that $f_n(x_n) \rightarrow f(x)$ whenever $x_n \rightarrow x$. Show that f is continuous. 
What I am trying to do is to show that whenever we have $x \in \mathbb{R}$ and $x_n \rightarrow x$, then $f(x_n) \rightarrow f(x)$, when $n \rightarrow \infty$. 
These types of things are usually showed by using the triangle inequality. I know I can make $|f(x) - f_n(x_n)|$ as small as possible by choosing a big enough n. I can also make $|f(x) - f_n(x)|$ as small as possible. But I am not able to combine these to prove that $|f(x) - f(x_n)|$ can be made as small as possible.
 A: First note that the hypothesis implies that the $f_n$ converge pointwise to $f$. To see this, consider the constant sequence $\langle x_n:n\in\Bbb N\rangle$ where $x_n=x$ for each $n\in\Bbb N$: $$\langle f_n(x):n\in\Bbb N\rangle=\langle f_n(x_n):n\in\Bbb N\rangle\to f(x)\;.$$
Now suppose that $f$ is not continuous at $x$, and let $\langle x_n:n\in\Bbb N\rangle\to x$ be such that $\langle f(x_n):n\in\Bbb N\rangle$ does not converge to $f(x)$. Then there is an $\epsilon>0$ such that $|f(x_n)-f(x)|\ge\epsilon$ for infinitely many $n\in\Bbb N$, so you can find a subsequence $\langle x_{n_k}:k\in\Bbb N\rangle$ such that $|f(x_{n_k})-f(x)|\ge\epsilon$ for every $k\in\Bbb N$. Since $\langle x_{n_k}:k\in\Bbb N\rangle\to x$, you might as well assume from the start that you have a sequence $\langle x_n:n\in\Bbb N\rangle$ and an $\epsilon>0$ such that $\langle x_n:n\in\Bbb N\rangle\to x$ and $|f(x_n)-f(x)|\ge\epsilon$ for all $n\in\Bbb N$.
By hypothesis $\langle f_n(x_n):n\in\Bbb N\rangle\to f(x)$. Choose $n_0\in\Bbb N$ so that $|f_n(x_0)-f(x_0)|<\epsilon/2$ for all $n\ge n_0$; we can do this, since the $f_n$’s converge pointwise to $f$. Now choose $n_1>n_0$ so that $|f_n(x_1)-f(x_1)|<\epsilon/2$ for all $n\ge n_1$. Continue in this way to construct an increasing sequence $\langle n_k:k\in\Bbb N\rangle$ such that $|f_n(x_k)-f(x_k)|<\epsilon/2$ for all $n\ge n_k$.
Now form a new sequence $\langle y_n:n\in\Bbb N\rangle$ as follows:
$$y_n=\begin{cases}
x_0,&\text{if }n\le n_0\\
x_k,&\text{if }n_{k-1}<n\le n_k\text{ for some }k\ge 1\;.
\end{cases}$$
It’s not hard to see that $\langle y_n:n\in\Bbb N\rangle\to x$: it’s just the sequence $\langle x_n:n\in\Bbb N\rangle$ with each term repeated some finite number of times. Note that $y_{n_k}=x_k$ for every $k\in\Bbb N$. Thus, for each $k\in\Bbb N$ we have $f_{n_k}(y_{n_k})=f_{n_k}(x_k)$, which by the choice of $n_k$ implies that $|f_{n_k}(y_{n_k})-f(y_{n_k})|<\epsilon/2$.
Now $\langle f_n(y_n):n\in\Bbb N\rangle\to f(x)$, so $\langle f_{n_k}(y_{n_k}):k\in\Bbb N\rangle\to f(x)$, and there must be a $k\in\Bbb N$ such that $|f_{n_k}(y_{n_k})-f(x)|<\epsilon/2$. But then
$$|f(y_{n_k})-f(x)|\le|f(y_{n_k})-f_{n_k}(y_{n_k})|+|f_{n_k}(y_{n_k})-f(x)|<\frac{\epsilon}2+\frac{\epsilon}2=\epsilon\;,$$
which is a contradiction: $|f(y_{n_k})-f(x)|=|f(x_k)-f(x)|\ge\epsilon$.
Thus, $f$ must in fact be continuous at $x$.
