Set of all Self-Maps under Composition forms Monoid

Theorem
The set $S^S$ of all mappings from a set $S$ to itself forms a monoid $\left({S^S, \circ}\right)$ in which the operation $\circ$ is composition of mappings.

Proof
A mapping followed by another mapping is another mapping, from the definition of composition of mappings.

As the domain and codomain of two mappings are the same for a mapping $f: S \to S$, then the composite is defined.

Therefore $\left({S^S, \circ}\right)$ is closed.

Composition of mappings is associative.

The identity mapping is the identity element of this set of mappings.

Thus $\left({S^S, \circ}\right)$ is closed and associative, so forms a semigroup.

$\left({S^S, \circ}\right)$ has an identity element, so by definition is a monoid.