$g$ is a function from $\mathbb Z$ to $\mathbb Z$ such that $g(x)=\lfloor2x\rfloor$.
Can anyone explain how to find whether this function is injective or surjective
$g$ is a function from $\mathbb Z$ to $\mathbb Z$ such that $g(x)=\lfloor2x\rfloor$.
Can anyone explain how to find whether this function is injective or surjective
Most students asking this sort of question are having trouble grasping the definitions (in this case, of injective and surjective).
Also, be careful: The domain of $g$ is the integers, not the reals (at least as the problem is posed here).
Let's examine whether $g(x)$ is injective; by definition, that means let's ask "can any two different values of $x$ map to the same value of $g(x)$"?
Clearly not, since if $x_1 \neq x_2$ then $|x_1-x_2| \geq 1$ so the values of the floors of double the $x_1$ and $x_2$ must differ more than $(2-1-1)$ (actually, by at least $2$). So the function is injective.
Now see if $g(x)$ is surjective: "Can there be any value $g_0 \in \Bbb{Z}$ such that $\forall x \in \Bbb{Z} : \lfloor 2x \rfloor \neq g_0$?"
Well, consider $g_0 = 1$ (or indeed any odd integer). No floor of double an integer is odd, so the function cannot be surjective.
If the same question were asked using the domain $x \in \Bbb{R}$, and the codomain for $g(x)$ remains $\Bbb{Z}$, then the function would not be injective ($1$ and $1.1$ lead to the same $g(x) = 2$) but now it would be surjective since any integer $n$ can be expressed as $\lfloor 2(n/2)$ for $x$ equal to the real number $n/2$.