# Better way to define this bijection [0,1) to (0,1) [duplicate]

I have been trying to construct a bijection from $[0,1)$ to $(0,1)$ that my professor was showing me in class. I think that the function works in terms of being one-to-one and onto. Here's the function
$$f(x)=\Bigl(\dfrac{2^{n+1}-3}{2^n}\Bigr)-x$$ but in order for this function to work (i.e. be 1-1 and onto), we have to have $$x<\dfrac{2^{n}-1}{2^{n}}$$ This is what the graph looks like.

My question is whether or not there a better way to construct $f$ so that $x$ doesn't depend on values of $n$.

## marked as duplicate by Duncan Ramage, GNUSupporter 8964民主女神 地下教會, Henning Makholm elementary-set-theory StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 20 '18 at 17:28

• Hint. A continuous bijection can not exist. You must deal with the point $1$ individually. – fleablood Jan 20 '18 at 16:44
• "but I am just unsure of how to write the function so that the constraints on n are there." What constraints on $n$? Why do you have $f_n$? That's a countable number of functions? Why? You were asked for a bijection? I kind of don't think you know what you are doing because none of them actually map to (0,1) and they don't seem to be a function. Are you thinking the bijection will be the limit? But the limit will just be the identity which isn't a biject. Do you actually understand the question? – fleablood Jan 20 '18 at 16:49
• What ARE you doing? Each of the functions $f_n(x)$ is of the form $f(x) x + c_n$ where $c_n$ is a constant. These map $(0, 1] \to (0+c_n, 1 + c_n]$. None of these map to $(0,1)$ and why do you have a sequence of functions anyway. You were asked for one function. Do you think you are trying to make a bijection from $N$ to $(0,1]$ (which isn't possible)? and that somehow these $f_n$ are .... something to do with $(0,1]$. – fleablood Jan 20 '18 at 16:56
• What you need to do is make one function, one function only $g:(0,1) \to (0,1]$ so the the function is one to one (if $x\ne y$ then $f(x) \ne y)$ and onto. For every $y \in (0,1]$ (including $1$) there is a distinct $x\in (0,1)$ ($x$ can not be $1$) so that $g(x) = g(y)$. The trick is you need to find an $x; 0< x < 1$ so that $g(x) = 1$. Then you need to find an $x_1$ so the $g(x_1) = x$, Then an $x_2$ so that $g(x_2) = x_1$ and so on. All the rest of the numbers in (0,1) can map to themselves. – fleablood Jan 20 '18 at 17:01
Let $$0 \to 0.1 \to 0.01 \to \ldots \to 10^{-n} \to 10^{-n-1} \to \ldots.$$ So we "hide" $0$ in the infinite sequense within $(0,1)$. Then for each point $$x \in (0,1) \setminus \{10^{-n}:n=0,1,2,\ldots\}$$ we put $x \to x$.