122. Elementary facts about finite sets and functions

This chapter contains miscellaneous results, mostly easy, concerning finite sets and functions between them. The facts about finite sets $A$ and $B$ in the following theorem are not difficult to see using examples. We give part of the proof and leave the rest to you.

122.1 Theorem

Let $A$ and $B$ be finite sets. Then:

a) $|A| =|B|$ if and only if there is a bijection $\beta\colon A \to B$ .

b) $|A| \leq |B|$ if and only if there is an injective function $F\colon A \to B$ .

c) If $B$ is nonempty, $|A| \geq |B|$ if and only if there is a surjective function $G\colon A \to B$ .

Proof By Definition 113.1, if $A$ and $B$ both have $n$ elements then there are bijections $\beta\colon\mathbf{n} \to A$ and $\beta'\colon\mathbf{n} \to B$. Then, using Theorem 101.5, page 149, Theorem 101.3, page 148 and Exercise 98.2.7 of Chapter 98, $\beta'\circ\beta^{-1}\colon A \to B$ is a bijection. To finish the proof of (a), we must show that if there is a bijection $\beta\colon A \to B$ then $A$ and $B$ have the same number of elements. This is left as an exercise.

We also leave (b) as an exercise, and prove half of (c). Suppose $A$ has $m$ elements and $B$ has $n$ elements with $m \geq n >0$. Then there are bijections $\beta\colon\mathbf{m} \to A$ and $\beta'\colon\mathbf{n} \to B$. Let us define a function $F\colon \mathbf{m} \to \mathbf{n}$ by: $F (k ) =k$ if $k < n$, and $F (k ) =n$ if $k \geq n$. $F$ is surjective, because if $1\leq i \leq n$, then $F (i ) =i$. Then $\beta'\circ F\circ\beta^{-1}\colon A \to B$ is the composite of a bijection, a surjection and a bijection, so is a surjection by Exercise 98.2.7 of Chapter 98.

122.1.1 Exercise Complete the proof of Theorem 122.1.

122.1.2 Exercise Use the principles of counting for finite sets that we have introduced to prove that if $\Pi$ is a partition of a finite set $A$, then $|\Pi | \leq |A|$.

Here is another useful theorem:

122.2 Theorem

If $A$ and $B$ are finite sets and $|A| =|B|$, then a function $F\colon A \to B$ is injective if and only if it is surjective.

Proof Let $F\colon A \to B$ be injective. Then $\operatorname{Im} F$, being a subset of $B$, has no more than $|B|$ elements by Theorem 115.1. Since $F$ is injective, $\operatorname{Im} F$ has at least $|A|$ elements by Theorem 122.1(a). Since $|A| =|B|$, it follows that $\operatorname{Im} F$ has exactly $|B|$ elements, so $\operatorname{Im} F =B$. Hence $F$ is surjective.

Conversely, if $F$ is not injective, then the quotient $A/F$ has fewer elements than $A$. The fundamental bijection theorem (Theorem 121.1) says that then $\operatorname{Im} F$ has fewer elements than $A$, so it has fewer elements than $B$ since $|A| =|B|$. That means $\operatorname{Im} F \neq B$, so $F$ is not surjective.

122.2.1 Warning Observe that if $|A| =|B|$, then Theorem 122.1(a) says there is an injection from $A$ to $B$ and Theorem 122.1(b) says that there is a surjection from $A$ to $B$. But Theorems 122.1(a) and (b) do not say that the injection and the surjection have to be the same function, so it would be a fallacy to deduce Theorem 122.2 from those two facts.

122.2.2 Warning Theorem 122.2 allows you to determine whether a function from a finite set to itself is a bijection by testing either injectivity or surjectivity — you don’t have to test both. However, you have to test both for infinite sets. For example, the shift function $n \mapsto n+ 1\colon \mathrm{N} \to \mathrm{N}$ is injective but not surjective (0 is not a value) and $0\mapsto 0,n\mapsto n-1$ for $n >0$ defines a function $\mathrm{N} \to \mathrm{N}$ which is surjective but not injective, since 0 and 1 both have value 0.

Here is a counting principle for function sets:

122.3 Theorem

If $|A| =n$ and $|B| =m$, then there are $m^{n}$ functions from $A$ to $B$ . In other words, $\left|B^{A}\right| =|B|^{|A|}$.

Proof To construct an element of $B^{A}$, that is, a function from $A$ to $B$, you have to say what $F (a)$ is for each element of $A$. For each $a$ you have $m$ choices for $F (a)$ since $F (a)$ has to be an element of $B$ and $B$ has $m$ elements. There are $n$ elements $a$ of $A$ for each of which you have to make these choices, so by the Principle of Multiplication of Choices there are $m^{n}$ possibilities altogether.

122.3.1 Exercise How many ways are there of assigning a letter of the alphabet to each decimal digit, allowing the same letter to be assigned to different digits? (Answer on page 250.)

122.3.2 Exercise

a) Show by quoting principles enunciated here that if $A$ and $B$ are finite, $A \subseteq B$ and $A \neq B$, then there is no bijection from $A$ to $B$.

b) Show that the statement in (a) can be false if $A$ and $B$ are infinite.

122.3.3 Exercise Let $F (n)$ be the number of functions from $\mathcal{P}S$ to $S$, where $S$ is a set with $n$ elements, and let $G (n)$ be the number of functions from $S$ to its powerset. For which integers $n$ is $F (n ) =G (n)$?

Pages 187–188 of the book (PDF).