# Is $f :\mathbb Z \times\mathbb Z \to \mathbb Z$, $f(x, y) = 2x + y$ surjective/injecitve?

a) Determine if $$f$$ is injective.Prove your claim

b) Determine if $$f$$ is surjective. Prove your claim

Claim: $$f$$ is injective.

We will proceed by contrapositive. We know definition of injective is: Let $$A,B$$ be sets. A function $$f:A\to B$$ is injective if for every element $$(a_1,a_2)\in A$$ (with $$a_1\neq a_2$$), $$f(a_1)\neq f(a_2)$$. This simply means that different inputs go to different outputs, and one input can not produce two different outputs.

Let $$(n,m)∈ \mathbb Z \times\mathbb Z$$. We need to show:$$n=x$$ and $$m=y$$.

$$f(n,m)=2n+m$$

Let $$f(n,m)=f(x,y)$$ or $$(2n+m)=(2x+y)$$

Therefore, $$n=x$$ and $$m=y$$.

From this we can see that one element of the domain can only correspond to one value of the codomain. Hence, by the definition of injectivity, we can conclude that $$f$$ is injective.

I was wondering if this is right or not and how I should approach part b of the question. I know that $$f$$ is surjective because the codomain is equal to the range but I am not sure about how I can show it in proof format.

It is not injective because $$f(0,0)=f(1,-2)$$.
It is surjective because any integer $$n$$ can be written as $$f(0,n)$$.
• +1, and to emphasize that non-injectivity implies non-uniqueness representation, OP can also note that dividing $n$ by $2$ and writing it as $n= 2q+r$ (for a quotient $q$ and a remainder $r$), it's also true that $n = f(q,r)$. Commented Oct 15, 2020 at 1:24