-1

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)$?

2 Answers2

1

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}$.

ecrin
  • 1,423
1

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.)