I have been slightly struggling with determining injective or surjective functions. The issue that I am having is that i'm unclear how to handle different domains. For example, the current domain is from $\mathbb{Z}$ to $\mathbb{Z}$ and the function is $f(n) = n/2.$
I have been solving these problems (for injective) by setting both sides equal to an arbitrary value i.e. $n_1$ and $n_2$ and solving to make them equal. My question becomes what if the value you are mapping to does not fall within the domain..in this case $\mathbb{Z}$ to $\mathbb{Z}$. So if I were to set $n = 1$ for example, we would end up with .5, which is not an integer. Is this still injective? I apologize if this is a stupid question. Does the domain only strictly effect inputs and not effect outputs? Do these rules apply to surjective as well?
If we want a relation to be injective or surjective, it needs to be a function in the first place, which means every element in the domain must match with exactly one element in co-domain (they may match with the same element or different elements).
In your question odd numbers in the domain don't match with anything so it is not a function at all. As a result, it is not injective. However, if we exclude odd numbers from the domain so that the domain becomes $\mathbb{Z}-\{...,-3,-1,1,3,...\}$, then your function is injective since every element in domain is matched with exactly one element in codomain (so $f$ is a function) and when we choose $n_1$ and $n_2$ such that $f(n_1) = f(n_2)$, we get to $\frac{n_1}{2} = \frac{n_2}{2} \implies n_1 = n_2$.