1

I came across this question and wasn't too sure how to do it. Can anyone explain this? Construct a bijective function f : N → Z. Also, find its inverse.

Any help is appreciated.

3 Answers3

0

How about $f(0)=0, f(1) = -1, f(2) = 1, f(3) = -2, f(4) = 2, \ldots$

gt6989b
  • 54,422
0

Define $$f:n\mapsto \begin{cases} \frac n2 \quad &\text{if } n\text{ even},\\ -\frac{n+1}2 \quad &\text{if } n\text{ odd}\end{cases},$$

assuming the convention $0\in\mathbb N$.

The inverse is

$$f^{-1}:n\mapsto \begin{cases} 2n &\quad \text{if } n\ge 0,\\ -2n-1 &\quad \text{if } n<0\end{cases}.$$

DominikS
  • 2,510
0

Hint: $f: \mathbb N \to \mathbb Z$, where $f(0)=0$, $f(2n)=n$ and $f(2n-1)=-n$, for all $n\geqslant 1$.

ntt
  • 1,143
  • 6
  • 13