Injection from Finite Set to Itself is Surjection

Theorem
Let $S$ be a finite set.

Let $f: S \to S$ be an injection.

Then $f$ is also a surjection.

Proof
Let $a \in S$.

We need to show that there exists $b \in S$ such that $a = f \left({b}\right)$.

Consider what happens when $f$ is applied repeatedly on $S$.

Let $f^2$ denote $f \circ f$ and, generally, $f^n := f \circ f^{n-1}$.

Consider the sequence of elements of $S$:
 * $a, f \left({a}\right), f^2 \left({a}\right), \ldots$

Because $S$ is a finite set, there must be repetitions.

That is, there must exist $r, s \in \N$ such that:
 * $f^r \left({a}\right) = f^s \left({a}\right)$

where $r \ne s$.

WLOG assume $r > s$.

Since $f$ is an injection, $f$ is left cancellable.

Thus:

That is, $b = f^{r-s-1} \left({a}\right)$.