proof of the continuity of as function Let $f: \mathbb{R} \to \mathbb{R}$ be a surjective function such that for all non convergent sequences $(x_n)$, the sequence $(f(x_n))$ is non convergent. Prove that $f$ is continuous. Thank you
 A: Suppose $y \in \mathbb{R}$ and $\{x_n\}$ is a sequence of points such that $f(x_n) \rightarrow y$. Then the sequence $\{x_n\}$ must converge, to say $x$. Now, if $w$ is any real number such that $f(w) = y$, the sequence $(f(x_1),f(w),f(x_2),f(w),\ldots)$ is also a convergent sequence, which means that $(x_1, w, x_2, w, \ldots)$ must converge. This can only happen if $w = x$. Note in particular that there is only one $w$ such that $f(w) = y$.
What we have shown here is that $f: \mathbb{R}\rightarrow \mathbb{R}$ is actually a bijection, and that $f^{-1}$ is continuous. But this implies that $f$ itself is continuous, since $f^{-1}$ takes compact intervals bijectively to compact intervals.
A: I think my comments lead to an answer.
• $f$ is injective. If $x ≠ y$ and $f(x) = f(y)$ we can take $x_{2k} = x$ and $x_{2k + 1} = y$. So $(x_n)$ contradicts the assumption.
• $g := f^{-1}$ is continuous. Take any $(x_n) \to x$. Define $x'_{2k} = x_k$ and $x'_{2k + 1} = x$. Then $g(x'_n) \to g(x)$ and so $g(x_n) \to g(x)$. Otherwise $(g(x'_n))$ is non-convergent so $(fg(x'_n)) = (x'_n)$ is also non-convergent, contradiction.
• $g$ restricted to any compact is a homeomorphism since it's bijective with compact domain (and hence compact range).
• Let's take an increasing sequence of closed intervals $I_n$ such that $\bigcup_n I_n = \mathbb{R}$. Let $J_n = g[I_n]$ so $I_n = f[J_n]$ and $f$ and/or $g$ gives homomorphism between closed intervals $J_n$, $I_n$. Since also $\bigcup_n J_n = \mathbb{R}$ and $(J_n)$ is increasing, for any $x ∈ \mathbb{R}$ there is $J_n$ such that $x ∈ U ⊆ J_n$ for some open $U$. So $f$ is continuous at $x$ since $f$ restricted to $J_n$ is continuous at $x$.
