Proof explanation: $g\circ f$ surjective $\implies$ $g$ is surjective

functionsproof-explanation

Problem:

Let $X,y,Z$ be sets and $f:X\to Y$, $g:Y\to Z$ functions. Prove: $g\circ f$ surjective $\implies$ $g$ is surjective

Proof:

Let $g\circ f$ be surjective and $z\in Z$. Choose $x\in X$ such that $g(f(x))=z$. Hence $g(y)=z$ with $y=f(x)$ and thus $g$ is surjective.

I don't understand why $g(y)=z$ with $y=f(x)$ implies that $g$ is surjective???

Thanks in advance..

Best Answer

What does it mean that a function is surjective? $g$ is a function from $Y$ to $Z$. You need to show that for each $z\in Z$ there is some $y\in Y$ such that $g(y)=z$. And this is what appears in the proof. You start from picking any element $z\in Z$ (without assuming anything about it) and show it is in the image of $g$.