# Is there a bijective map from $(0,1)$ to $\mathbb{R}$?

I couldn't find a bijective map from $(0,1)$ to $\mathbb{R}$. Is there any example?

• Yes, and there's even one from (0,1) to R²...
– Axel
Commented Sep 21, 2012 at 12:56
• And would you believe it, there's one from $(0,1)$ to $R^{3}$ as well? Commented Apr 24, 2020 at 15:08

Here is a nice one ${}{}{}{}{}{}{}{}{}$, can you find the equation?

• That's really nice! Commented Sep 21, 2012 at 12:26
• Note: I would be interested in an explicit formula. Commented Oct 21, 2013 at 19:59
• As far as I can tell, the connection between our answers' formulae is coincidental (aside from the fact that if $g$ is a positive function on some subset of $\Bbb R,$ then so is $\sqrt{g},$ so our functions are related, but not in an obvious heuristic way. Please let me know if you can discern a connection between our answers (aside from the obvious algebraic one). Commented Oct 31, 2014 at 3:07
• @TheChaz2.0 If you vary $x$ from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$, $\frac{1+\sin x}{2}$ will vary from $0$ to $1$ and $\tan x$ will vary from $-\infty$ to $\infty$. As both of these are bijections, you can take composition of inverse of first function and the second function to get the desired function. Commented Dec 3, 2016 at 14:04
• @Mathemagician1234 a simple way is to observe that, if $x\in[-1,1]$ is the coordinate on the circle's diameter, $\arccos(x)$ is the corresponding angle, and $\cot(\arccos(x))=x/\sqrt{1-x^2}$ the corresponding projection on a line sitting above the circle. This gives a bijection $[-1,1]\to\mathbb R$. You can then simply map $x\mapsto 2x-1$ to get the bijection on $[0,1]$ (note that $1-(2x-1)^2=4(x-x^2)$)
– glS
Commented Oct 15, 2020 at 23:03

Here is a bijection from $(-\pi/2,\pi/2)$ to $\mathbb{R}$: $$f(x)=\tan x.$$ You can play with this function and solve your problem.

$g(x)=\frac 1{1+e^x}$ gives a bijection from $\Bbb R$ to $(0,1)$, so take the inverse of this map.

• And the inverse is $f(x)=\ln\left(\frac{1}{x}-1\right)$ Commented Sep 21, 2012 at 12:19

A homeomorphism (continuous bijection with a continuous inverse) would be $f:(0,1)\to\Bbb R$ given by $$f(x)=\frac{2x-1}{x-x^2}.$$

Added: Let me provide some explanation of how I came by this answer, rather than simply leave it as an unmotivated (though effective) formula and claim in perpetuity.

Many moons ago, I was assigned the task of demonstrating that the real interval $(-1,1)$ was in bijection with $\Bbb R.$ Prior experience with rational functions had shown me graphs like this:

The above is a graph of a continuous function from most of $\Bbb R$ onto $\Bbb R.$ This doesn't do the trick on its own, since it certainly isn't injective. However, it occurred to me that if we restrict the function to the open interval between the two vertical asymptotes, we get this graph, instead:

This graph is of a continuous, injective (more precisely, increasing) function from a bounded open interval of $\Bbb R$ onto $\Bbb R.$ This showed that rational functions could do the job. Other options occurred to me, certainly (such as trigonometric functions), but of the ideas I had (and given the results I was allowed to use) at the time, the most straightforward approach turned out to be using rational functions.

Now, given the symmetry of the interval $(-1,1)$ (and, arguably, of $\Bbb R$) about $0,$ the natural choice of the unique zero of the desired function was $x=0.$ In other words, I wanted $x$ to be the unique factor of the desired rational function's numerator that could be made equal to $0$ in the interval $(-1,1)$--meaning that for $\beta\in(-1,1)$ with $\beta\ne0,$ I needed to make sure that $x-\beta$ was not a factor of the numerator. For simplicity, I hoped that I could make $x$ the only factor of the numerator that could be made equal to $0$ at all--that is, I hoped that I could have $\alpha x$ as the numerator of my function for some nonzero real $\alpha.$

