Hi I want to show whether the below function is onto or one-to-one or neither, but I'm a bit stuck.
For one-to-one I think it's enough to show that if I have the integers 2, 4, -2, -4 I end up with the same f(a, b), thus it's not one to one.
I am slightly more confused when it comes to the onto proof, any ideas?
f: Z x Z -> Z given by f(a, b) = |a| - |b|
Your proof for the function not being one-to-one has the right idea, but your function takes pairs of integers, not integers. You should say that $f(2,4)=f(-2,-4)$
To show it is onto, you just want to show that if you are given an integer $k$ you can find an ordered pair $(a,b)$ such that $f(a,b)=k$. You don't have to have the same rule for every $k$. It is easier here if you split it depending on the sign of $k$. If $k \ge 0$ can you find an ordered pair? If $k \lt 0$?