If $g\circ f$ is injective and $f$ is surjective then $g$ is injective Let $f:A\rightarrow B$ and $g:B\rightarrow C$ be functions, prove that if $g\circ f$ is injective and $f$ is surjective then $g$ is injective.
I need advise or correction if something is incorrect with my proof. Thank you beforehand.
We must show that $g$ is injective, i.e for $x,y\in B, g(x)=g(y)\implies x=y$
Let $x,y\in B$ such that $g(x)=g(y)$. Because $f$ is surjective there exists $a,b \in A$ such that $f(a)=x$ and $f(b)=y$
$\implies g(f(a))=g(f(b))$
$\implies g\circ f(a)=g\circ f(b)$
$\implies a=b$ (by injectivity of $g\circ f$)
$\implies f(a)=f(b)$
$\implies x=y$
Would appreciate any correction in proof writing also!
 A: Your proof is correct. I myself would prove it exactly the same. But, I think it's useful to know more than one way, so here is an alternative solution. It's not profoundly different, but I think it's still worth mentioning.
I'm assuming that $A$ is nonempty (and, since there is a map from $A$ to $B$, $B$ is also nonempty). When $A$ is empty there's not much to prove.
The solution uses left and right inverses. A function with non-empty domain is injective iff it has a left inverse, and a function is surjective iff it has a right inverse.
So, we know that $g\circ f$ has a left inverse $h:C \to A$ and $f$ has a right inverse $k: B \to A$. We want to show that $g$ has a left inverse. Just observe that
$$
(f \circ h) \circ g = (f \circ h) \circ g \circ (f \circ k) = f \circ (h \circ g \circ f) \circ k = f \circ \mathrm{id}_A \circ k = f \circ k = \mathrm{id}_B,
$$
so $(f \circ h)$ is a left inverse for $g$. It follows that $g$ is an injection.
PS: this solution is actually worse than your original one, because this one relies on the axiom of choice (it is used when we say that surjectivity is equivalent to having a right inverse). But it is good in the sense that we don't look at particular elements and manipulate maps as "opaque" objects.
A: 
I need advise or correction if something is incorrect with my proof.

Your proof is good!

Would appreciate any correction in proof writing also!

To this, I would respond: its good to read different people's writing just for style. So here's my version of the proof, which is logically similar to yours but just differs on a few stylistic dimensions.
A few noteworthy points:


*

*You may prefer to write function arrows "backwards", as in $f : B \leftarrow A.$ See below.

*A fraction line can be used to mean "implies," see below.

*I prefer ending sentences without a big mass of symbols, using phrases like "as follows" and "below," and then putting the symbols immediately afterwards. See below.

*The word "fix" is a nice alternative to "let" when the latter has the right "basic meaning" but doesn't work grammatically. See below.

*If you're going to have a sequence of implications, I'd suggest making it as long as possible, and omitting the symbol $\implies.$ See below.


With that said, here's the proof:
Proposition. Let $g : C \leftarrow B$ denote a function and $f : B \leftarrow A$ denote a surjection. Then whenever $g \circ f$ is injective, so too is $g$.
Proof. Assume that $g \circ f$ is injective, and fix $b,b' \in B.$ The following implication will be proved.
$$\frac{g(b)=g(b')}{b=b'}$$
Since $f$ is surjective, begin by fixing elements $a,a' \in A$ satisfying the equations immediately below.
$$b = f(a),\;\; b'=f(a')$$
Then each statement in the following sequence implies the next.


*

*$g(b)=g(b')$

*$g(f(a)) = g(f(a'))$

*$(g \circ f)(a) = (g \circ f)(a')$

*$a=a'$

*$f(a)=f(a')$

*$b=b'$.

A: 
Here is alternative method 

note that :
 $$ g\circ f \mbox{ injective } \implies f \mbox{ injective  } $$
we have : 


*

*$ f \mbox{ is injective and surjective } \implies f \mbox{ bijective (one-to-one correspondence)  } $


Since $f$ is a bijection, it has an inverse function $f^{-1}$ which is itself a bijection.


*

*$f^{-1} \mbox{is bijective} \implies f^{-1} \mbox{ injective  } $

*$$ \begin{cases}
 g\circ f \mbox{ injective } & \\
 f^{-1} \mbox{ injective } & \\
f^{-1}(B)\subset A &\\
 \end{cases} \implies  g\circ f \circ f^{-1} \mbox{ injective}$$

*Since  $$\forall x\in B \qquad \begin{align} (g\circ f)\circ f^{-1}(x)&=g\circ (f\circ f^{-1})(x)\\
&=g\circ {\rm id}_{B}(x)\\
&=g({\rm id}_{B}(x))\\
(g\circ f)\circ f^{-1}(x)&=g(x)\\
\end{align}$$
then 
$$(g\circ f)\circ f^{-1}=g$$
since $(g\circ f)\circ f^{-1}$ injective then $g$ is injective 
A: I've proved it on my own like this:
Pick two arbitrary elements of $B$, $y_1$ and $y_2$, with $g(y_1)=g(y_2)$. Since $f$ is surjective, $y_1=f(x_1)$ and $y_2=f(x_2)$ for some $x_1,x_2 \in A$. Then $g(f(x_1))=g(f(x_2))$. Since $f \circ g$ is injective, $x_1=x_2$, and so $f(x_1)=f(x_2)$, or $y_1=y_2$. Finally, $g$ is injective.
