I'm trying to show that a piecewise function is one-to-one by showing that for all f(a) = f(b), a = b. The function is:

(x-2)/4 if x/2 is odd

-x/4 if x/2 is even.

I can show f(a) = f(b) implies a = b if a/2 and b/2 are both odd, and i can if they are both even.

Do i need to show f(a) = f(b) implies a = b for the case where a is even and b odd?

I would think i need to, because it should be for all a and b, but when i tried to i got

(a-2)/4 = -b/4 ==> a-2 = -b ==> a = -b+2.

so here it would not be true that f(a) = f(b) implies a = b and thus the function is not one-to-one.

I'm pretty sure that it is, though, and that i'm doing something wrong. The function is suppose to map positive even numbers to integers.

(f(2) = 0----------f(4) = -1--------f(6) = 1--------f(8) = -2....