I stumbled across a problem where I have to prove that a given function is one-to-one and onto. This is part (b) of problem 22 in chapter 7 of Velleman's How to Prove It, 2nd edition. It asks the reader to show that the set of all total orders on a finite set A with n elements, call this set $L$, is equinumerous with the set of all one-to-one, onto functions from $I_n$ to A ($I_n = \{ i \in \mathbb{Z}^{+} | i \le n$ }), call this set $F$. I tried to follow the hint that comes at the end of the book but hit bedrock when trying to prove that the function $g:A \rightarrow I_n$ defined as $g(a) = |\{ x \in A|xRa \}|$ is onto. Here goes the hint provided:
Define $h:F \rightarrow L$ by the formula $h(f) = \{(a, b) ∈ A × A | f^{−1}(a) \le f^{−1}(b)\}$. To see that h is one-to-one, suppose that $f \in F$, $g \in F$, and $f \neq g$. Let $i$ be the smallest element of $I_n$ for which $f(i) \neq g(i)$. Now show that $(f(i), g(i)) \in h(f)$ but $(f(i), g(i)) \notin h(g)$, so $h(f) \neq h(g)$. To see that h is onto, suppose $R$ is a total order on A. Define $g: A \rightarrow I_n$ by the formula $g(a) = |\{ x \in A|xRa \}|$. Show that $\forall a \in A \forall b \in A(aRb \iff g(a) \le g(b))$, and use this fact to show that $g^{−1} \in F$ and $h(g^{−1}) = R$.
My line of thought: I have to prove that $g^{−1} \in F$, or alternatively $g$ is a one-to-one function from $A$ onto $I_n$. Using the hint, I managed to show that $g$ is one-to-one. As for $g$ being onto, I think I could use the following facts:
1 ) From the (already proven) fact that $g$ is one-to-one, we have that $\forall a \in A \forall b \in A(a \neq b \Rightarrow g(a) \neq g(b))$.
2 ) Clearly, $1 \le g(a) \le n$, or $g(a) \in I_n$.
With these facts I think it can be shown that $\forall i \in I_n \exists a \in A (g(a) = i)$.
Curiously, this argument uses the fact that $g$ is one-to-one to prove that the $g$ is onto, and I think this is very odd! Anyway, this seems to me too cumbersome. There must be an easier way to prove that $g$ is onto...
Any advice is very much appreciated!