Proving bijectivity of $f:[0,\infty)\to[0,2)$, where $f(x)=\frac{1}{x}+1$ for $x>1$, and $f(x)=x$ for $x\le 1$ 
Let $f: [0, \infty) \rightarrow [0,2)$ be defined by $$f(x) = \left\{
\begin{array}{ll}
      \frac{1}{x} + 1, & x > 1 \\
      x, & x\le 1 \\
\end{array} 
\right.$$
The question asks to prove that the function is bijective.

I have to prove it is injective and surjective. 
Injectivity:
if $x,y<1$, then $x=y$
if $x,y>1$ then, $\frac{1}{x}+1=\frac{1}{y}+1$, then $x=y$

I get this bit, but I don't get how to prove the surjective part of the proof. 

Please could you help?
 A: Let $$f_1(x)=x$$ for $$x\in [0,1]$$
and
$$f_2(x)=\frac 1x +1$$ for $$x>1$$
$f_1$ is a bijection from $[0,1] $ to $[0,1]$ and $ f_2$ is a bijection from $(1,+\infty)$ to $ (1,2)$. thus $f$ is a bijection from $[0,1]\cup (1,\infty)$ to $[0,1]\cup (1,2)$.
Other proof.
Let $ y\in[0,2)$. We will prove it has only one antecedent.
If $y\in[0,1]$ then $f(y)=y$.
the antecedent is unique in $[0,1]$
if $y\in(1,2)$ then $f(\frac{1}{y-1})=y$ with $\frac{1}{y-1}>1$.
the antecedent is unique in $(1,\infty)$
A: Injectivity:  Suppose $f(x) = f(y)$.
There are four cases:  $0 \le x \le 1$ and $0\le y \le 1$ and $f(x) = x = f(y) = y$.  Thus $x = y$.
$0 \le x \le 1$ and $y > 1$ and $f(x) = x = f(y) = \frac 1y +1$.  So $x = \frac 1y + 1$. And $y= \frac 1{x-1}$.  But if $y > 1$ then $0 < \frac 1y < 1$ and $1 < \frac 1y + 1< 2$ which contradicts $0\le x \le 1$.  (Likewise $0\le x=\frac 1y + 1 \le 1\implies -1 \le \frac 1y \le 0\implies y < 0$ also a contradiction).
$x> 1$ and $0 \le y \le 1$.  .... also gives a contradiction...  Too similar to the above to bear discussing.
[Note: we could have avoided these contradictory options by noting that $0\le w \le 1 \implies 0\le w=f(w) \le 1$ and $w > 1 \implies 0<\frac 1w < 1\implies 1 < \frac 1w + 1 = f(w) < 2$.  So $f(w) \in [0,1] \iff w \in [0,1]$ and $f(w) \in (1,2) \iff w\in (0,1)$.]
Fourth and final case $x > 1$ and $y > 1$.  Then $\frac 1x + 1 = \frac 1y + 1$ so $\frac 1x = \frac 1y$ so $x=y$.
So $f(x)=f(y)\implies x=y$. 
Surjectivity:
Let $k \in [0, 2)$.  If $1 < k < 2$ and if $2>\frac 1x + 1 = k >1$ then $1> \frac 1x = k- 1 > 0$ and $x =\frac 1{k-1} > 1$.  
So if $1 < k < 2$ then $\frac 1{k-1} >1$ so $f(\frac 1{k-1}) = k$.
If if $0\le k \le 1$ then $f(k) = k$.
Either way for all $k\in [0,\infty)$ there is $x$ either equal to $k$ if $k \le 1$ or equal to $\frac 1{k-1}$ if $k > 1$  so that $f(x) = k$.
