[proofplan]
A topological embedding is a map that is a homeomorphism onto its image (with the subspace topology). Since $f$ is already a continuous injection, it suffices to show that $f$ is a closed map (equivalently, that the inverse $f^{-1}: f(Y) \to Y$ is continuous). We invoke the [Closed Map Lemma](/theorems/317): a continuous map from a compact space to a Hausdorff space sends closed sets to closed sets. Since a continuous closed bijection is a homeomorphism, $f$ is a homeomorphism onto $f(Y)$.
[/proofplan]
[step:Verify that $f$ is a closed map into $X$]
By the [Closed Map Lemma](/theorems/317), every continuous map from a compact space to a Hausdorff space is a closed map. The hypotheses are satisfied: $Y$ is compact and $X$ is Hausdorff. Therefore $f: Y \to X$ is a closed map: for every closed $C \subset Y$, the image $f(C)$ is closed in $X$.
[guided]
We apply the [Closed Map Lemma](/theorems/317), which states: if $g: K \to Z$ is continuous, $K$ is compact, and $Z$ is Hausdorff, then $g$ is a closed map. We verify the hypotheses for $g = f$, $K = Y$, $Z = X$:
1. $f: Y \to X$ is continuous — given by hypothesis.
2. $Y$ is compact — given by hypothesis.
3. $X$ is Hausdorff — given by hypothesis.
All three conditions hold, so $f$ maps closed subsets of $Y$ to closed subsets of $X$. (The mechanism in the Closed Map Lemma: a closed subset of a compact space is compact, the continuous image of a compact set is compact, and a compact subset of a Hausdorff space is closed.)
[/guided]
[/step]
[step:Conclude that $f$ is a homeomorphism onto $f(Y)$]
We must show that the bijection
\begin{align*}
f': Y &\to f(Y) \\
y &\mapsto f(y)
\end{align*}
(where $f(Y)$ carries the subspace topology from $X$) is a homeomorphism. The map $f'$ is continuous (as a corestriction of a continuous map to a subspace, by the [Restriction of Continuous Maps to Subspaces](/theorems/1036), part 2), bijective (since $f$ is injective and $f'$ is surjective onto $f(Y)$), and a closed map: if $C \subset Y$ is closed, then $f(C)$ is closed in $X$ by the previous step, so $f(C) \cap f(Y) = f'(C)$ is closed in $f(Y)$ by the subspace topology. A continuous, closed, bijective map has a continuous inverse — for any closed $C \subset Y$, the preimage $(f')^{-1}(f'(C)) = C$ shows that $(f')^{-1}$ maps closed sets to closed sets, hence is continuous. Therefore $f'$ is a homeomorphism, and $f$ is a topological embedding.
[guided]
We need to verify that $f$ is a homeomorphism onto its image, meaning the corestricted map $f': Y \to f(Y)$ is a homeomorphism, where $f(Y)$ has the subspace topology inherited from $X$.
**Continuity of $f'$.** The map $f': Y \to f(Y)$ is the corestriction of $f: Y \to X$ to the subspace $f(Y) \subset X$. By the [Restriction of Continuous Maps to Subspaces](/theorems/1036) (part 2), applied with $A = Y$, $B = f(Y)$, and the condition $f(Y) \subset f(Y)$ (which holds), $f'$ is continuous.
**Bijectivity of $f'$.** Injectivity of $f'$ follows from injectivity of $f$. Surjectivity of $f'$ holds by definition: the codomain is $f(Y)$.
**$f'$ is a closed map.** Let $C \subset Y$ be closed. By the previous step, $f(C)$ is closed in $X$. The image $f'(C) = f(C) \cap f(Y)$ (as a subset of $f(Y)$), but since $f(C) \subset f(Y)$, we have $f'(C) = f(C)$. Now $f(C)$ is closed in $X$, so $f(C) \cap f(Y)$ is closed in $f(Y)$ by the subspace topology characterisation of closed sets. Hence $f'$ is a closed map.
**Homeomorphism.** A bijective, continuous, closed map is a homeomorphism: for any open $U \subset Y$, the complement $Y \setminus U$ is closed, so $f'(Y \setminus U) = f(Y) \setminus f'(U)$ is closed in $f(Y)$ (using bijectivity for the set equality), which means $f'(U)$ is open in $f(Y)$. Thus $f'$ is an open map, and hence $(f')^{-1}$ is continuous.
This completes the proof that $f$ is a topological embedding.
[/guided]
[/step]