TITLE: Continuous function on a compact metric space
QUESTION [6 upvotes]: The question is:
Suppose $f\colon X\to Y$ is continuous on a compact metric space $X$, $Y$ is a metric space and $C\subset Y$ is closed. Show that for any open neighborhood $U$ of $f^{-1}(C)$ in $X$, there exists an open neighborhood $V$ of $C$ in $Y$ such that $f^{-1}(V)⊂U$.
I have tried to argue that $f^{-1}(C)$ is closed (and hence compact) by continuity of $f$ and compactness of $X$, then $C=f(f^{-1}(C))$ is also compact by continuity of $f$ again.
But the compactness of the two sets seems don't help me very much.
Can anyone help me? Thx!

REPLY [3 votes]: Let $U$ be an open neighborhood of $f^{-1}(C) \Longrightarrow U^c\cap f^{-1}(C)=\emptyset$.
Then $U^c$ is compact $\Longrightarrow f(U^c)$ is compact $\Longrightarrow$ closed and $C\cap f(U^c)= \emptyset$ (Proof: If $x\in C\cap f(U^c)$ then $x=f(a)$ for some $a\in U^c \Longrightarrow$ $a\in U^c\cap f^{-1}(C)=\emptyset$ ↯).
Now we find $V$ open with $C\subset V $ and $V\cap f(U^c)=\emptyset$.
Show that $f^{-1}(V) \cap U^c=\emptyset$. Therefore $f^{-1}(V)\subseteq U$ .