TITLE: prove/disprove that if $f\circ g$ injective and g is surjective, then f is injective
QUESTION [6 upvotes]: Question would be: prove/disprove that if $f\circ g$ injective and g is surjective, then f is injective.
after thinking, I came to the conclusion that it's a proof. tried to prove it but it looks not that valid. Would appreciate your feedback and corrections.
Proof:

because $f\circ g$ is injective, then g is injective as well.
because it's given that g is surjective, and we came to conclusion it's also injective -> it's reversible by $g^{-1}$
if $f\circ g$ is injective and $g^{-1}$ is injective, then $f\circ g\circ g^{-1}$ injective as well.

Let there be $a_1,a_2$. $a_1=a_2 \iff f\circ g\circ g^{-1}(a_1)=f\circ g\circ g^{-1}(a_2) \iff f\circ i(a_1) = f\circ i(a_2) \iff f(a_1)=f(a_2)$
What do you think??

REPLY [7 votes]: I do not think your proof is wrong per se, but I would go about things a little more directly.
Suppose $f(x_1)=f(x_2)$. There exist $y_1,y_2$ such that $x_1=g(y_1)$ and $x_2=g(y_2)$. We have $f\circ g (y_1)=f\circ g (y_2)$. So $y_1=y_2$. So $x_1=x_2$.