Proving a function from a cartesian set to a set is onto

CONTEXT: Question made up by uni lecturer.

How do you prove that a function mapping from a Cartesian product of the integers to the integers is onto?

The function is $$f:Z$$x$$Z$$ to $$Z$$ where $$f((m,n))=2m-n$$.

I'm pretty sure the function is onto, since I can't think of an integer that can't be written in terms of $$2m-n$$ where $$m$$ and $$n$$ are integers, but am unsure of how to show this.

• You can take $m=0$, so this is really fairly straightforward. Slightly more challenging: is $f((m,n)) = 2m-3n$ surjective? May 3 '19 at 1:44
• @JaneDoé doesn't surjective and onto mean the same thing? May 3 '19 at 1:57
• @RubyPa yes it is. May 3 '19 at 2:04
• Sorry, yes, "surjective" and "onto" mean the same thing, so much so that I switch to saying "surjective" without thinking! The point is that it is slightly harder to see that $f((m,n)) = 2m-3n$ is onto. May 3 '19 at 2:04

Hint: Set $$m=0$$. $$~~~~~~~~~~~~$$
$$f((n,n))=2n-n=n,$$ so any $$n\in\mathbb Z$$ has $$(n,n) \in \mathbb Z \times \mathbb Z$$ in its pre-image.