# How to prove continuity of a map whose image is a clopen set

I read that a map $$f:X \rightarrow Y$$ is continuous, if for any open set $$O \subseteq Y$$, the preimage $$f^{-1}(O)$$ is open in $$X$$. Alternatively, if $$O$$ is closed in $$Y$$, the preimage is closed in $$X$$.

However, suppose that $$Y$$ is equipped with the discrete topology where all subsets of $$Y$$ are clopen. Is there an instance where a continuous function maps an open set in $$Y$$ to an open set in $$X$$, but does not do so for closed sets ?

If $$f:X\to Y$$ is continuous, then $$f^{-1}[U]$$ is open in $$X$$ for every open $$U\subseteq Y$$, and $$f^{-1}[F]$$ is closed in $$X$$ for every closed $$F\subseteq Y$$. It doesn’t matter what the topologies are: all that matters is that $$f$$ is continuous.
If $$Y$$ has the discrete topology, however, every subset of $$Y$$ is clopen, so $$f^{-1}[A]$$ is clopen in $$X$$ for every $$A\subseteq Y$$.