Prove that $f: \mathbb{N} \to \mathbb{Z} $ is a bijection where the relation between $\mathbb{N}$ and $\mathbb{Z}$ is as follows:
$f(n)= \frac n2$ if n is even, and $-\frac {n+1}{2}$ if n is odd
Thanks for any and all help.
Prove that $f: \mathbb{N} \to \mathbb{Z} $ is a bijection where the relation between $\mathbb{N}$ and $\mathbb{Z}$ is as follows:
$f(n)= \frac n2$ if n is even, and $-\frac {n+1}{2}$ if n is odd
Thanks for any and all help.
On
This function proves $\mathbb{N}$ has the same cardinality as $\mathbb{Z}$.
But as for your question, the function is bijective because it is injective and surjective, both of which are easy to verify: each member of $\mathbb{N}$ maps to a distinct member of $\mathbb{Z}$ and all members of $\mathbb{Z}$ are mapped to by some $\mathbb{N}$.
To prove it is a bijection you must prove it is injective and surjective.
To prove it is injective we must prove if $f (x)=f (y)=z$ then $y=x $.
Case 1: assume $x $ and $y $ are both even. Then $f (x)=f (y)\implies x/2=y/2 \implies x=y $.
Case 2: assume $x $ and $y $ are both odd. Then $f (x)=f (y)\implies -\frac {x+1}2=-\frac {y+1}2\implies x+1=y+1\implies x=y $
Case 3: $x $ is even and $y$ is odd. Then $f (x)=f(y)\implies x/2=-\frac {y+1}2 \implies x+1 = -y \implies x+y=-1$ but as $x,y \in \mathbb N $, $x+y \ge 0$ so this is imposible.
Case 4: $x $ is odd and $y $ is even. This is impossible for the same reason as case 3 is.
So $f $ is injective.
To prove $f $ is surjective we need to show for all $z\in \mathbb Z $ there is an $x \in \mathbb N $ where $f (x)=z $.
If $z>0$ then $2z >0$ so $2z \in \mathbb N $ and $2z $ is even, so $f (2z)=2z/2=z $.
If $z=0$ then $f (0)=0/2=0$.
If $z < 0$ then $-2z-1>0$ so $-2z-1\in \mathbb N $ and $-2z-1$ is odd. So $f (-2z-1)=-\frac{-2z}2=z $.
So $f $ is surjective.