TITLE: Can two topological spaces surject onto each other but not be homeomorphic?
QUESTION [30 upvotes]: Let $X$ and $Y$ be topological spaces and $f:X\rightarrow Y$ and $g:Y\rightarrow X$ be surjective continuous maps.  Is it necessarily true that $X$ and $Y$ are homeomorphic?  I feel like the answer to this question is no, but I haven't been able to come up with any counter example, so I decided to ask here.

REPLY [4 votes]: Just to be different, here’s an example that isn’t related to the Hahn-Mazurkievicz theorem. The example is originally due (with a different purpose) to K. Sundaresan, Banach spaces with Banach-Stone property, Studies in Topology (N.M. Stavrakas & K.R. Allen, eds.), Academic Press, New York, 1975, pp. 573-580; the argumentation is mine, On an example of Sundaresan, Top. Procs. 5 (1980), pp. 185-6. The surjections are $1$-$1$ save at a single point each, where they are $2$-$1$.
Let $X=\omega^*\cup(\omega\times 2)$, where $\omega^*=\beta\omega\setminus\omega$, and $2$ is the discrete two-point space, let $\pi:X\to\beta\omega$ be the obvious projection, and endow $X$ with the coarsest topology making $\pi$ continuous and each point of $\omega\times 2$ isolated. Let $N=\omega\times 2$, for $n\in\omega$ let $P_n=\{n\}\times 2$, and let $\mathscr{P}=\{P_n:n\in\omega\}$. A function $f:X\to X$ preserves pairs if $f[P_n]\in\mathscr{P}$ for all but finitely many $n\in\omega$.

Lemma. Let $f:X\to X$ be an embedding; then $f$ preserves pairs.
Proof. Suppose that $f$ does not preserve pairs. Since $f$ is injective, an easy recursion suffices to produce an infinite $M\subseteq\omega$ such that $(\pi\circ f)\upharpoonright\bigcup\{P_n:n\in M\}$ is injective. Let $M_i=M\times\{i\}$ for $i\in 2$. Then $$\left(\operatorname{cl}_XM_i\right)\setminus N=\left(\operatorname{cl}_{\beta\omega}M\right)\setminus\omega\ne\varnothing$$ for $i\in 2$, so $$\left(\operatorname{cl}_Xf[M_0]\right)\setminus N=\left(\operatorname{cl}_Xf[M_1]\right)\setminus N\ne\varnothing\;.$$ But $$\left(\operatorname{cl}_Xf[M_i]\right)\setminus N=\left(\operatorname{cl}_{\beta\omega}f[M_i]\right)\setminus\omega$$ for $i\in 2$, $\pi\big[f[M_0]\big]\cap\pi\big[f[M_1]\big]=\varnothing$, and disjoint subsets of $\omega$ have disjoint closures in $\beta\omega$, so $\operatorname{cl}_Xf[M_0]\cap\operatorname{cl}_Xf[M_1]=\varnothing$; this is the desired contradiction. $\dashv$

Now let $p$ be any point not in $X$, and let $Y=X\cup\{p\}$, adding $p$ to $X$ as an isolated point. 

Proposition. $Y$ is not homeormorphic to $X$.
Proof. Suppose that $h:Y\to X$ is a homeomorphism; it follows from the lemma that $h\upharpoonright X$ preserves pairs. Let $$A=\bigcup\Big\{P_n\in\mathscr{P}:h[P_n]\in\mathscr{P}\Big\}\cup\omega^*\;.$$ Then $\big|X\setminus h[A]\big|$ is finite and even, $|Y\setminus A|$ is finite and odd, and $h\upharpoonright(Y\setminus A)$ is a bijection between these two sets, which is absurd. $\dashv$

Finally, the maps 
$$f:Y\to X:y\mapsto\begin{cases}
y,&\text{if }y\in X\\
\langle 0,0\rangle,&\text{if }y=p
\end{cases}$$
and
$$g:X\to Y:x\mapsto\begin{cases}
x,&\text{if }x\in\omega^*\\
p,&\text{if }\pi(x)=0\\
\langle n-1,i\rangle,&\text{if }x=\langle n,i\rangle\text{ and }n>0
\end{cases}$$
are continuous surjections.
By the way, each of $X$ and $Y$ embeds in the other, so these spaces witness the lack of a Schröder-Bernstein-like theorem for compact Hausdorff spaces and embeddings.