# A continuous onto function from $[0,1)$ to $(-1,1)$

How I can construct a continuous onto function from $[0,1)$ to $(-1,1)$ ?

I know that such a function exists and also I have a function $\displaystyle f(x)=x^2\sin\frac{1}{1-x}$ which is continuous and onto from $[0,1)$ to $(-1,1)$. But I don't know how I can construct this type of function. There are many function which is continuous onto from $[0,1)$ to $(-1,1)$. I can construct a continuous onto function from $(0,1)$ to $(-1,1)$. But when the domain interval is left-closed then how I can construct ?

Please give the idea to construct the function.

• I'm confused. You say you know of the example $x^2\sin \frac{1}{1-x}$...so what more do you want? – Eric Wofsey May 29 '16 at 5:27
• @Eric Wofsey ) Actually from my book I got that example...But I want to construct an example myself.(without help of book)..How I can construct ? – Empty May 29 '16 at 5:36
• The awkwardness is getting values close to $-1$ and $1$ without actually realizing those values. You obviously have to make $f(0)$ a value inside $(1,-1)$, so that means you have to approach both the $-1,1$ values as $x\to1$. The wildly oscillating sine function is a way of doing that. Incidentally, you don't need $x^2$, $x\sin\frac{1}{1-x}$ works just as well. – almagest May 29 '16 at 5:42
• @ almagest) How you guess $\sin \frac{1}{1-x}$ ? – Empty May 29 '16 at 5:55
• @S.Panja-1729 Are you waiting for other examples? – Laurent Duval Aug 9 '16 at 20:25

I suggest to start by drawing: draw the bounding box $[0,1)\times (-1,1)$, place your pencil at $(0,0)$, and trace different functions. The following are observations and hints, not logical proofs.

A first idea is that, since you want a continuous function, a monotonous one might be troublesome in mapping a semi-open interval like $[0,1)$ to an open one like $(-1,1)$. You can find one location in $[0,1)$ where $f(x)$ approaches $1$ and another location in $[0,1)$ where $f(x)$ approaches $-1$. If these locations are in some $[\epsilon,1-\epsilon]$ ($\epsilon >0$), continuity might impose that the values $-1$ or $1$ will be reached strictly inside $[0,1)$, which you do not want.

One remaining choice is that values $y=-1$ and $y=1$ are both approached on an open end like $\left[.~ 1\right)$. So you might need a function that oscillates infinitely often close to $x=1$. In other word, it can be wise to open $[0,1)$ to something like $[0,+\infty)$.

To summarize, three main ingredients ingredients could be useful, in the shape of a fellowship of continuous functions that you could compose. Many choices are possible, here is one (borrowing from Tolkien's Ring poem):

1. three functions for the unit-interval $[0,1)$ up to the sky $[0,+\infty)$ (hereafter $f_0$, $f_1$, $f_\phi$),
2. one for the oscillation lords in their infinite $[0,+\infty)$ hall of sound (hereafter $f_2$),
3. one function to bring them all and in $]-1,1[$ bind them (hereafter $f_3$),

in the Land of functions where continuity lies (indeed, continuous functions tend to cast continuous shadows to connected intervals).

The first ingredient $f_1(x)$ is easy with functions you know, defined on some $[a,b[$ with a singularity at $b$. It is easy to remap $[a,b[$ to $[0,1[$, so let us stick to that interval $[0,1[$. Examples: $\frac{1}{1-x}$, $-\log (1-x)$, $\tan (\pi x/2)$, and many more.

If you want more flexibility, you can start with any function $f_0$ that maps $[0,1[$ to $[0,1[$: $x^p$ with $p>0$, $\sin(\pi x/2)$, $\log(1+x(e-1))$.

For the second ingredient $f_2$ on $[0,+\infty)$, the sine is a nice pick, and a lot of combinations of sines and cosines, like a chirping sound. But you have a lot of fancy alternatives. And you can easily plug in a function $f_\phi$ that maps $[0,+\infty)$ to $[0,+\infty)$ (for instance $\exp(x)-1$, $x^p$).

The choice of $f_2$ is possibly the most sensitive, since you will need to strictly bound it afterward inside $(−1,1)$, therefore you will need a third ingredient: a function $f_3$ that compensates (as a product for instance) the envelope of $f_2$ so that the result does not exceed $1$ in absolute value. So for the sine, $x^p$ or $\frac{\exp{x}-1}{e-1}$ will do the job. A function whose magnitude is strictly less than $1$, and tends to $1$ as $x\to 1$ is likely to work.

Finally, a function can be obtained by composing $f(x)= f_3(x)\times f_2\left( f_\phi\left( f_1\left( f_0\left( x\right)\right)\right)\right)$.

In your case, you have for instance $f_0(x)=x$, $f_1(x)=\frac{1}{1-x}$, $f_\phi(x)=x$, $f_2(x)=\sin(x)$, $f_3(x)=x^2$.

While not fully generic, you can cook of lot of recipes with those ingredients. For instance (see image below):$$f(x)=\sin(\pi x^7/2)\sin \left( \tan \left(\pi \sqrt{x}/2\right)\right)\,.$$