- #1
pondzo
- 169
- 0
Homework Statement
##f:\mathbb{Z} \to \mathbb{N}##
## f(x) = \begin{cases} 2x+2 & \text{if } x \geq 0 \\ -2x-1 & \text{if } x < 0 \end{cases} ##
Prove that f is a bijection from ##\mathbb{Z}## to ##\mathbb{N}##
Homework Equations
The Attempt at a Solution
Proving that it is an injection if quite simple. Proving it is a surjection is where i get confused.
Let ##y\in\mathbb{N} \text{ and } x \in \mathbb{Z}##
If ##x \geq 0 \text{ then } y=2x+2 ~~\Rightarrow~~ x=\frac{y-2}{2} ##
if ##y\geq 2 \text{ then } f(\frac{y-2}{2})=2(\frac{y-2}{2})+2=y##
if ##y<2 \text{ then } f(\frac{y-2}{2})=-2(\frac{y-2}{2})-1=1-y##
If ##x<0 \text{ then } y=-2x-1 ~~\Rightarrow~~ x=\frac{-(y+1)}{2}##
if ## y \geq -1 \text{ then } f(\frac{-(y+1)}{2})=2(\frac{-(y+1)}{2})+2=1-y##
if ## y<-1 \text{ then } f(\frac{-(y+1)}{2}) = -2(\frac{-(y+1)}{2})-1=y##
I'm pretty sure there should only be 2 or at most 4 cases that i need to investigate but i have 6. So I am clearly doing something wrong... Could someone help me out please?
Last edited: