What is an example of a function from the set of non-negative integers (0, 1, 2, 3..) to the set of integers? The function has to be bijective.
Asked
Active
Viewed 1,078 times
1
-
1Odd to positive; even to negative. – Mauro ALLEGRANZA Sep 28 '18 at 11:03
-
1Here is your answer: https://math.stackexchange.com/questions/873927/how-to-show-the-integers-have-same-cardinality-as-the-natural-numbers – ArsenBerk Sep 28 '18 at 11:07
-
Welcome to Math.SE. Please thoroughly search for an answer before asking a new question. Searching for bijection from N to Z gives thousands of answers. – GNUSupporter 8964民主女神 地下教會 Sep 28 '18 at 11:08
2 Answers
1
\begin{align}f:\mathbb N_0& \rightarrow \mathbb Z \\ n &\mapsto \frac{1}{4}(1-(-1)^n(2n+1)) \end{align}
user3342072
- 791
0
$$ f(n) = \begin{cases} n/2 & \mbox{even } n \\ -(n+1)/2 & \mbox{odd } n \\ \end{cases} $$ $$ f^{-1}(n) = \begin{cases} 2n & \mbox{if } n \geq 0 \\ -2n-1 & \mbox{if } n < 0 \\ \end{cases}$$ $$ f: \{0,1,2,3,4,5,6,...\} \rightarrow \{0,-1,1,-2,2,-3,3,...\} $$ $$ f^{-1}: \{...,-3,-2,-1,0,1,2,3,...\} \rightarrow \{...,5,3,1,0,2,4,6,...\} $$ The function $f$ is bijective
Angel Moreno
- 844