Finding a function $\mathbb{N} \to \mathbb{N}$ that is surjective but not injective.

570 Views Asked by At

The mapping is supposed to be from $\mathbb{N}$ to $\mathbb{N}$.

I'm still trying to understand if this is possible, I mean if it was from $\mathbb{R}$ to $\mathbb{N}$, I guess $x^2$ would work.

3

There are 3 best solutions below

1
On BEST ANSWER

Let $f(1) = 1$ and $f(n) = n-1$ for all $n \geq 2$.

The function is not injective since $f(1) = f(2)$, but $1\neq 2$.

If $n \in \mathbb N$, then $f(n+1) = n+1-1 = n$ so that $f$ is surjective.

0
On

Consider the function that takes even numbers $2n$ to $n,$ and that maps all odd numbers to $1,$ or any other element in $\mathbb N$ that you like.
Hope this helps.

0
On

Consider $f: \mathbb{N} \to \mathbb{Z} \to \mathbb{N}$, where the first function is $$ 0,1,-1,2,-2,3,-3,\dots $$ and the second function is $$ x \mapsto |x| $$