Give an example of a function $f(x)$ for which $f([-1,1])=(-\infty ,\infty)$ A question from Introduction to Analysis by Arthur Mattuck:
Give an example of a function $f(x)$ for which $f([-1,1])=(-\infty ,\infty)$.
Since $f$ is defined on a closed interval, how can infinity be achieved?
 A: Hint. Take a non-continuous function (otherwise $f([-1,1])$ is a bounded and closed interval). For example consider $f(x)=\tan(\pi x/2)$ and extend it at $-1$ and $1$ by setting $f(-1)=a$ and $f(1)=b$ with $a,b\in \mathbb{R}$.
A: Examples were given with onto functions, but we can even devise a bijection, for instance let consider:
$$\require{AMScd} \begin{CD} [-1,1] @>\phi>> ]-1,1[ @>\mathrm{tanh^{-1}}>> \mathbb R \end{CD}$$
The function $\phi$ will take $1$ and $-1$ and send them to inside points, these points in turn will be send to deeper inside points and so on in a cascade of replacements. (Note: with $0\in \mathbb N$)
$\phi:\begin{cases} 
\phi(2^{-n})=2^{-(n+1)} & \forall n\in\mathbb N\\
\phi(-2^{-n})=-2^{-(n+1)} & \forall n\in\mathbb N\\
\phi(x)=x & \text{elsewhere}\end{cases}$
The function $\phi$ is bijective but not continuous, while $\tanh^{-1}$ is bijective and continuous on the considered intervals.
If both functions would be continuous then $[-1,1]$ would be sent to $[-\infty,\infty]=\bar{\mathbb R}$ the compactified real set.
You can eventually replace $\tanh(x)$ by $\dfrac x{1+|x|}$ or $\tan(\pi x)$ (or their respective reciprocal) for the same kind of result.
