# Can we find a function $f:\mathbb{R}\rightarrow \mathbb{R}$ that is open, closed, but not continuous?

The question is described in the title. To clarify, I'm looking for an example where the domain of such a function is $\mathbb{R}$, so the example here will not work.

The highest upvote answer here gives an example of discontinuous open map from $\mathbb{R}$ to $\mathbb{R}$, but that map can hardly be closed (closed set does not need to contain any interval!). I have difficulty generalize the construction and know very little about any sufficient condition that leads to closed map without continuity (piecewise constant will work, but that kind of maps cannot be open!).

I'll appreciate any example, non-constructive prove/disprove, or any reference that covers this.

*In case I need to clarify this, we use std. metric topology on $\mathbb{R}$

• There are no such functions, if no one writes a proof I will at some point. – clark Dec 13 '16 at 0:25
• @clark, thanks! I appreciate it! – gamma Dec 13 '16 at 0:36

No such function exists.

Assume that $f((a,b))$ is a bounded open set. Then $f((a,b))= (c,d)$ for some $c,d\in \mathbb{R}$. Indeed, $f((a,b))$ is an open set hence of the form $\bigcup (a_n,b_n)$ however $f([a,b])$ has at most two more points than $f((a,b))$, so we conclude.

Claim: if $f((a,b))= (c,d)$ then $f$ is continuous and strictly monotonic on $(a,b)$.

Proof: Firstly, we will show that $f$ is injective. Indeed assume that $f(x_1)= f(x_2)$ for some $x_1,x_2\in (a,b)$. Then take the $f((x_1,x_2))=(c_1,d_1)$ for some $c_1,d_1$, a contradiction since $f( [x_1,x_2] )$ needs two points to be closed. Now, since $f$ has the IVT propoerty and it is injective it is strictly monotonic and continuous.

We will argue by contradiction. Assume that $f$ is not continuous at $x_0$, and set $V_n=( x_0-1/n,x_0+1/n )$. Now, the claim implies there are $z_n<w_n$ such that $f(V_n )=(-\infty ,z_n)\bigcup (w_n,\infty)$ where $z_n$ or $w_n$ can possibly take the value $\pm \infty$. Also, notice that $w_n$ is increasing and $z_n$ is decreasing.

First case, one of the $z_n,w_n$ converges (to a finite limit). WLOG assume that $w_n \rightarrow w$. Now, pick a number $\beta$ in $(w,\infty)$ that is different from $f(x_0)$. We can find a sequence $p_n\in V_{n-1}\setminus V_n$ such that $f(p_n)=\beta +1/n$. A contradiction since the closed set $\{x_0\}\bigcup \{p_n|n\in \mathbb{N}\}$ gets mapped via $f$ to $\{f(x_0)\}\bigcup \{\beta +1/n|n\in \mathbb{N}\}$ which is not closed.

In the second case, we have $z_n \rightarrow -\infty$ and $w_n \rightarrow\infty$. This is a contradiction since the previous implies $\bigcap_{n \in \mathbb{N}}f(V_n)= \emptyset$, however $\bigcap_{n \in \mathbb{N}}f(V_n)$ always contains $f(x_0)$.

• Very well written and smart, +1 – Fimpellizieri Dec 15 '16 at 18:08
• I don't really see what you're arguing there, but it seems you don't handle the possibility that $f((a,b)) = \mathbb{R}$ for all $a < b$. – Daniel Fischer Dec 15 '16 at 20:38
• @DanielFischer Thanks for your comment. My point is to show that $f$ is continuous at every point. If $x_0$ is contained in an interval $(a,b)$ such that $f( (a,b))$ is bounded then we are done by the claim. So if $f$ is discontinuous at $x_0$ $f(V_n)$ must be unbounded for every $n$(and I would like from here to reach a contradiction). You are right I have mentioned what happens if $f(V_n)=\mathbb{R}\,\forall n$, however the argument in the second to last paragraph works and can be used word for word (we just change pick $\beta \in (\infty,\infty)$) if you forget the first two sentences. – clark Dec 15 '16 at 22:28
• @DanielFischer I had in my mind that that case is exactly identical that is why I forgot to include it, I am sorry for the confusion. – clark Dec 15 '16 at 22:29
• Let me notice a simple fact here. As Frank noted in his post, there are examples of open maps $f:\mathbb{R} \rightarrow \mathbb{R}$ which are not continuous. But there are also examples of closed maps $f:\mathbb{R} \rightarrow \mathbb{R}$ which are not continuous, e.g. Heaviside step function. The remarkable result proved by clark is that by assuming that $f:\mathbb{R} \rightarrow \mathbb{R}$ is both open and closed, we can conclude that $f$ is continuous. – Maurizio Barbato Feb 1 '17 at 16:10

