I've seen this exercise around to motivate the definition for complete variety, but I seem to have trouble proving it (and can't find any hints).
The statement I want to show is: $X$ is compact if and only if the projection $X \times Y \to Y$ is closed for any space $Y$.
I'm stuck on both directions, though assuming $X$ is compact and $Y$ is Hausdorff the projection is clearly closed, but the statement says it must hold for all $Y$ so I'm a bit thrown off. In fact, I might be missing a simple example, but I'm having trouble thinking of a closed subset $A \times B \subseteq X \times Y$ such that $B$ is not closed in $Y$ (which must exist for any $X$ noncompact...). Is there a straightforward example for this?
Thanks.
Corrected
One direction is just the tube lemma.
For the other direction, suppose that $X$ is not compact; we want to find a space $Y$ such that the projection $\pi:X\times Y\to Y$ is not closed. Let $\mathscr{U}$ be an open cover of $X$ that has no finite subcover.
Let $\mathscr{F}=\{X\setminus U:U\in\mathscr{U}\}$.
Let $p$ be a point not in $X$, and let $Y=\{p\}\cup X$. Let
$$\tau=\wp(X)\cup\big\{\{p\}\cup F\cup A:F\in\mathscr{F}\text{ and }A\subseteq X\big\}\;.$$
(As an aid to intuition, note that the open nbhds of $p$ in $Y$ are precisely the subsets of $Y$ that contain $p$ and some element of $\mathscr{F}$.)
Let $D=\{\langle x,x\rangle\in X\times Y:x\in X\}$, and let $C=\operatorname{cl}_{X\times Y}D$; clearly $C$ is closed in $X\times Y$. Suppose, to get a contradiction, that the projection $\pi:X\times Y\to Y$ is closed.