Let $f : A \to B$ and $g : B \to C$ be functions.
If $g \circ f$ is injective and $f$ is surjective, then $g$ is injective.
This question that correctly proves this theorem, but my proof seems to be different, so I'd like clarification on whether it's correct.
My Proof
We want to show that, for any $b_1, b_2 \in B$, $g(b_1) = g(b_2)$ iff $b_1 = b_2$.
Let $g(f(a_1)) = g(f(a_2))$, where $a_1, a_2 \in A$.
$\therefore f(a_1) = b_1$ and $f(a_2) = b_2$, where $b_1, b_2 \in B$. (Since $f$ is surjective.)
$\therefore g(b_1) = g(b_2)$, where $b_1 = b_2$. (Since $g \circ f$ is injective.)
$\therefore$ $g$ is injective. $\ \ \ Q.E.D.$
I would greatly appreciate it if people could please review my proof and elaborate on anything I've done incorrectly.
This is wrong because you are not starting with the hypothesis you are given. You want to show that $g(x) = g(y) \implies x = y$, so you have to start with the assumption that $g(x) = g(y)$. So begin with: