Give an example of two functions f:N→Z and g:Z→Z such that gof is injective but g is not injective.
Define f:N→Z as f(x)=x and g:Z→Z as g(x)=|x|.
We first show that g is not injective. It can be observed that
g(-1)=|-1|=1, g(1)=|1|=1
Therefore, g(-1)=g(1)but −1≠1. Therefore, g is not injective.
Now, gof:N→Z is defined as gof(x)=g(f(x))=g(x)=|x|
Let x,y∈N such that gof(x)=gof(y)⇒|x|=|y|
Since, x and y∈N, both are positive.
∴|x|=|y|⇒x=y
Hence, gof is injective.