Give an example of two functions f:N→N and g:N→N such that gof is onto but f is not onto.
Define f:N→N by f(x)=x+1
and g:N→N by g(x)={x−1, if x>11, if x=1
We first show that f is not onto
For this, consider element 1 in co-domain N.
Let f(x)=1⇒x+1=1⇒x=0, which is not a natural number.
Therefore, f is not onto. Now, gof: N→N is defined by,
gof(x)=g(f(x))=g(x+1)=(x+1)−1[∵x∈N⇒(x+1)>1]
Then, it is clear that for y in N, there exists x=y∈N such that gof(x)=y.
Hence, gof is onto.