# Function with domain all real numbers and range $(0,1)$

Is there a one-to-one function whose domain is all real numbers and range is $(0,1)$?

I can't find any so I was thinking about trying to find a piece-wise function that meets the requirements, but I'm having a lot of trouble doing that too.

This is a part of the problem I'm trying to solve to show that two sets have the same cardinality.

Any help is appreciated!

• Fiddle around with $\arctan$. – David Mitra Oct 4 '17 at 14:57
• Any CDF of a suitable random variable does the job, for instance $$g(t) = \frac{1}{\sqrt{\pi}}\int_{-\infty}^{t} e^{-x^2}\,dx.$$ – Jack D'Aurizio Oct 4 '17 at 15:54

Hint:

find $a,b$ in $y=a \arctan (x) +b$ so the your condition is satisfied.

• I was thinking (arctan(x) / pi ) + 0.5. I'm assuming this works because the limit as arctan(x) goes to infinity is pi/2, but dividing by pi makes that 1/2 and adding 1/2 makes that 1. – fxcd Oct 4 '17 at 20:55
• Yes, you are correct. :) – Emilio Novati Oct 5 '17 at 8:44

For each $n \in \mathbb N$ (including $0$) let $f_n \colon [n, n+1] \to \mathbb R$ be unique polynomial of degree $1$ such that $f_n(n) = 1- \frac{1}{n}$ and $f_n(n+1) = 1 - \frac{1}{n+1}$. $(\dagger)$

Then $f := \bigcup_{n \in \mathbb N} f_n \colon [0, \infty) \to [0,1)$ is injective.

Figure out how to extend $f$ on $(- \infty, 0]$ to an injective function $g \colon \mathbb R \to (-1,1)$ and then consider the injective function $$h \colon \mathbb R \to (0,1), x \mapsto \frac{g(x) +1}{2}.$$

$(\dagger)$ $f_n$ is essentially a line segment with smaller and smaller inclination as $n$ tends towards $\infty$.