This proof has a flaw in the second half:

Let $f:\mathbb R\rightarrow \mathbb R$ be a closed and open function.

First we prove that $f^{-1}(x)$ is finite for every $x\in \mathbb R$

suppose not, let $a_1>a_2>a_n\dots$ be a sequence of values whose image is all $x$, and such that for every $i$ there is an element in $f^{-1}(x)$ between $a_i$ and $a_{i+1}$.

Notice that $f((a_i,a_{i+1}))=f([a_i,a_{i+1}])$. Therefore $f((a_i,a_{i+1})=\mathbb R$, since it is a clopen set).

If the $a_i$'s converge then let $l$ be their limit.

We now take $b_1,b_2,\dots$ a sequence such that $a_i<b_i<a_{i+1}$ for all $i$, and such that $f(b_i)$ is a strictly increasing converging sequence ( if the $a_i$'s converge we also ask $f(a_i)>l$).

If $l$ does not exist then $\{b_1,b_2,\dots\}$ is closed while its image is not. And if $l$ exists then $\{l,b_1,b_2,\dots\}$ is closed while its image is not.

So now let $f^{-1}(0)=\{a_1,a_2,\dots, a_n\}$. Then $f$ is injective when restricted to $(-\infty,a_1),(a_i,a_{i+1})$ and $(a_n,\infty)$.

Proof: Let $U$ be a connected set which does not contain $0$ in the image, suppose $f(x)=f(y)$ for some $x\in U$. Notice that $f((x,y))$ and $f([x,y])$ differ by exactly one point. This means that $f(x,y)$ is an open set with at most $1$ limit point. Therefore $f(x,y)=\mathbb R$ or $\mathbb R \setminus f(x)$. Either case is a contradiction, since no point in $U$ maps to $0$.

We conclude that $f$ is injective when restricted to each of those open sets. Notice that the function $f$ is an open function with respect to the induced topology, since each of those sets is open. Moreover, each of these sets is isomorphic to $\mathbb R$. The following lemma finishes the proof.

Lemma: an open injection $g:\mathbb R\rightarrow \mathbb R$ is continuous.

proof: Let $h$ be the $g$ with a changed codomain, so that the function is surjective. Notice that $h^{-1}$ is a continuous bijection from a disjoint union of open sets to $\mathbb R$. (every open set is a disjoint union of open intervals).

It suffices to show that $h^{-1}$ is open on every interval, but this is clear, since a continuous injection $(a,b)\rightarrow \mathbb R$ is increasing, and hence a homeomorphism on its domain.

This shows that $f$ is continuous for every point $x$ with $f(x)\neq 0$. Using the same argument for $1$ instead of $0$ proves continuity everywhere.

• because $f(a_i)=f(a_{i+1})=x$, additionally there is a value in $(a_i,a_{i+1})$ that also maps to $x$. It is one of the prerequisites for the construction of the sequence $a_1,a_2,\dots$. – Jorge Fernández Hidalgo Dec 13 '16 at 0:59
• In the proof of injectivity, I suppose it could be that $f\big((x,y)\big)=(-\infty,c)$ for some $c<0$, or $(c,+\infty)$ for some $c>0$? Here, of course, $c=f(x)=f(y)$. – Fimpellizieri Dec 13 '16 at 1:06
• oh yeah, you're right, we would have to fix that :( – Jorge Fernández Hidalgo Dec 13 '16 at 1:09
• we just need to prove that the function is locally injective. – Jorge Fernández Hidalgo Dec 13 '16 at 1:13
• @BrianM.Scott Oh I know, every infinite set has a countable subset. So now I can just use the theorem that every sequence has a non-increasing subsequence or a non-decreasing subsequence. (The sequence that I use is whichever function I use to show the subset is countable, since this function is injective the sequence is actually increasing or decreasing). – Jorge Fernández Hidalgo Dec 13 '16 at 6:50