I'm studying Herstein's Topics in Algebra and stumbled upon the following problem (Chapter 0, section 2, problem 8):
If the set S has a finite number of elements, prove the following:
(a) If $\sigma$ maps S onto S, then $\sigma$ is one-to-one.
(b) If $\sigma$ is a one-to-one mapping of S onto itself, then $\sigma$ is onto.
(c) Prove, by example, that both part (a) and part (b) are false if S does not have a finite number of elements.
Where i can solve (b) and (c) with no difficulty but I can't quite wrap my head around (a) because i seem to have been able to come up with a counterexample, a very simple one at that. My reasoning is the following:
Let $S$ be the set containing elements $x_1$ and $x_2$. Let $\sigma :S\rightarrow S$ be such that $\sigma(x_1)=x_1$ and $\sigma(x_2)=x_1$. I've therefore constructed a mapping $\sigma$ which maps $S$ onto $S$ where $S$ is finite but $\sigma$ is not injective (one-to-one or a monomorphism).
Where's the flaw in my reasoning?