[proofplan]
We prove compactness by the open-cover definition. Starting with an arbitrary [open cover](/page/Open%20Cover) of $f(K)$ by open subsets of $Y$, we pull the cover back along $f$ to obtain an open cover of $K$ by open subsets of $X$. Compactness of $K$ gives a finite subcover after pulling back, and the corresponding original open sets then form a finite subcover of $f(K)$.
[/proofplan]
[step:Pull an arbitrary open cover of $f(K)$ back to an open cover of $K$]
Let $I$ be an index set, and let $(U_i)_{i\in I}$ be a family of subsets of $Y$ such that $U_i\in\tau_Y$ for every $i\in I$ and
$f(K)\subset \bigcup_{i\in I} U_i$.
For each $i\in I$, define
$V_i:=f^{-1}(U_i)\subset X$. Since $f:X\to Y$ is continuous and $U_i$ is open in $Y$, each $V_i$ is open in $X$. We claim that $(V_i)_{i\in I}$ covers $K$. Indeed, if $x\in K$, then $f(x)\in f(K)$, so there exists $i\in I$ with $f(x)\in U_i$. Hence $x\in f^{-1}(U_i)=V_i$. Therefore
$K\subset \bigcup_{i\in I} V_i$.
[guided]
We begin with the kind of object that must be tested in order to prove compactness of $f(K)$: an arbitrary open cover. Let $I$ be an index set, and let $(U_i)_{i\in I}$ be a family of open subsets of $Y$, meaning $U_i\in\tau_Y$ for every $i\in I$, such that
$f(K)\subset \bigcup_{i\in I} U_i$.
The goal is to use compactness of $K$, not compactness of $f(K)$, so we must convert this cover of $f(K)$ into a cover of $K$. The natural operation is inverse image under $f$. For each $i\in I$, define
$V_i:=f^{-1}(U_i)\subset X$.
Because $f:X\to Y$ is continuous, the inverse image under $f$ of every open subset of $Y$ is open in $X$. Since each $U_i$ is open in $Y$, it follows that each $V_i$ is open in $X$.
Now we verify that these pulled-back open sets cover $K$. Let $x\in K$. Then $f(x)\in f(K)$. Since the family $(U_i)_{i\in I}$ covers $f(K)$, there exists an index $i\in I$ such that $f(x)\in U_i$. By the definition of inverse image, this is exactly the statement that $x\in f^{-1}(U_i)=V_i$. Hence every point of $K$ belongs to at least one of the sets $V_i$, so
$K\subset \bigcup_{i\in I} V_i$.
[/guided]
[/step]
[step:Use compactness of $K$ to choose finitely many pulled-back open sets]
The family $(V_i)_{i\in I}$ is an open cover of $K$ by subsets open in $X$. Since $K$ is compact in the [subspace topology](/page/Subspace%20Topology) inherited from $X$, there exists a finite subset $I_0\subset I$ such that
$K\subset \bigcup_{i\in I_0} V_i$.
[/step]
[step:Push the finite subcover forward to cover $f(K)$]
We show that the corresponding family $(U_i)_{i\in I_0}$ covers $f(K)$. Let $y\in f(K)$. By definition of image, there exists $x\in K$ such that $y=f(x)$. Since
$K\subset \bigcup_{i\in I_0} V_i$,
there exists $i\in I_0$ such that $x\in V_i$. By the definition of $V_i$, this means $x\in f^{-1}(U_i)$, hence $f(x)\in U_i$. Therefore $y\in U_i$.
Thus
$f(K)\subset \bigcup_{i\in I_0} U_i$.
Since $I_0$ is finite, the original open cover of $f(K)$ has a finite subcover. Because the original open cover was arbitrary, $f(K)$ is compact in the subspace topology inherited from $Y$.
[/step]