Please explain how to do this proof (involving functions)

Suppose that $f:A \longrightarrow B$ and $g:B \longrightarrow C$ are functions.

If $g \circ f$ is onto and $g$ is one-to-one, then prove that $f$ is onto.

How do I go about proving this?

From $g \circ f$ is onto, I know that there exists an $a \in A$ such that $g(f(a))=c$ and I also know that if $g(b_1)=g(b_2)$ then $b_1=b_2$ from the definition of one-to-one, but I'm not sure where to go from there. Any help would be great :)

-

Take $b$ in $B$. Let $c=g(b)$. Since $g\circ f$ is onto, you know.... Since $g$ is one-one, you can conclude from $(g\circ f)(a)=c$ and $g(b)=c$ that....

-
Note the general strategy that @Gerry used here: He first notes that he wants to prove that a function is onto. In otherwords, you should first look at what you want to prove, not what you are given as premeses. From there, look at the definition of onto and pay special attention to the quantifiers as these tell you how to begin your proof. – Code-Guru Aug 2 '12 at 0:47

Suppose $f$ is not onto. Then there exists a $b \in B$ such that $f(a) \neq b$ for all $a \in A$. Since $(g \circ f)$ is onto, there exists an $a$ such that $(g \circ f)(a) = g(b)$. By the injectivity of $g$, one has that $f(a) = b$. Contradiction.

-

You want to show that $f$ is onto, i.e. that for all $b\in B$ there is some $a\in A$ such that $f(b)=a$. So to start fix some $b\in B$. You know that $g$ is one-to-one, so if $g(f(a))=g(b)$ then $f(a)=b$. And you know that $g\circ f$ is onto, so for all $c\in C$ there is some $a\in A$ such that $g(f(a))=c$. In particular, what happens if you let $c=g(b)$?

-

Suppose $f$ is not onto. Then there is $x \in B$ such that $x \notin f(A)$, but $g(x) \in C$, so there exists $y \in A$ such that $g(f(y)) = g(x)$, but $f(y) \neq x$, contradicting our assumption that $g$ is one-to-one.

-