What is an example of function $f: \Bbb{N} \to \Bbb{Z}$ that is a bijection?
Could you give me an example of function $ f \colon \mathbb N \to \mathbb Z$ that is both one-to-one and onto? Does this work: $f(n) := n \times (-1)^n$?
N starts with zero.
First note that $\Bbb{Z}$ contains all negative and positive integers. As such, we can think of $\Bbb{Z}$ as (more or less) two pieces. Next, we know that every natural number is either odd or even (or zero for some people) so again we can think of $\Bbb{N}$ as being in two pieces. lastly, let's try to make a map that takes advantage of the "two pieces" observation . That is, let's make a function from evens/odds to positives/negatives. Let $f: \Bbb{N} \to \Bbb{Z}$ where
$$f(n) = \begin{cases} \frac{n}{2} & n\text{ is even} \\ -\frac{n + 1}{2} & \text{else} \end{cases}$$
This map is a bijection, although I will leave the proof of that up to you.
$$f(n) = n\text{th number in the sequence }0, 1, -1, 2, -2, \ldots$$