Question: Let $X$ and $Y$ be topological spaces, $X$ compact, $f : X \to Y$ continuous. Then the preimage of each compact subset of $Y$ is compact.

With the stipulation that $X$ and $Y$ are metric spaces, this is a theorem in Pugh's *Real Mathematical Analysis*. The proof uses sequential compactness. Is this theorem true in general (*i.e.* can it be proved with covering compactness alone)?

Answer: 
This is not true in general.

Let $X=Y=[0,1]$. Take $X$ with the usual topology. For $Y$, take the topology
$$\tau=\left\{\varnothing,Y,(1/2,1]\right\}.$$
Then $id:x\in X\mapsto x\in Y$ is continuous, but $(1/2,1]=id^{-1}(1/2,1]$ is not compact, although $(1/2,1]$ is compact in $Y$.

On the other hand, if $Y$ is Hausdorff, then every compact of $Y$ is closed, so the inverse image of compact sets is closed, hence compact.
**Disclaimer:** This answer is intended to compliment the above, and thought it is not fully generally, but is has often been helpful in my experience... 

If $Y$ is $\mathbb{R}$ then its sufficient for $f$ to be [coercive](https://en.wikipedia.org/wiki/Coercive_function). When $X$ is a topological vector space, the coercivity condition reduces to the requirement that
$$
\lim\_{\|x\|\to \infty} f(x)=\infty,
$$
which is typically easy to check.