If $g\circ f$ is injective and $f$ is surjective then $g$ is injective
Solution 1:
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.
Solution 2:
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'$.