$f: A \to A$ injective for finite $A$ implies surjectivity 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. 
 A: Your proof is true.However it can be more clear.Since $g$ is a bijective.
So $|C|=|A|$,and then $C=A$.
A: Looks good. But why not :
Since $A$ is finite, we can write an enumeration $(e_n)_{n=1}^N=A$ where $N=|A|$. Suppose $f$ is not surjective, i.e. there exists $n_1\leq N$ such that $\lnot e_{n_1}\in Im(A)$. Then $f(e_{n_1})\neq e_{n_1}$, hence there exists $n_2\neq n_1$ such that $f(e_{n_1})=e_{n_2}$. Then since $f$ is invective, $f(e_{n_2})\neq e_{n_2}=f(e_{n_1})$. Therefore by writing $e_{n_k}:=f(e_{n_{k-1}})$, ($k\leq N$) we have $\{e_{n_1},\cdots,e_{n_{N+1}}\}\subset A$ that are all different each other, (we can show this easily with mathematical induction. If $e_{n_{k+1}}\in\{e_{n_1},\cdots,e_{n_k}\}$ then $f(e_{n_{k+1}})=e_{n_1}$ which is false by hypothesis) which clearly is contradiction.    
A: Consider the (compositional) powers of $f$. Since $A$ is finite, there are only finitely many maps from $A$ to itself. Hence, the powers of $f$ cannot all be distinct, so $f^m=f^n$ for some $m \neq n$ (WLOG $m>n$).  Since $f$ is injective, we may cancel $n$ factors of $f$ from both sides, yielding $f^{m-n}=\mathrm{id}_A$. Hence, $f$ is bijective, with inverse $f^{m-n-1}$. In particular, $f$ is also surjective.
In fact, it is also true that any surjective map from a finite set to itself is injective. The same proof above still applies in this case. More generally, any left- or right-cancellable element of a finite monoid has a two-sided inverse, again with the same proof.
