Is a space compact iff it is closed as a subspace of any other space?
Solution 1:
Great question! The answer is yes if you restrict your attention to sufficiently nice spaces. Specifically, each of the following statements is true (1 and 3 are quite well-known):
- Let $Y$ be a Hausdorff space and $X\subseteq Y$ be a compact subspace. Then $X$ is closed in $Y$.
- Let $X$ be a regular space such that whenever $X$ is a subspace of a Hausdorff space $Y$, $X$ is closed in $Y$. Then $X$ is compact.
- Let $X$ be a completely regular space such that whenever $X$ is a subspace of a normal space $Y$, $X$ is closed in $Y$. Then $X$ is compact.
Proof of 1: Let $y\in Y\setminus X$. Since $Y$ is Hausdorff, for each $x\in X$ we can find open sets $U_x$ and $V_x$ such that $y\in U_x$, $x\in V_x$, and $U_x\cap V_x=\emptyset$. By compactness, there are finitely many $x_1,\dots,x_n\in X$ such that $X\subseteq V_{x_1}\cup\dots\cup V_{x_n}$. The set $U=U_{x_1}\cap\dots \cap U_{x_n}$ is then a neighborhood of $y$ disjoint from $X$. Since $y\in Y\setminus X$ was arbitrary, this means $X$ is closed.
Proof of 2: Suppose $X$ is regular and not compact; let $\mathcal{A}$ be a collection of nonempty closed subsets of $X$ which is closed under finite intersections but $\bigcap \mathcal{A}=\emptyset$. Let $Y=X\cup\{\infty\}$, topologized such that $U\subseteq Y$ is open iff either $U\subseteq X$ and $U$ is open in $X$ or $U=\{\infty\}\cup V$ for some open set $V\subseteq X$ which contains an element of $\mathcal{A}$. Then $Y$ clearly contains $X$ as a dense open subspace. For any $x\in X$, there is some $A\in \mathcal{A}$ which does not contain $x$, and by regularity we can find open sets in $X$ separating $x$ and $A$. It follows that in $Y$ we can find open sets separating $x$ and $\infty$. Thus $Y$ is Hausdorff.
Proof of 3: Let $C(X,[0,1])$ be the set of all continuous maps from $X$ to $[0,1]$ and let $Y=[0,1]^{C(X,[0,1])}$ with the product topology. There is a map $i:X\to Y$ which sends $x$ to the function $f\mapsto f(x)$ for $f\in C(X,[0,1])$. Complete regularity implies that this map $i$ is an embedding. Since $Y$ is compact and Hausdorff, $Y$ is normal (this can be proven by an argument similar to the proof of (1)). Thus if the hypothesis of (3) holds, then the image of $i$ must be closed. Since $Y$ is a compact, this means $X$ is compact as well.
Finally, let me note that in (2) I do not know whether you can further require $Y$ to be regular. However, the requirement that $X$ is regular (rather than just Hausdorff) is necessary, as the following counterexample shows. Let $K$ be any compact Hausdorff space with a dense open subset $D\subset K$ such that $K\setminus D$ is not discrete. Let $X$ have the same underlying set as $K$ and be equipped with the following topology: a set $U\subseteq X$ is open iff for every $x\in U$, $U\cap (\{x\}\cup D)$ is open in $\{x\}\cup D$ with respect to the topology inherited from $K$. Since $K\setminus D$ is not discrete, the topology on $X$ is strictly finer than the topology on $K$ ($\{x\}\cup D$ is open in $X$ for all $x\in X$), so $X$ is Hausdorff and not compact. Furthermore, $D$ is still dense in $X$, and in fact an ultrafilter $F$ on $D$ converges to a point $x\in X$ iff it converges to $x$ in $K$.
Now suppose $Y$ is a Hausdorff space which contains $X$ as a non-closed subspace. By replacing $Y$ with the closure of $X$ in $Y$, we may assume $X$ is dense in $Y$, and hence $D$ is also dense in $Y$. If $y\in Y\setminus X$, there must then be an ultrafilter $F$ on $D$ which converges to $y$. Since $K$ is compact, $F$ must converge to some point $x\in K$, and as observed above, this means $F$ also converges to $x$ in $X$. Since $x\neq y$, this contradicts the assumption that $Y$ is Hausdorff.
Solution 2:
No; take the two-point topological space with one open point and one closed point. The open point is compact, but not closed.
In fact, I don't think that there are any topological spaces which are closed inside every other topological space.