Proof explanation: $g\circ f$ surjective $\implies$ $g$ is surjective 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..
 A: 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$. 
A: We have
$g \circ f: X \to Z, \tag 1$
a surjective map; by definition this means
$\forall z \in Z \exists x \in X, \; g \circ f(x) = z. \tag 2$
Now $g \circ f$ factors through $Y$, thus:
$X \overset{f}{\to} Y \overset{g}{\to} Z; \tag 3$
therefore, 
$\forall x \in X, \; f(x) \in Y; \tag 4$
thus,
$\exists y = f(x) \in Y, \; g(y) = g(f(x)) = g \circ f(x) = z; \tag 5$
since in accord with (2) this holds for any $z \in Z$, 
$g: Y \to Z \tag 6$
is itself surjective.  $OE\Delta$.
A: Because that is what surjective means.
To prove $g:Y\to Z$ is surjective must prove that for every $z \in Z$ there is a $y\in Y$ so that $g(y) = z$.
And we know $g\circ f: X \to Z$ is surjective.  So for every $z \in Z$ there is an $x \in X$ so that $g(f(x)) = z$.  
.... But then $f(x) \in Y$ and $g(f(x)) = z$!  So if we set $y= f(x)$ that is exactly the $y$ we needed!
In other word:  For every $z \in Z$ there is an $x\in X$ and an $y=f(x) \in Y$ so that $g(y)=g(f(x)) = z$.  And that's the definition of surjection.
