Prove that if $n \in \Bbb N$, $f: I_n \to B$, and $f$ is onto, then $B$ is finite and $|B|\leq n$. 
Prove that if $n \in \Bbb N$, $f: I_n \to B$, and $f$ is onto, then $B$ is finite and $|B|\leq n$.

Notes on notation:
For each natural number $n$, $I_n = \{i \in \mathbb{Z} \mid i \leq n\}$.
$A \sim B$ indicates that $A$ is equinumerous to $B$.
$f: I_n \rightarrow B$ means there is a function from $I_n$ to $B$.
 A: For each $b\in B$ let $g(b)=\min\{i\in I_n:f(i)=b\}$; since $f$ maps $I_n$ onto $B$, $g$ is well-defined. Now show that $g$ is one-to-one and conclude that $|B|\le|I_n|=n$.
A: This question must have been taken from Section 7.1 of Velleman's How to Prove It.
Lemma 1 (exercise 7): $(\text{$A$ is finite} \land A \sim B) \rightarrow (\text{$B$ is finite}\land |A| = |B|$.
Lemma 2 (exercise 8b): $(\text{$A$ is finite}\land B \subseteq A) \rightarrow (\text{$B$ is finite}\land |B| \leq |A|)$.
Theorem (exercise 10): $\forall n \in \mathbb{N} [(f:I_n \rightarrow B \text{ is surjective}) \rightarrow (\text{$B$ is finite } \land |B| \leq n)]$
Proof:
Define $g: B \rightarrow I_n$ by $g(b)=min\{i \in I_n \mid f(i)=b\}$. Too see $g$ is a valid function: since $f$ is onto, $\forall b \in B \exists n \in I_n (f(n)=b)$, so for any $b \in B$, the set $\{i \in I_n \mid f(i)=b\}$ is nonempty, then by well-ordering principle, $min$= the smallest element of the set exists. So, $\forall b \in B \exists ! n\in I_n (g(b)=n) \equiv g: B \rightarrow I_n$.
Also, since $g: B \rightarrow I_n$, $g[B] \subseteq I_n$ (note: $g[B]$ denotes $Ran(g)$). Since $I_n$ is finite, by Lemma 2, $g[B]$ is finite and $g[B]| \leq |I_n|=n$.
Besides, $B \sim g[B]$ is clearly true. In addition, since $g[B]$ is finite, by Lemma 2, $B$ is finite and $|B| = |g[B]| \leq n $ (because $g[B]| \leq |I_n|=n$, in last paragraph). $\square$
