If $g \circ f$ is injective, so is $g$
I don't think this is true. I think that $f$ has to be surjective.
So I am going to try to prove that:
If $g \circ f$ is injective, and $f$ is surjective, then $g$ is injective.
First off, $g \circ f$ means that $(g \circ f)(a) = (g \circ f)(b)$ then $a=b$.
And $f$ being surjective means that $\forall b \in B, \exists a\in A$ such that $f(a)=b$
Proof
Suppose that $g$ was not injective.
$g(f(a))= g(f'(a))$ and $f(a)\ne f'(a)$
But $g(f(a)) = g(f(b)) \to a=b$ $g(f(a))= g(f(b)) \to f(a)=f(b) \to a=b$ Hence contradiction, since $g$ is not injective.
So $g$ is injective.
Is this an acceptable proof, I think my logic is iffy around the second last paragraph.
Here is a proof which does not use contradiction.
Let $g$ be a function from $Y$ to $Z$. Suppose that $f:X\to Y$ is surjective and $(g\circ f):X\to Z$ is injective.
Let $y_1,y_2\in Y$ and suppose that $g(y_1)=g(y_2)$. Since $f$ is surjective we can write $y_1=f(x_1)$ and $y_2=f(x_2)$ for some $x_1,x_2\in X$, so $$(g\circ f)(x_1)=g(f(x_1))=g(y_1)=g(y_2)=g(f(x_2))=(g\circ f)(x_2)\ .$$ Since $g\circ f$ is injective $x_1=x_2$ and so $y_1=y_2$. Thus $g$ is injective.