# Determining whether a function with more than one variable is onto (surjective)

I've been working through various examples of functions that are 1-1, onto or both and came across an example that I didn't really know how to tackle.

Essentially we have a function $$f(x,y) = (-1)^xy$$ with a domain and codomain of $$Z$$.

Showing that this function isn't 1-1 is relatively straight forward through the use of a counterexample (say $$f(2, 1)$$, $$f(4, 1)$$), however, I am having some trouble showing that this function is onto.

I can see from the function definition that the function is onto (as you essentially have -1 or 1 * any integer) but don't know how to show this as an actual proof.

Just go back to the formal definition of a surjective function. Here you have a function $$f : {\Bbb Z} \times {\Bbb Z} \to {\Bbb Z}$$. This function is surjective if for each $$z \in {\Bbb Z}$$, there exists $$(x,y) \in {\Bbb Z} \times {\Bbb Z}$$ such that $$f(x,y) = z$$. Since $$f(2,z) = (-1)^2z= z$$, your function is indeed surjective.