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$