example of a continuous function that is closed but not open Give an example of a continuous function $f:\mathbb{R} \to \mathbb{R}$ that is closed but not open.
$ f(x)=x^2$ is continuous and not open but It's not closed. What is an example?
Thanks in advance.

As several people have noted, there are much simpler examples, but in fact the squaring map $f:\Bbb R\to\Bbb R:x\mapsto x^2$ is closed. 
Let $F$ be a closed set in $\Bbb R$. Let $F_0=F\cap[0,\to)$; $F_0$ is closed in $[0,\to)$, and $f\upharpoonright[0,\to)$ is a homeomorphism of $[0,\to)$ onto itself, so $f[F_0]$ is a closed set in $[0,\to)$ and hence in $\Bbb R$. Similarly, if $F_1=F\cap(\leftarrow,0]$, then $f[F_1]$ is closed in $\Bbb R$, because $f\upharpoonright(\leftarrow,0]$ is a homeomorphism of $(\leftarrow,0]$ onto $[0,\to)$. But then $f[F]=f[F_0]\cup f[F_1]$ is closed in $\Bbb R$, and hence $f$ is a closed map.
(In case some of the notation is unfamiliar, $[0,\to)$ is another notation for $[0,\infty)$, and $f\upharpoonright A$ is the restriction of the function $f$ to the set $A$, also sometimes written $f|A$ or $f|_A$.)
