Originally Posted by

**Alterah** Hello, I am having a problem with a certain function which is supposed to be one-to-one and onto. The function is:

$\displaystyle

g: Z \rightarrow N

$

$\displaystyle

g(z) = -2z$ if $\displaystyle z \leq 0

$

$\displaystyle

g(z) = 2z - 1$ if $\displaystyle z > 0

$

My approach is to tackle this by looking at each piece and trying to prove that each piece is one-to-one and onto. For the first part where z is less than or equal to 0, the one-to-one proof was straightforward. But proving it is onto seems straightforward, but I keep concluding it is NOT onto.

We've done the following in most of the onto proofs I have seen:

let g(z) = y

then:

-2z = y

z = -(y/2).

Because this isn't necessarily an integer (or part of the domain) I should conclude that it isn't onto, but the book says it is. Am I approaching the problem correctly? Or am I missing something? Thanks!

Edit: Nevermind, I see my problem. In this case y is defined as a natural number, but for this portion, y is also even. Thus, when I divide y by 2 in that last step, it will always be an integer.