If $g \circ f$ is surjective, show that $f$ does not have to be surjective?

Solution 1:

Put $f:\mathbb{R}\to \mathbb{R}$ defined by $f(x)=x^2$, and $g:\mathbb{R}\to \{0\}$ defined by $g(x)=0$. Then $g\circ f:\mathbb{R}\to \{0\}$ is clearly surjective but $f$ is not surjective.

Solution 2:

Let $B=C=\{1,2\}$, and $A=D=\{3\}$. Then pick any functions $f,g$ you want, to get $g\circ f$ surjective but $f$ not surjective.