Let f : N → Z be given by f (x) = x, which is injective.
(If we take f(x) = f(y), then it gives x = y)
Let g : Z → Z be given by g (x) = |x|, which is not injective.
If we take f(x) = f(y), we get:
|x| = |y|
x = y
Now, gof : N → Z.
Let us take two elements x and y in the domain of gof , such that
So, gof is injective.