So, I'm trying to prove this particular theorem from Vladimir Zorich's Mathematical Analysis I. It's stated as follows:
Let $f:X \rightarrow Y$ and $g:Y \rightarrow X$ be functions. Then, $ (g \circ f = e_X) \implies$ (g is surjective) $\land$ (f is injective). $e_X$ is the identity mapping from X to X.
I was wondering if someone could check my proof and see if it works or not.
Proof
Let us construct $g \circ f$ as a set. This is done as follows:
$ g \circ f = \{ (x,x) \in X^2 : \exists y \in Y: ((x,y) \in f) \land ((y,x) \in g)\}$
Clearly, there are two statements that are being made here:
$\forall x \in X: \exists y \in Y: (y,x) \in g$
$\forall x \in X: \exists y \in Y: (x,y) \in f$
The first proposition implies that g is surjective, since the definition of surjectivity demands that there exist at least one input for every output.
Now, suppose that f is not injective. Then, the following proposition must be true:
$\exists x_1,x_2 \in X: [(x_1,y) \in f] \land [(x_2,y) \in f] \land (x_1 \neq x_2]$
Thus, there exists a $y \in Y$ such that $(x_1,x_2) \in g \circ f \land x_1 \neq x_2$. This is a contradiction, since $g \circ f$ is the identity mapping. Hence, f must be injective. This completes the proof.
Vladimir Zorich does provide a proof in the textbook, by the way, and i do understand that proof. However, the above is just my attempt at proving the theorem before I saw his proof. I'm trying to get into the habit of proving things on my own before seeing the actual proof done by the author.
So you want to show if $(g \circ f)=e_X$ then ($g$ is onto and $f$ is 1-1).
If $x \in X$ then $g(f(x))=x$ by assumption, so $x$ has a pre-image in $Y$ ($f(x)$) and so $g$ is onto.
If $f(x_1) = f(x_2)$ then $$x_1 = g(f(x_1)) = g(f(x_2)) = x_2$$ and so $f$ is 1-1.
This seems much simpler to me.