In order to get the vertical asymptotic behavior I wanted on the given interval--that is, only at the interval's endpoints--I needed to make sure that $x=\pm1$ gave a denominator of $0$--that is, that $x\mp1$ were factors of the denominator--and that for $-1<\beta<1,$ $\beta$ was not a zero of the denominator--that is, that $x-\beta$ wasn't a factor of the denominator. For simplicity, I hoped that I could make $x\mp1$ the only factors of the denominator.

Playing to my hopes, I assumed $\alpha$ to be some arbitrary nonzero real, and considered the family of functions $$g_\alpha(x)=\frac{\alpha x}{(x+1)(x-1)}=\frac{\alpha x}{x^2-1},$$ with domain $(-1,1).$ It was readily seen that all such functions are real-valued and onto $\Bbb R.$

I wanted more, though! (I'm demanding of my functions when I can be. What can I say?) I wanted an increasing function. I determined (through experimentation which suggested proof) that $g_\alpha$ would be increasing if and only if $\alpha<0.$ Again, for convenience, I chose $\alpha=-1,$ which gave me the function that satisfied the desired (and required) properties: $g:(-1,1)\to\Bbb R$ given by $$g(x)=\frac{-x}{x^2-1}=\frac{x}{1-x^2}.$$

Much later, you posted your question, and I realized (again, based on experience) that my earlier result could be adapted to the one you wanted. Playing around a bit with linear interpolation showed that the function $h:(0,1)\to(-1,1)$ given by $h(x)=2x-1$ was a bijection--in fact, an increasing bijection.

It is readily shown (and I had previously seen) that if $X,Y,$ and $Z$ are ordered sets and if we are given increasing maps $X\to Y$ and $Y\to Z,$ then the composition of those maps is an increasing map $X\to Z.$ Also, it is readily shown (and I had seen previously) that if both such maps are continuous and surjective, then so is their composition. Just from these results, my originally posted map was obtained (though named differently): \begin{align}(g\circ h)(x) &= g\bigl(h(x)\bigr)\\ &= \frac{h(x)}{1-\left(h(x)\right)^2}\\ &=\frac{2x-1}{1-(2x-1)^2}\\ &=\frac{2x-1}{1-\left(4x^2-4x+1\right)}\\ &= \frac{2x-1}{4x-4x^2}\\ &=\frac{2x-1}{4(x-x^2)}.\end{align}

As lhf astutely pointed out shortly thereafter (and as I should have seen immediately), the factor of $4$ in the denominator serves no particular purpose, hence its later removal to yield the function $f$ that I eventually posted.

The remaining claim that I made (that $f$ has a continuous inverse), I leave to you (the reader). If you're curious how I determined this, try to prove it on your own first. If you're stymied (or if you simply want to run your proof attempt by me), let me know. I will do what I can to get you "unstuck."

• This is the answer you want. A direct map that just stretches the unit interval onto the (-inf,inf) interval. This shows you don't need an exotic function like the bijection between [0,1] and [0,1]^2. Commented Sep 21, 2012 at 12:17
• No need for that 4...
– lhf
Commented Sep 21, 2012 at 12:22
• Fair point, @lhf. Not sure why I bothered with that.... Commented Sep 21, 2012 at 17:21

For a less differentiable example, consider the bijection in the following picture,

In symbols, given $x \in (0,1)$ let $n$ be the largest natural number such that $1-\frac{1}{n}<x$, define $$y=\frac{x-n}{\frac{1}{n}-\frac{1}{n+1}}$$ to be the renormalized version of $x$ if the interval $(1-\frac{1}{n},1-\frac{1}{n+1}]$ is rescaled and shifted to map to $(0,1)$. Then we have the following bijection: $$f(x)=\begin{cases}\frac{n-1}{2}+y,& n \text{ odd} \\ -\frac{n-2}{2}-y,& n \text{ even}\end{cases}$$

• Not only less differentiable but also much less continuous. Commented Sep 21, 2012 at 10:15
• (: One might even consider the composition $f \circ g$ with a nowhere continuous bijection $g:(0,1)\rightarrow (0,1)$. Commented Sep 21, 2012 at 10:27

Yes, see above answers. There are even bijective maps between $(0,1)$ and $\mathbb{R}^n$. To see this, note that a bijection $\phi$ between $(0,1)$ and $(0,1)^2$ can be made in this way: Let $x= 0.b_1b_2\ldots$, with $b_j$ being the digits in a decimal expansion. Define $$\phi(x) = (0.b_1b_3b_5\ldots,0.b_2b_4b_6\ldots),$$ i.e., extract even and odd digits. For $\phi^{-1}(x_1,x_2)$, let $x_1 = 0.a_1a_2a_3\ldots$, and $x_2=b_1b_2b_3\ldots$. Then, $$\phi^{-1}(x,y) = 0.a_1b_1a_2b_2\cdots$$ Some care has to be taken with identification between digital expansions like $0.199999\cdots$ and $0.20000\cdots$, but that is an exercise.

Having the bijection between $(0,1)$ and $(0,1)^2$, we can apply one of the other answers to create a bijection with $\mathbb{R}^2$.

The argument easily generalizes to $\mathbb{R}^n$.

• Actually you don't even have to generalize the argument: If you have the bijection between $(0,1)$ and $(0,1)^2$, you get a bijection from $(0,1)$ to $(0,1)^3$ by just applying the same bijection to one of the two factors of $(0,1)^2$. Of course the same way you get to $(0,1)^n$. Commented Sep 21, 2012 at 12:16

Yes. let $f(x)=\tan((x-1/2)\pi)$. the domain is $(0,1)$ and range is $\mathbb{R}$

• Here is a more visual description of the same function (modulo a factor of $\pi$) Bend the line segment (0, 1) into a semicircle, with the open part facing upwards, and rest it on the real line (with 0.5 on the semicircle resting on 0 on the real line). To map a point on one line to a point on the other, draw a line through that point and the centre of the circle. The mapped point is where it intersects the other line.
– Max
Commented Sep 21, 2012 at 10:10
• Of course, knowing the domain and range simply guarantees that $f$ is surjective, but this $f$ does turn out to be injective, too. Commented Sep 21, 2012 at 10:36

The trigonometric function $\tan x$ is an invertible function from $(-\pi/2,\pi/2)$ to $\mathbb{R}$. Also to find an invertible function from $(0,1)$ to $(-\pi/2,\pi/2)$ find the equation of the straight line joining the points $(0,-\pi/2)$ and $(1,\pi/2)$. Now compose the two functions together. You can likewise find bijections between any two open intervals and any open interval and $\mathbb{R}$.

$$(0,1) \overset{\theta \mapsto e^{i 2\pi \theta}}\cong S^1\backslash \{1 \} \overset{e^{i\theta} \mapsto {e^{i(\theta+\pi/2)}}}\cong S^1\backslash \{i \} \overset{e^{i\theta}\mapsto \frac{cos \theta} {1-\sin\theta}}\cong \mathbb{R}$$The composition of the exponential map, rotation map and stereographic projection is the required bijection.

$x \mapsto \ln (- \ln x)$ with the inverse $y \mapsto e^{-e ^ {\ y}}$. It's also a $C ^ \infty$ diffeomorphism.

Here is a general bijective function from any interval $$(a,b)$$ to $$\mathbb{R}$$: $$f:(a,b)\to\mathbb{R}, \text{ defined as }f(x)=\tan\left[\frac{\pi}{b-a}\left(x-\frac{b+a}{2}\right)\right]$$

The phase shift and periodic reduce tangent function: $$tan(x\pi+\frac{\pi}{2})$$ maps $$(0,1)$$ interval to $$\mathbb{R}$$.

Because it is continuous, monotone and it's range is $$(-\infty,+\infty)$$.