I want to prove that this piecewise function is bijective
$$f: \Bbb R \to (-1,1), \quad f(x) = \begin{cases}1-\frac{1}{1+x} & \text{ if } x\ge 0 \\ -1+\frac{1}{1-x} & \text{ if } x \lt 0 \end{cases}$$
My attempt:
a) Injectivity: $f$ is injective iff $f(x)=f(y) \implies x=y$
Let $x,y \in \mathbb{R}$. There are four cases to consider.
if $x,y \ge 0$ both, then
$$f(x)=f(y) \iff 1-\frac{1}{1+x} = 1-\frac{1}{1+y} \iff x=y$$
if $x,y \lt 0$ both, then
$$f(x)=f(y) \iff -1+\frac{1}{1-x} = -1+\frac{1}{1-y} \iff x=y$$
if $x \ge 0, y \lt 0$, then
$$f(x)=f(y) \iff 1-\frac{1}{1+x} = -1+\frac{1}{1-y} \iff y = \frac{3x}{1+2x}$$
which is impossible, since $y$ is negative but $x$ is positive. So this case never occurs. The case for $y \ge 0, x \lt 0$ is analogous and therefore also never occurs.
Therefore $f$ is injective.
b) Surjectivity: $f$ is surjective iff $\forall y \in (-1,1)\, \exists x \in \mathbb{R}: f(x)=y$
Let $y \in (-1,1)$. Since the piecewise definition of the function is such, that $f \ge 0$ for $x \ge 0$ and $f \lt 0$ for $x \lt 0$, we need to consider two cases
if $y \in [0,1)$, then
$y = 1-\frac{1}{1+x} \iff x = \frac{1}{1-y}-1$. So $x \ge 0$ for $y \in [0,1)$ and $f(x) = y$.
if $y \in (-1,0)$, then
$y = -1+\frac{1}{1-x} \iff x = 1 – \frac{1}{y+1}$. So $x \lt 0$ for $y \in (-1,0]$ and $f(x) = y$.
Therefore $f$ is surjective.
A few questions:
- For a). Is my argument for the case $x \ge 0, y \lt 0$ correct? Is there an easier way to prove injectivity than to consider each case?
- For b). What if the range of $f$ doesn't split nicely for each case, e.g. that for the first case the range is positive and for the second case its negative. How do I prove surjectivity then if the range is more complicated?
Best Answer
(1) The injectivity argument for $x\ge0,y>0$ is correct. However, a better way to show injectivity would be to consider the inverse functions of each component, showing that for each $y$ in the range there is only one formula that gives an appropriate (in-its-domain) $x$, and that this $x$ is unique.
(2) This is not much of a problem. Surjectivity is slightly easier to prove than injectivity: just find for each $y$ in the range at least one function-piece that gives an appropriate $x$.