# 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

The function $f:(0,1)\times\{0\}\to(0,3/2)\times\{0\}$, defined by $$f(x,0)=\begin{cases}(x,0);&x\in(0,1/2)\\(1/4,0);&x=1/2\\ (x+1/2,0);&x\in(1/2,1)\end{cases}$$ obviously isn't continuous. It also isn't closed, as $f[(0,1/2]\times\{0\}]=(0,1/2)\times\{0\}$ isn't a closed subset of the codomain. It is, however, open, which you can prove by considering how $f$ maps various open intervals inside $(0,1)\times\{0\}$.

The function $g:(0,1)\times\{0\}\to(0,1/2]\times\{0\}$, defined by $$g(x,0)=\begin{cases}(x,0);&x\in(0,1/2]\times\{0\}\\(x-1/2,0);&x\in(1/2,1)\times\{0\}\end{cases}$$ also obviously isn't continuous, but it is open and closed (openness goes through the same as before, while closedness is somewhat more annoying).

It should be mentioned that openness and closedness are fairly dependent on the codomain. For example, the function $g$ above wouldn't be open if we considered it as a function $g:(0,1)\times\{0\}\to (0,1)\times\{0\}$, even though it is arguably the same function.

-
These examples would have to be extended to $\mathbb R^2$ in one of the ways shown in the other answers. – joriki Sep 29 '11 at 10:18
Fixed now. That's what I get for simplifying problems. – Miha Habič Sep 29 '11 at 10:30

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.

-