I'm asking this question on regards to an assignment my teacher handed out and she has a nasty habbit of never replying to e-mails. The question is already answered but it only brings up more questions than it answers.
She wrote down the answer to this was False $f(2) = f(-2)$ but if the condition was that it was an integer implies an integer, how would it not be an onto? The answer it gives is always going to be an integer
It could just be that I don't understand the question but is it because that it wasn't positive integers imply positive integers? ($\Bbb Z^+ \to\Bbb Z^+$).
Thanks
I think you have mixed up a couple of things.
A quick refresher on terminology:
Domain: the given set of valid inputs to the function. For this answer I will write this as $Dom(f)$
Co-domain: the given set of possible valid outputs from the function.
Range: the actual set of outputs from the function, i.e. the set of $\{f(x) : x \in Dom(f)\}$. The range is a subset of the co-domain.
Injection (aka one-to-one): for any value in the co-domain, there is at most one value in the domain that is mapped onto it. We often write this as $\forall x,y \in Dom(f): f(x) = f(y) \implies x = y$
Surjection (aka onto): every value in the codomain is in the range (the set of actual outputs), or in other words you can always find an input that will map to it. We often write this as $\forall z \in Range(f): \exists x \in Dom(f) f(x) = z$
Bijection: the function is both an injection and a surjection, meaning that there is an exact correspondence between the domain and codomain of the function.
If your function was expressed as $f: \mathbb{Z} \rightarrow \mathbb{Z}$, then both the domain and codomain are the set of integers.
Is $f$ injective? No, because there exist values in the codomain with multiple possible inputs from the domain. For example, $f(2) = f(-2)$. This is the point of the note.
Is $f$ surjective? No, because there exist values in the codomain with no possible inputs. For example, it is clear that $f$ will always produce a positive value, so any negative integer will not be in the range of the function. And, as pointed out in the comments, even if the codomain were restricted to $\mathbb{Z}^+$, i.e. the positive integers, there are plenty of gaps (e.g. there is no $x \in \mathbb{Z}$ such that $f(x) = 3$).