Prove that if $A\subseteq Y$ is compact, and $f:X\to Y$ is continuous, where $X$ is compact, then $f^{-1}(A)$ is compact. I am asked to show that the preimage of a compact set is compact.
I am given $(X,d)$ compact metric space, arbitrary metric space $Y$, compact set $A$ $\subset$ $Y$,  and continuous function $f$: X$\rightarrow$Y. I need to show $f^{-1}$(A) compact. My textbook gives a solution by showing using the closed set of compact set is compact theorem. I would like to test an alternative approach. Can you please check it?
Attempt:
Since A is compact, there exists a finite subcover $U$ such that $A$ $\subset$ $U$. We know that $U$ is an open set since it is the union of finite open sets. Since $F$ continuous and $A$ open, we know that $f^{-1}$($U$) open. Recall $A$ $\subset$ $U$, then $f^{-1}$($A$) $\subset$ $f^{-1}$($U$). Thus, $f^{-1}$($A$) has a finite open cover of $f^{-1}$($U$) and $f^{-1}$($A$) compact. 
 A: There is no need of considering open covers. Just use these three simple facts
(the second one is actually proved with open covers, of course).


*

*A compact subset of a metric space is closed

*A closed subset of a compact metric space is compact

*The inverse image of a closed subset via a continuous map is closed
Your alternative approach is flawed. You want to show that if $A\subset Y$ is compact, then $B=f^{-1}(A)$ is compact. To show this, you have to take an arbitrary open cover of $B$ and try extracting from it a finite subcover.
Say $\mathcal{U}$ is the open cover. Then, since $B$ is closed, $\mathcal{U}\cup\{X\setminus B\}$ is an open cover of $X$. Therefore, there exists a finite subcover: $X=U_1\cup\dots\cup U_n\cup (X\setminus B)$. Obviously
$$B\subset U_1\cup\dots\cup U_n$$
so we have found a finite subcover of $B$ from $\mathcal{U}$. But this is exactly the proof of statement 2 above.
A: Please change the title of your question, it is misleading. For example $f:\mathbb{R}\to\{0\}$ yields a counterexample to the statement.
Use the fact that preimages of closed sets are closed, the fact that compact sets of metric spaces are closed, and the fact that a closed subset of a compact set is compact.
