$f: A \to A$ injective for finite $A$ implies surjectivity

elementary-set-theorysolution-verification

I was hoping someone could look over and critique this proof I wrote.

Let $A$ be a finite set. Then any function $f: A \to A$ that is injective is also surjective.

Proof. Let $f: A \to A$ be injective, where $A$ is a finite set. Define $C = \text{Im}(f)$, where by definition $C \subset A$. It suffices to show that $C = A$. For every $c \in C$, define
$$g_c = f^{-1} (\{c\}),$$
the inverse image of the element $c$ under the map $f$. Clearly, there exists a bijection $\alpha: \{g_c\} \to C$ given by $g_c \mapsto c$. Furthermore, since $f$ is injective, for any $c$, $|f^{-1} (\{c\})| = 1$.

Since $f$ is a total function on $A$, for every $a \in A$, there exists a unique $c \in C$ such that $f(a) = c$. Hence, the preimage of every $c \in C$ must exhaust the domain of $A$, so
$$\bigcup\limits_{c \in C} f^{-1} (\{c\}) = A.$$
Set equality implies equality in cardinality, so
$$\left \lvert \bigcup\limits_{c \in C} f^{-1} (\{c\}) \right \rvert = |A|.$$
As each of these sets $f^{-1} (\{c\})$ are disjoint (by injectivity of $f$), we can invoke finite additivity to write
$$\left \lvert \bigcup\limits_{c \in C} f^{-1} (\{c\}) \right \rvert = \sum\limits_{c \in C} |f^{-1} (\{c\})| = |A|.$$
Since we deduced earlier that the set $\{g_c\}$ are in bijective correspondence with $|C|$, we have
$$\sum\limits_{c \in C} |f^{-1} (\{c\})| = \sum\limits_{c \in C} 1 = |C| \cdot 1 = |C|.$$
Hence,
$$|C| = |A|.$$
Since $A$ and $C$ are finite sets, this implies that $C = A$. Hence, $\text{Im}(f) = A$, so $f: A \to A$ is surjective.

Best Answer

Your proof is true.However it can be more clear.Since $g$ is a bijective.

So $|C|=|A|$,and then $C=A$.