Find an example of a function of a set of all integers to the set of positive integers that is surjective, but not injective.
I also need to prove it. I have tried but had no success. Even if I do find one, how would I prove it?
Background: OK, so I have run into this weird question about recurrence relations that I cannot complete by myself (first year comp. sci. student and first discrete math class, studying by myself due to quarantine). I study in a non-english university, so I am sorry if I haven't properly translated it. Now I am bad at this type of math and relations/funtions are the worst for me. I have spent some time on this question, but I cannot see the answer, so please try to be a bit precise in your answers. I am sure that I will understand it if someone can provide a good explanation. Thanks, your help will be very appreciated!!! :D
Another on is to let $f(n) = \lvert n \rvert + 1$. Then for all $z \geq 1$ in the positive integers we know that $$f(z-1) = f(-z+1) = z$$ Thus for any element $z$ in the codomain (positive integers) there is at least one element in the domain (all integers) that map to $z$. By definition the mapping is surjective.
More specifically, $z=1$ is mapped to only by $0$ but all remaining positive integers can be mapped to by both $-z+1$ and $z-1$.
However notice that $f(z-1) = f(-z+1)$ which means the mapping cannot be injective.