Let $S$ and $T$ be finite non-empty sets such that $|S| = |T|$. Show that the function $f : S\to T$ is onto if and only if it is one-to-one. This is a recent homework bonus question assigned in my Proofs and Conjectures class. It (evidently) includes and evaluates our understanding of elementary-set theory and how to determine and prove that the function f is onto and one-to-one. I haven't been able to really grasp firmly how it is we do this. Help would be much appreciate, thank you.
 A: So what exactly does a one-to-one function tell us? The definition states that $f(a) = f(b) \implies a = b$. So we have that $|S| \leq |T|$. Otherwise, we would have $a, b \in S$ such that $f(a) = f(b)$ but $a \neq b$ by the pigeonhole principle.
An onto function tells us that $\forall{y} \in T$, $\exists{x} \in S$ such that $f(x) = y$. That is, every element in $T$ is mapped to. If you're dealing with a finite number of elements, clearly by the pigeonhole principle $|S| \geq |T|$. 
From this we get a nice bijection counting argument. That is, $|S| = |T|$ if and only if there is a bijection from $S \to T$. 
Does this help you see what is going on a bit more? Thinking about your proof in terms of set cardinalities may help you. Best of luck! 
A: You must prove the statement in both the forward and reverse direction, because it is an if and only if. Let's start in the forward direction. Suppose $f : S \rightarrow T$ is onto (a.k.a. surjective). Then for each $t \in T$, there is an $s \in S$ such that $f(s) = t$. We now must show that this function is also injective to show that it is on-to-one, i.e. that $f(s) = f(s') \Longrightarrow s = s'$. Let's do it by contradiction. Suppose there are two elements $s, s' \in S$ such that $f(s) = f(s')$ but $s \neq s'$. Then, because $|S| = |T|$, by the pidgeonhole principle there is at least one element in $T$ that does not have a preimage, i.e. for some $t \in T$ there is no $s \in S$ such that $f(s) = t$, which contradicts the hypothesis that $f$ is onto. Hence the assumption that $f$ is not injective must be false, and we conclude that it is both injective and surjective, and therefore it is one-to-one.
I only proved the forward direction, but that should hopefully give you a place to start with the reverse direction as well.
