Prove that the interval $(0, 1)$ and the Cartesian product $(0, 1) \times (0, 1)$ have the same cardinality

Answer to second question (much easier): Take for example $f(x)=e^{-x}$

Answer to first question:

There are some obvious injective functions from $(0,1)$ to $(0,1)\times(0,1)$, namely $f(x)=(\frac12,x)$, for example.
So the difficult part is finding an injective function from $(0,1)\times(0,1)$ to $(0,1)$. But it is not so difficult. In decimal expansions, let's disallow infinite strings of $9$'s and we have an unique decimal expansion for each number in $(0,1)$. If we have two numbers like $0.a_1a_2a_3\ldots$ and $0.b_1b_2b_3\ldots$, we can "build" a number merging alternatively the digits of each one, so we define $$f(0.a_1a_2a_3\ldots, 0.b_1b_2b_3\ldots)=0.a_1b_1a_2b_2a_3b_3\ldots$$


There is a bijection between $(0,1) $ and $ \left(-\frac{\pi}{2}, \frac{\pi}{2}\right) $ by the following map $$ x\mapsto \pi x-\frac{\pi}{2} $$ and $\tan(x)$ is a bijection between $\mathbb{R}$ and $ \left(-\frac{\pi}{2}, \frac{\pi}{2}\right) $. So we take the composition to get the bijection between $(0,1)$ and $\mathbb{R}.$ In the first answer you will get the bijection from $(0,1)\times (0,1) $ to $(0,1)$. The following link proved that cardinality of $\mathbb{R}$ and $\mathbb{R}^2$ are same. $(0,1)\times (0,1)$ ahs the same cardinaltiy as $\mathbb{R}^2.$ So $(0,1)$ and $(0,1)\times (0,1)$ have the same cardinality.

For the second part, $$ f(x)=\frac{x}{1+|x|},\ x\in (0,\infty) $$