[Math] Proof of onto and one-to-one functions, composition

discrete mathematicsfunction-and-relation-compositionfunctions

I want to prove this:

Let $f: A \to B$ and $g: B \to C $ be functions.

if $g \circ f$ is onto, and $g$ is one-to-one, then f is onto.

Here is what I have done, can someone please verify my work:

Let $y \in B$. And let $z = g(y) \in C$. Since $g \circ f$ is onto, there exists an $x \in A$ such that $g \circ f(x) = z$. So, we have, $g(f(x)) = z$.

We also have, $g(y)=z$, hence $g(f(x)) = g(y)$. Since $g$ is one-to-one, we conclude that $f(x)=y$. Therefore, shown that for any $y \in B$, there is an $x \in A$ such that $f(x) = y$. Therefore, $f$ is onto.

Best Answer

Let $y \in B$. Then $g(y) \in C$. Since $g\circ f$ is surjective (onto), it follows that there is some $x \in A$ such that $g\circ f (x) = g(y)$. But, since $g$ is injective (one-to-one), so $f(x) = y$. But this shows that $f$ is surjective.