Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$f:Z \rightarrow Z$

$f(x) = x-5$ , when $x$ is odd

$f(x) = x+3$ , when $x$ is even

It seems that it is not onto, because not all integers are covered, but how do you show this?

share|cite|improve this question
But it is onto! look at the individual y-sets for each of those functions. You see that the first function produceds a y-set of all even numbers, and the second function produces a y-set of all odd numbers. Combining them makes all the integers. – mathguy Nov 9 '12 at 4:26
Following on mathguy's comment: if X is odd, what is $f^{-1}(X)?$ and if X is even, what is $f^{-1}(X)$> – Ross Millikan Nov 9 '12 at 4:30

This is indeed onto,

Pick any $a\in\mathbb{Z}$.

if $a$ is odd we know that $a - 3$ is even (since $a - 2$ is clearly odd) so $f(a - 3) = a$.

if $a$ is even we know that $a + 5$ is odd (since $a + 4$ is clearly even) so $f(a + 5) = a$.

This function is also one to one, and I leave this partially to you, to see this note that for odd $x$, $f(x)$ only hits even numbers and never hits the same number twice. And for even $x$ this only hits odd numbers.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.