by HallsofIvy » Wed Mar 06, 2019 12:01 pm
Saying that a function f: X->Y is surjective (onto) means that, for any y in Y, there exists x in X such that f(x)= y. That is, we can "get" any member of Y using some member of X.
Here, f(x)= x+ 1 if x is an even integer, f(x)= x- 1 if x is an odd integer. The crucial point is that if an integer, n, is even then both n+ 1 and n- 1 are odd and if n is odd then both n+ 1 and n- 1 are even.
Suppose y is even. Then x= y+ 1 is odd. f(x)= x- 1= (y+ 1)- 1= y.
Suppose y is odd. Then x= y- 1 is even. f(x)= x+ 1= (y- 1)+ 1= y.
Since every member of Z is either even or odd, for any y in Z, there exist x in Z such that f(x)= y.