Proving a function is surjective given the composition is surjective [duplicate]

This question already has an answer here:

Here is the question $f:X \rightarrow Y$ and $g: Y \rightarrow Z$ are functions and $g \circ f$ is surjective, is $g$ surjective?

My proof: If $g \circ f$ is surjective than $\forall z \in Z \; \exists x \in X \; \mid (g \circ f)(x)=z$ Suppose $f$ is surjective, than $\forall y \in Y \; \exists x \in X\; \mid f(x)=y$. By def. of $(g\circ f)(x)=z$ we have $g(f(x))=z$ and since $f(x)=y$ than we have $g(y)=z$ which implies surjectivity therefore $g$ is surjecive.

Is this the correct way to prove that $g$ is surjective? Or can I not assume surjectivity on $f$

marked as duplicate by Najib Idrissi, user147263, N. F. Taussig, Harish Chandra Rajpoot, Ali CaglayanOct 27 '15 at 11:33

You should assume $g \circ f$ is surjective, not $f$. Let $z \in Z$. Choose $x \in X$ so that $g(f(x)) = z$. Let $y = f(x)$. Then $g(y) = z$.
• You are assuming surjectivity when you let $y=f(x)$ are you not? – adam May 1 '14 at 15:52
• No. $x \in X$ has been chosen. Apply $f$ to get $y$. – Umberto P. May 1 '14 at 16:12
• So basically just omit the part where I assume $f$ is surjective and I'm good? But than how does this show $g$ is surjective if there could be a element in $X$ that is not necessairly in $Y$ take $-3$ from the reals and $y=\sqrt{x}$ I dont see how you can just omit it. – adam May 1 '14 at 16:16