I'm asked to give examples of surjective functions $\mathbb{N} \rightarrow \mathbb{Z}$ and $\mathbb{N} \rightarrow \mathbb{N} \times \mathbb{N}$. Could a function $\mathbb{N} \rightarrow \mathbb{Z}$, just be $\mbox{floor}(x)$, and a function $\mathbb{N} \rightarrow \mathbb{N} \times \mathbb{N}$ be $x^2$? In both cases, every element in the codomain would be mapped to. Or is it meant to be a function like: $x \mapsto (x,y)$?
-
12Neither of these make sense. What is floor(x)? Usually I think of floor as a function that maps $x$ to the greatest integer less than or equal to $x.$ So it acts as the identity on $\mathbb N,$ and the identity $\mathbb N\to\mathbb Z$ is not surjective since the negative numbers aren't mapped to. And what do you mean by $x^2$? If you mean the squaring function, $x^2$ is not an element of $\mathbb N \times \mathbb N.$ It is a natural number, not an ordered pair of natural numbers. If you mean the ordered pair $(x,x),$ then this isn't surjective, cause, for instance, $(3,5)$ is not mapped to. – spaceisdarkgreen Dec 29 '18 at 06:58
-
1The pairing function https://en.wikipedia.org/wiki/Pairing_function might be a good place to start. – John Forkosh Dec 29 '18 at 09:44
-
For $\mathbb N\times\mathbb N$ you could look at these questions (and other posts linked there): Bijecting a countably infinite set $S$ and its cartesian product $S \times S$ and The cartesian product $\mathbb{N} \times \mathbb{N}$ is countable. – Martin Sleziak Dec 30 '18 at 10:36
2 Answers
An even natural number can be written as $2n$ and an odd one as $2n+1$ So an example of surjective function $\mathbb{N}\to\mathbb{Z}$ is $$f(x)=\begin{cases} -x/2=-n &\text{if $x$ even}\\ \frac{x-1}{2}=n &\text{if $x$ odd} \end{cases}$$
For the other example, consider the sequence $(p_{n})_{n\in\mathbb{N}}$ of prime numbers such that $p_{n}\ne p_{m}$ if $n\ne m$. Define $f(p_{n}^{k}):=(n,k)$ so that you have a surjective function from a subset of $\mathbb{N}$ to $\mathbb{N}\times\mathbb{N}$. You can map the others natural numbers wherever you want and you have a surjective function $\mathbb{N}\to\mathbb{N}\times\mathbb{N}$.

- 53,687

- 1,423
Just a brief comment on your attempt:
Could a function $\mathbb{N} \rightarrow \mathbb{Z}$, just be $\mbox{floor}(x)$, and a function $\mathbb{N} \rightarrow \mathbb{N} \times \mathbb{N}$ be $x^2$? In both cases, every element in the codomain would be mapped to.
By putting $f(x)=\lfloor x \rfloor$ you indeed define a function $f\colon \mathbb N\to\mathbb Z$. However, this function is not surjective. In fact, if you notice that $\lfloor x \rfloor=x$ holds for any integer, you can see that you have just written differently the function $f(x)=x$. So no element of $\mathbb N$ is mapped on a negative integer.
In the second case, you want codomain to be $\mathbb N\times\mathbb N$, so the values have to be ordered pairs. So the assignment $x\mapsto x^2$ does not even define a function from $\mathbb N$ to $\mathbb N\times\mathbb N$. (You could define, for example, function $\mathbb N\to\mathbb N$ or $\mathbb N\to\mathbb Z$ in this way. None of those two functions would be surjective.)

- 53,687