Give examples of two functions $t: \mathbf{N} \rightarrow \mathbf{Z}$ and $g: \mathbf{Z} \rightarrow \mathbf{Z}$ such that $g \circ f$ is injective but $g$ is not injective.
(Hint: Consider $f(x)=x$ and $g(x)=|x|$ )
Define $f: \mathbf{N} \rightarrow \mathbf{Z}$ as $f(x)=x$ and $g: \mathbf{Z} \rightarrow \mathbf{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 \neq 1 .$
$\therefore g$ is not injective.
Now, gof. $\mathbf{N} \rightarrow \mathbf{Z}$ is defined as $g \circ f(x)=g(f(x))=g(x)=|x|$
Let $x, y \in \mathbf{N}$ such that $g \circ f(x)=g \circ f(y)$.
$\Rightarrow|x|=|y|$
Since x and y ∈ N, both are positive.
$\therefore|x|=|y| \Rightarrow x=y$
Hence, gof is injective