# Bijection between an open and a closed interval

Recently, I answered to this problem:

Given $a<b\in \mathbb{R}$, find explicitly a bijection $f(x)$ from $]a,b[$ to $[a,b]$.

using an "iterative construction" (see below the rule).

My question is: is it possible to solve the problem finding a less exotic function?

I mean: I know such a bijection cannot be monotone, nor globally continuous; but my $f(x)$ has a lot of jumps... Hence, can one do without so many discontinuities?

W.l.o.g. assume $a=-1$ and $b=1$ (the general case can be handled by translation and rescaling). Let:

(1) $X_0:=]-1,-\frac{1}{2}] \cup [\frac{1}{2} ,1[$, and

(2) $f_0(x):=\begin{cases} -x-\frac{3}{2} &\text{, if } -1<x\leq -\frac{1}{2} \\ -x+\frac{3}{2} &\text{, if } \frac{1}{2}\leq x<1\\ 0 &\text{, otherwise} \end{cases}$,

so that the graph of $f_0(x)$ is made of two segment (parallel to the line $y=x$) and one segment laying on the $x$ axis; then define by induction:

(3) $X_{n+1}:=\frac{1}{2} X_n$, and

(4) $f_{n+1}(x):= \frac{1}{2} f_n(2 x)$

for $n\in \mathbb{N}$ (hence $X_n=\frac{1}{2^n} X_0$ and $f_n=\frac{1}{2^n} f_0(2^n x)$).

Then the function $f:]-1,1[\to \mathbb{R}$:

(5) $f(x):=\sum_{n=0}^{+\infty} f_n(x)$

is a bijection from $]-1,1[$ to $[-1,1]$.

Proof: i. First of all, note that $\{ X_n\}_{n\in \mathbb{N}}$ is a pairwise disjoint covering of $]-1,1[\setminus \{ 0\}$. Moreover the range of each $f_n(x)$ is $f_n(]-1,1[)=[-\frac{1}{2^n}, -\frac{1}{2^{n+1}}[\cup \{ 0\} \cup ]\frac{1}{2^{n+1}}, \frac{1}{2^n}]$.

ii. Let $x\in ]-1,1[$. If $x=0$, then $f(x)=0$ by (5). If $x\neq 0$, then there exists only one $\nu\in \mathbb{N}$ s.t. $x\in X_\nu$, hence $f(x)=f_\nu (x)$. Therefore $f(x)$ is well defined.

iii. By i and ii, $f(x)\lesseqgtr 0$ for $x\lesseqgtr 0$ and the range of $f(x)$ is:

$f(]-1,1[)=\bigcup_{n\in \mathbb{N}} f(]-1,1[) =[-1,1]$,

therefore $f(x)$ is surjective.

iv. On the other hand, if $x\neq y \in ]-1,1[$, then: if there exists $\nu \in \mathbb{N}$ s.t. $x,y\in X_\nu$, then $f(x)=f_\nu (x)\neq f_\nu (y)=f(y)$ (for $f_\nu (x)$ restrited to $X_\nu$ is injective); if $x\in X_\nu$ and $y\in X_\mu$, then $f(x)=f_\nu (x)\neq f_\mu(y)=f(y)$ (for the restriction of $f_\nu (x)$ to $X_\nu$ and of $f_\mu(x)$ to $X_\mu$ have disjoint ranges); finally if $x=0\neq y$, then $f(x)=0\neq f(y)$ (because of ii). Therefore $f(x)$ is injective, hence a bijection between $]-1,1[$ and $[-1,1]$. $\square$

It seems that your construction is fine, however coarse and crude. We usually give this question in the introductory course of set theory, the solution is quite elegant too.

Firstly, it is very clear that this function cannot be continuous. Consider a sequence approaching the ends of the interval, the function cannot be continuous there.

Secondly, without the loss of generality assume the interval is $[0,1]$. Define $f(x)$ as following: $$f(x) = \left\{ \begin{array}{1 1} \frac{1}{2} & \mbox{if } x = 0\\ \frac{1}{2^{n+2}} & \mbox{if } x = \frac{1}{2^n}\\ x & \mbox{otherwise} \end{array} \right.$$

It is relatively simple to show that this function is as needed.

• Can someone fix the LaTeX thing with the cases? Or is it just me? – Asaf Karagila Mar 22 '11 at 23:11
• Yes, it makes sense... My construction is more "artistic", though! ^^ – Pacciu Mar 22 '11 at 23:21
• However, this method works with any arbitrary sequence $(a_n) \subseteq ]0,1[$ which converges to $0$: infact, one can define $f(x)=\begin{cases} x &\text{, if } x\neq a_n \text{ for all } n \text{s} \\ a_0 &\text{, if } x=0 \\ a_1 &\text{, if } x=1 \\ a_{\nu+2} &\text{, if } x=a_\nu \text{ for } \nu \in \mathbb{N}\end{cases}$ and $f(x)$ is a bijection of $[0,1]\to ]0,1[$. But... The infinte jumps are really necessary? I think they are, but I cannot figure out why at the moment. – Pacciu Mar 22 '11 at 23:34
• @Pacciu: You are very correct about taking any sequence (which has no two identical elements, of course). As for the infinitely many jumps I can't recall a proper argument right now, but I do believe that if you want it to be 1-1 and onto then you have to compromise with infinitely many jumps. I don't see the problem in that, though. In fact, if you want to calculate the integral of this function it is the same the integral of $f(x)=x$ as they differ only in countably many points. – Asaf Karagila Mar 22 '11 at 23:38
• Thanks a lot for your answers! You're right: the sequence $(a_n)$ has to have no identical elements. And my issue with jumps concerns mostly the aesthetics of the solution. ^^ However, I think it can be interpreted also as a question on the optimality of the solution (in fact, why can one pretend that a solution with an infinite number of jumps is the most "elegant" if there exist other solutions with less discontinuities?)... But it's not important. – Pacciu Mar 22 '11 at 23:51

Define a bijection $f:(-1,1)\rightarrow[-1,1]$ as follows: $f(x)=2x$ if $|x|=2^{-k}$ ($k\in\mathbb{N}$); otherwise $f(x)=x$.

• Basically this is the idea of Asaf Kagila, but suitably symmetrized w.r.t. $(0,0)$. Thank you. – Pacciu Mar 23 '11 at 2:42

Here you have simpler construction.

Let $(a_n)$ be the sequence in $(a,b)$ defined by $a_n = a + \frac{b-a}{2^n}$. Then let $f\colon [a,b] \to (a,b)$ be given by $$f(x) = \begin{cases} a_1, & x = a,\\ a_2, & x = b,\\ a_{n+2}, & x = a_n, n = 1,2,\dots\\ x, & x \in [a,b] \setminus \{a,b,a_1,a_2,\dots\}. \end{cases}$$ Of course definition of $(a_n)$ could be different. The only important thing is that it is a sequence in $(a,b)$.

• This is very similar idea as in the answer by Asaf Karagila, but I saw it after I post mine. – xen Mar 22 '11 at 23:21
• I think this is the same construction of Asaf Karagila, upon scaling and translating. Thanks. – Pacciu Mar 22 '11 at 23:26

For background to this 'turn-the-crank' technique see this answer.

Let $$A = (0,1)$$ and $$B = [0,1]$$. Let $$f: A \to B$$ be the inclusion mapping $$f(x) = x$$ and $$g: B \to A$$ be given by

$$g(x) = \frac{x}{2} + \frac{1}{4}$$

We can build our bijective mapping using these two injective functions (thanks to Julius König of Schröder–Bernstein-Cantor theorem fame).

The number $$0 \in B = [0,1]$$ is a B-stopper; let

$$D_0 = \{\, \frac{1}{2} - \frac{1}{2^n} \, | \, n \text{ is a positive integer}\,\}$$

The number $$1 \in B = [0,1]$$ is a B-stopper; let

$$D_1 = \{\, \frac{1}{2} + \frac{1}{2^n} \, | \, n \text{ is a positive integer}\,\}$$

Define $$h: A \to B$$ as follows:

$$h(x) = \left\{ \begin{array}{1 1} \frac{1}{2} - \frac{1}{2^{n-1}} & \mbox{if } x = \frac{1}{2} - \frac{1}{2^{n}} \, \land \, n \gt 1\\ \frac{1}{2} + \frac{1}{2^{n-1}} & \mbox{if } x = \frac{1}{2} + \frac{1}{2^{n}} \, \land \, n \gt 1\\ x & \mbox{otherwise} \end{array} \right.$$

The function $$h: A \to B$$ is a bijection with $$h(\frac{1}{2}) = \frac{1}{2}$$.