Left and Right Inverses of Mapping are Inverse Mapping/Proof 2

Theorem

Let $f: S \to T$ be a mapping such that:

$(1): \quad \exists g_1: T \to S: g_1 \circ f = I_S$
$(2): \quad \exists g_2: T \to S: f \circ g_2 = I_T$

Then:

$g_1 = g_2 = f^{-1}$

where $f^{-1}$ is the inverse of $f$.

Proof

From Left and Right Inverse Mappings Implies Bijection, we have that $f$ is a bijection.

Let $y \in T$ and let $x = f^{-1} \left({y}\right)$.

Such an $x$ exists because $f$ is surjective, and unique within $S$ as $f$ is injective.

Then $y = f \left({x}\right)$ and so:

 $\displaystyle f^{-1} \left({y}\right)$ $=$ $\displaystyle x$ $\displaystyle$ $=$ $\displaystyle I_S \left({x}\right)$ $I_S$ is the identity mapping on $S$ $\displaystyle$ $=$ $\displaystyle g_1 \circ f \left({x}\right)$ by hypothesis $\displaystyle$ $=$ $\displaystyle g_1 \left({y}\right)$ from above: $y = f \left({x}\right)$

So $f^{-1} = g_1$.

Also:

 $\displaystyle f \left({x}\right)$ $=$ $\displaystyle y$ $\displaystyle$ $=$ $\displaystyle I_T \left({y}\right)$ $I_T$ is the identity mapping on $T$ $\displaystyle$ $=$ $\displaystyle f \circ g_2 \left({y}\right)$ by hypothesis $\displaystyle \implies \ \$ $\displaystyle f^{-1} \left({y}\right)$ $=$ $\displaystyle x$ as $f$ is injective $\displaystyle$ $=$ $\displaystyle g_2 \left({y}\right)$

So $f^{-1} = g_2$.

$\blacksquare$