Mapping is Idempotent iff Restriction to Image is Identity Mapping

Theorem
Let $S$ be a set.

Let $S^S$ denote the set of mappings from $S$ to itself.

Let $f \in S^S$ be a mapping on $S$.

Then:
 * $f$ is idempotent


 * the restriction of $f$ to $\Img f$ is the identity mapping.
 * the restriction of $f$ to $\Img f$ is the identity mapping.

Proof
Recall the definitions:


 * $\Img f$ denotes the image set of $f$


 * The identity mapping $I_S$ is defined as:
 * $\forall x \in f: \map {I_S} x = x$


 * An idempotent mapping is a mapping with the property:
 * $f \circ f = f$
 * where $\circ$ denotes composition of mappings.

Necessary Condition
Let the restriction of $f$ to $\Img f$ be the identity mapping.

Then:

That is:
 * $f \circ f = f$

and by definition $f$ is idempotent.

Sufficient Condition
Let $f$ be an idempotent mapping.