Can two topological spaces surject onto each other but not be homeomorphic?

Solution 1:

The circle $S^1$ surjects onto the interval $I = [-1,1]$ by projection in (say) the $x$-coordinate, while the interval $I$ surjects onto the circle by wrapping around, say $f(x) = (\cos \pi x, \sin \pi x)$.

Added: Why is the circle $S^1$ not homeomorphic to the interval $I = [-1,1]$ ? The usual proof looks at cut points, i.e. a point $x$ whose removal from a topological space $X$ results in a disconnected space $X\backslash\{x\}$. Since this is a purely topological property, two homeomorphic spaces will have an equal number of cut points.

Note that $S^1$ has no cut points; removal of any single point from the circle leaves a connected open arc. However a closed interval $I$ has infinitely many cut points because removing any point except one of the two endpoints disconnects it into two disjoint subintervals.

The same observation serves to show the spaces in Karolis Juodelė's answer are not homeomorphic: $[0,1]$ has cut points and $[0,1]^2$ does not.

See Seth Baldwin's comment below for an alternative idea, something that will not disconnect the interval $I$ that does disconnect the circle!

Solution 2:

There is a continuous surjective map from $[0, 1]$ to $[0, 1]^2$ - the Peano curve. There is also a map from $[0, 1]^2$ to $[0, 1]$ - $f(x, y) = x$. However the two spaces are not homoemorphic.