# example of a non-continuous function that is open and not closed

Can you help me find an example of a function from a subset of $\mathbb{R}^2$ to a subset of $\mathbb{R}^2$ that is not continuous nor closed, but open? and another one that is not continuous but both open and closed? I could only find one that is not continuous nor open but closed. Thank you.

Let $$X = \{(x,0):x\in\mathbb{R}\}\cup\{(x,1/n):x \in \mathbb{R}\text{ and }n\in\mathbb{Z}^+\},$$ and let $$Y = \{(x,n)\in\mathbb{R}^2: n\in \mathbb{N}\},$$ where $\mathbb{N}$ is the set of non-negative integers. There’s a pretty natural map from $X$ onto $Y$ that is open and closed but not continuous; can you find it?
Now let $X = [0,1]$ and define $f:X\to X$ by $$f(x) = \begin{cases}2x,&\text{if }0 \le x \le 1/2\\ x,&\text{if }1/2 < x \le 1; \end{cases}$$
$f$ is clearly not continuous, and it’s not too hard to show that it’s open but not closed.
• Something seems to have gotten mixed up in the first part; you write "where $\mathbb N$ is ..." before using $\mathbb N$. – joriki Sep 29 '11 at 9:54
• @joriki: Thanks; I originally had $X$ and $Y$ in the other order and forgot to move the comment when I flipped them. – Brian M. Scott Sep 29 '11 at 10:06
Denote $I=\{(x,0)\in\mathbb{R}^2:0\leq x<1\}$ and $\bar{I}=\{(x,0)\in\mathbb{R}^2:0\leq x\leq 1\}$. Define $f:\bar{I}\to I\cup\{(2,0)\}$, $f(x)=x$ if $x\in I$ and $f(1,0)=(2,0)$. $f$ is not continuous at $(1,0)$ but it is a bijection and open and closed. Recall that a bijection is open iff it is closed.
If we make the codomain of $f$ slightly larger from $I\cup\{(2,0)\}$ to $\bar{I}\cup\{(2,0)\}$, then the resulting function is still open and not continuous at $(1,0)$ but it is not closed anymore.