# Is continuity a necessary condition to the next equivalence?

I had solved an exercise that assume continuity of a function. I solved without continuity, I think so. The problem is as follow: let $f:M\to N$ a continuous function, where $M$ and $N$ are metric spaces. Prove that the following two propositions are equivalent

I) If $(x_n)_n$ has no a convergent subsequence, then the same happens with the sequence $(f(x_n))_n$.

II) For every compact set $K\subseteq N$, $f^{-1}(K)$ is compact.

I solved as follows:

I) implies II). Suppose that $K$ is a compact set such that $f^{-1}(K)$ is not compact. Then there is a sequence $(x_n)_n\subset f^{-1}(K)$ that has no convergent subsequence, and by hypothesis $(f(x_n))_n\subset K$ has no convergent subsequence but this contradics the fact that $K$ is compact.

II) implies I). Let $(x_n)_n$ be a sequence that have no a convergent subsequence. Now suppose that $(f(x_n))_n$ have a convergent subsequence, $(f(x_{n_k}))_k$, and let $y$ be its limit. Is a result that the set $K=\{f(x_{n_1}), f(x_{n_2}),\dots,y\}$ is compact. Then $(x_{n_k})_k\subset f^{-1}(K)$, where $f^{-1}(K)$ is compact by hypothesis. Then $(x_{n_k})_k$ must have a convergent subsequence that is also a subsequence of $(x_n)_n$, contradiction.

I would like to know if there is something wrong on this proof.

Take $f:\mathbb{R}\to\mathbb{R}$, defined as $$f(x) = \begin{cases} x& x\neq 0\\ 1& x = 0 \end{cases}\text{.}$$ I) holds:

Take $(x_n)_n$ that has no accumulating point ($\Leftrightarrow$ has no convergent subsequence). Suppose that $(f(x_n))_n$ has an accumulating point $x$.

Case $x\neq 1$: is impossible because that would mean that there are infinitely many $n$s such that $f(x_n) = x_n\in (x-\varepsilon, x + \varepsilon)$ for all $\varepsilon > 0$ small enough so that $1\notin (x-\varepsilon, x + \varepsilon)$.

Case of $x= 1$: if there are finitely many $n\in\mathbb{N}$, such that $x_n = 0$, $f(x_n) = x_n$ for $n\geq n_0$ for some $n_0$, then we can repeat the upper argument. Otherwise, $0$ is an accumulating point of $(x_n)_n$. Hence, this case is also impossible.

II) does not hold: $f^{-1}([-1/2,1/2]) = [-1/2,1/2]\setminus\{0\}$.

That means that (at least) I does not imply II. You went wrong when you claim that Then there is a sequence $(x_n)_n\subset f^{-1}(K)$ that has no convergent subsequence: take $K = [-1/2,1/2]$. Since $f^{-1}(K) = K \setminus\{0\}$, we also have $(x_n)_n\subset K$.

If $f$ is continuous, II automatically holds, since $K$ must be a closed set.