What is a continuous mapping of the real line $(-\infty, \infty)$ to the interval $[0, 1]$? I'm trying out logs and exponentials but they don't seem to work?
Mapping the Real Line to the Unit Interval
-
0$\dfrac1{1+e^x}$? $e^{-e^{-x}}$? (These are both bijections from $(-\infty,\infty)$ to $(0,1)$.) – 2015-05-27
8 Answers
I take it you want a continuous surjection from $\mathbb{R}$ to $[0,1]$. A simple example of such a function is $f(x)= \begin{cases} 0 & x<0 \\ x & 0 \le x \le 1 \\ 1 & x>1\end{cases}$
-
6AKA $\frac{|x|-|x-1|+1}{2}$ :-) – 2011-10-23
$\frac{x+\sqrt{x^2+1}}{2\sqrt{x^2+1}}$ and $\frac{\tanh(x)+1}{2}$ both map $\mathbb{R}$ into $[0,1]$ but not onto. As Phira mentions $\frac{\sin(x)+1}{2}$ maps $\mathbb{R}$ onto $[0,1]$ but is not $1{-}1$. However, you won't find a $1{-}1$ and onto function whose inverse is continuous, since $[0,1]$ is compact and $\mathbb{R}$ is not.
-
0@J.M.: and even the first example :-) – 2011-10-23
$\dfrac{\sin x +1}2$ is a continuous surjective function from the reals to this interval.
$\dfrac{1}{1+e^{-x}}$ is a one-to-one monotonically increasing map from $\mathbb R$ onto the open interval $(0,1)$.
All you need is a continuous function that maps $\mathbb{R}$ onto a closed interval; once you have that, adjusting the interval is fairly easy. (For instance, you can use a linear function.) The natural starting points are the sine and cosine functions.
As the question is formulated, any function that would map all number of the real line to a fixed number of $[0, 1]$ would do. A Lo's (down voted by Julian) answer is also a correct answer, since mapping to $(0,1)$, you map to $[0,1]$.
But what user18723 probably meant, but didn't specify, is to have more than just a continuous function. Perhaps the intent was to have a bijective function? But in that case, it's not possible. A good discussion on this situation can be found here.
-
0It's not true that $[0,1] \subset (0,1)$ – 2015-05-27