# Show that $f$ is continuous given it has a convergent subsequence

Assume that $(X,d)$ be a metric space. Let $f:X\to X$ be a function.

Assume that for each sequence $x_n\in X$ converging to $x$, $f(x_n)$ has a subsequence converging to $f(x)$ .

Show that $f$ is continuous.

Let $f$ be not continuous then there exists $x_n\to x$ but $f(x_n)$ does not converge to $f(x)$.

But $f(x_n)$ has a convergent subsequence $f(x_{n_k})\to f(x)$ . How to show that $f(x_n)\to f(x)$ from here??

## 2 Answers

If $f(x_n)\to f(x)$ is not true then an open set $U$ exists with $f(x)\in U$ and such that no $n_0$ exists with $n\geq n_0\implies f(x_n)\in U$.

Then there is a subsequence $(x_{n_k})_k$ with $f(x_{n_k})\notin U$ for every $k$.

We have $x_{n_k}\to x$ but there is so subsequence of $f(x_{n_k})$ that converges to $f(x)$.

If $\lim_{n\to\infty}x_n=x$, you want to prove that $\lim_{n\to\infty}f(x_n)=f(x)$. Suppose otherwise. Take $\varepsilon>0$ such that the inequality $\bigl|f(x_n)-f(x)\bigr|\geqslant\varepsilon$ holds infinitely many times. Consider a strictly increasing sequence $(m(n))_{n\in\mathbb N}$ of natural numbers such that$$(\forall n\in\mathbb{N}):\bigl|f(x_{m(n)})-f(x)\bigr|\geqslant\varepsilon$$Then

• $\lim_{n\to\infty}x_{m(n)}=x$;
• no subsequence of the sequence $\bigl(f(x_{m(n)})\bigr)_{n\in\mathbb N}$ converges to $f(x)$.

And this is impossible.