Find a surjective closed mapping that not an open mapping and a surjective open mapping that is not a closed mapping

Find a surjective closed mapping that not an open mapping and a surjective open mapping that is not a closed mapping

Attempt:

Suppose $X$ and $Y$ are metric spaces and $f : X \rightarrow Y$. We call $f$ an open mapping if and only if for each open subset $U$ of $X$,the image $f(U)$ is open in $Y$ and we call $f$ a closed mapping if and only if for each closed subset $F$ of $X$, the image $f(F)$ is closed in $Y$.

How do I move next. Searching for an example seems a bit like trial and error to me. Could there be a logical way of deducing such examples?

• When you're at the frontier of knowledge (either all knowledge in the case of research mathematics, or just your knowledge in your case), any effort to further the frontier will often involve trial and error. Trial and error isn't always the best technique, but sometimes it's all you've got, and it's not completely worthless. Just try a few examples, check if they work, but don't stop there - before moving on to the next example, you need to understand WHY it didn't work. – oxeimon Aug 26 '15 at 18:39
• Thank you for your comment. I shall try more for examples :) Since, I was reading on my own, I was just curious how other people think when it comes to questions like these. But, I get the point :) – MathMan Aug 26 '15 at 18:46
• I do have an intuition that the product metric would be best employed here :) – MathMan Aug 26 '15 at 18:49

$$f(0)= 0,\ f(1/4) = 1/2, \ f(1/2) = 0, \ f(1) = 1.$$
(Good to draw a picture.) So we have four points on the graph of $f.$ Connect these points in order with line segments. We then have a piecewise-linear, continuous and surjective $f: [0,1]\to [0,1].$ If $E\subset [0,1]$ is closed, then $E$ is compact, hence $f(E)$ is compact by continuity and therefore closed. But notice $f((0,1/2)) = (0/1/2],$ hence $f$ is not an open map.
Open, not closed: This is kind of a wild example. Suppose $I_1, I_2, \dots$ are the open intervals with rational endpoints. Then we can inductively choose pairwise disjoint Cantor sets $K_n\subset I_n.$ Recall each $K_n$ has the cardinality of $\mathbb {R}.$ On $K_1$ we define $f_1$ so that $f_1(K_1) = (0,1).$ For $n>1,$ we choose any $f_n$ on $K_n$ such that $f_n(K_n) = \mathbb {R}.$ Now define $f$ on all of $\mathbb {R}$ by setting $f = f_n$ on $K_n, n = 1,2,\dots,$ and defining $f=0$ everywhere else. We arrive at a surjective $f:\mathbb {R} \to \mathbb {R}.$ This $f$ is an open map: If $U$ is open in $\mathbb {R},$ then $U$ will contain some $I_n$ for $n>1,$ hence $f(U)$ contains $f(K_n) = \mathbb {R}.$ Therefore $f(U) = \mathbb {R},$ which of course is open in $\mathbb {R}.$ But $f$ is not closed, because $K_1$ is closed and $f(K_1) = (0,1),$ which is not closed in $\mathbb {R}.$