Onto and one-one 
Let $f \colon A \to B$ be a surjection and $g \colon B \to C$ be such that
  $g\circ f$ is an injection. Prove that both $f$ and $g$ are
  injections.

Since $f$ is onto then there exists a $f(a)$ such that $f(a)=b$, for all $b\in B$. Now since $g\circ f$ is one-one then for $a,a'\in A$ we get that $ g(f(a)) \ne g(f(a'))$ implies that $f(a)\ne f(a')$. Then since $f(a)\ne f(a') \implies b=f(a)\ne f(a')=b'$ implies that $b\ne b'$ hence $g$ is also one-one.
I can't find a way to show that $f$ is one-one.
Can I just say that since  $b\ne b'$ and $f$ is onto then all of $b$ has an $a$ such that $f(a)=b$ but $f(a)\ne f(a')$ (which I proved above) thus $a\ne a'$ therefore $f$ is one-one?
 A: $f$ is injection:
Suppose $a, a' \in A$ and $f(a) = f(a')$. Applying $g$ to both side gives $g\circ f(a) = g\circ f(a')$. Since $g\circ f$ is injection, we conclude that $a = a'$. This shows that $f$ is injection. (Note that this is independent from the hypothesis that $f$ is surjection.)
$g$ is injection:
Suppose $b, b' \in B$ and $g(b) = g(b')$. Since $f$ in surjection, there exists $a, a' \in A$ such that $b = f(a)$ and $b' = f(a')$. Hence we get $g\circ f(a) = g(b) = g(b') = g\circ f(a')$. Since $g\circ f$ is injection, $a = a'$ follows. Applying $f$ to both side gives $b = f(a) = f(a') = b'$. This shows that $g$ in injection.
Edited: Your proof in the question is wrong. To show the injectivity of $h$, you have to show that 
$$ h(x) = h(y) \implies x = y$$
as I did above or its contoraposition 
$$ x \neq y \implies h(x) \neq h(y) $$
for all $x$ and $y$. So your proof should be 


*

*Assume $b \neq b'$.

*There exists $a, a' \in A$ such that $b = f(a)$ and $b' = f(a')$ since $f$ is surjection.

*Hence $f(a) \neq f(a')$.

*$a \neq a'$. Otherwise $f(a) = f(a')$, contradiction.

*$g \circ f(a) \neq g \circ f(a')$ since $g \circ f$ is injection.

*Therefore $g(b) \neq g(b')$.

*Conclude $g$ is injection.





*

*Assume $a \neq a'$.

*$g \circ f(a) \neq g \circ f(a')$ since $g \circ f$ is injection.

*Hence $f(a) \neq f(a')$. Otherwise $g \circ f(a) = g \circ f(a')$, contradiction.

*Conclude $f$ is injection.

A: if $f$ is not one-to-one there exists $a\neq a'$ such that $f(a)=f(a')$ then $g(f(a))=g(f(a'))$ because $g$ is a function, but $g\circ f$ is one-to-one so $a=a'$ in contraddiction with hypotesis.
