Condition for Composite Mapping to be Identity

Theorem
Let $S$ and $T$ be sets.

Let $f: S \to T$ and $g: T \to S$ be mappings such that:
 * $g \circ f = I_S$

where $I_S$ is the identity mapping on $S$.

Then $f$ is an injection and $g$ is a surjection.

Proof
From Identity Mapping is Bijection, $I_S$ is a bijection.

From Identity Mapping is Injection, $I_S$ is an injection.

From Injection if Composite is Injection it follows that $f$ is an injection.

From Identity Mapping is Surjection, $I_S$ is a surjection.

From Surjection if Composite is Surjection it follows that $g$ is a surjection.