12.4: Counting elements of finite sets with bijections
In a future chapter, we will begin learning how to count complicated collections by counting the “choices” needed to determine an arbitrary element in the collection. In this section, we look at how to count collections by finding a collection of the same size which is easier to count.
Consider paths in the \(5 \times 10\) grid below that start at the bottom left and end at the top right, and only move up or right at each step. (One such path is drawn in.) How many such paths are there?
Let \(P\) represent the set of all such paths. We can distinguish each element of \(P\) by the sequence of directions it takes at each step. Let \(\Sigma = \{R,U\}\text{,}\) where \(R\) and \(U\) stand for the directions “right” and “up”, respectively. Then for each path \(p \in P\) we can build a word \(w_p \in \Sigma ^{\ast}\) by setting the letters of \(w_p\) to correspond to the steps in the path. For example, the path in the diagram above would correspond to the word \(RRURUURRRRURR\text{.}\)
This assignment of words in \(\Sigma ^{\ast}\) to paths in \(P\) is a function! Let's call it \(f: P \rightarrow \Sigma ^{\ast}\text{,}\) and set \(W = f(P)\text{,}\) the image of \(f\) in \(\Sigma ^{\ast}\text{.}\) This function is clearly one-to-one, as different paths must produce different words of direction indicators. And since every function maps its domain surjectively onto its image, we obtain a bijection \(f: P \rightarrow W\) by restricting the codomain . Therefore, we can count the paths in \(P\) by instead counting the words in \(W\text{!}\)
Since each path in \(P\) takes exactly \(13\) steps, exactly \(4\) of which must be upwards and exactly \(9\) of which must be to the right, we see that \(W\) consists precisely of those words in \(\Sigma ^{\ast}\) that have length \(13\) and contain exactly \(4\) \(U\)s and \(9\) \(R\)s. Once we learn some basic counting techniques later in the course, you will be able to come back to this example to verify that
\begin{equation*} \vert P \vert = \vert W \vert = 715 \text{.} \end{equation*}