Verifying proof that in a first countable space if $x_n\to x$ and $f(x_n)\to f(x)$, then $f$ is continuous

continuityfirst-countablegeneral-topologysequences-and-series

Suppose $X$ is a first-countable space and assume $f:X\to Y$ has the property that for every converging sequence in $X$: $x_n\to x$ the corresponding sequence $f(x_n)$ converges to $f(x)\in Y$, show that $f$ is continuous.

My attempt:
let $U\subseteq Y$ be open, is is sufficent to show that $(f^{-1}(U))^c$ is closed in $X$. Let ${x_n}\subseteq (f^{-1}(U))^c$ converge to $x$. If $x\notin (f^{-1}(U))^c$ then $x\in f^{-1}(U)$ and so $f(x)\in U$. Since $U$ is open so it must contain a tail of $\{ f(x_n) \}$ (from the assumption that $f(x_n)\to f(x)$), Hence $f^{-1}(U)$ must contain a tail of $\{ x_n \}$ which is a contadiction.

The proof seems true but since I did not use the fact that $X$ is first countable the proof is somehow wrong. Mabey I did use the fact that $X$ is first countable but not knowingly If you could help me find the error or show me where I used the fact that $X$ is first countable I would be very thankful.

Best Answer

Let $F$ be closed and consider $C=f^{-1}[F]$ and we need to show $C$ is also closed. Suppose it is not, then there is some $p \in \overline{C}\setminus C$ and by first countability we can find a sequence $c_n \in C$ such that $c_n \to p$. Now we apply the condition on sequential convergence for $f$ and get $f(c_n) \to f(p)$. But $f(c_n) \in F$ by definition of $C$ and as $F$ is closed (in any space) we know that $f(p) \in F$ as well, but then $p \in C$ and we have a contradiction. So $C$ is closed and we're done.

You use first countability because showing closedness under sequence limits allows you to conclude the set is closed. That does not hold for all spaces.