Notes 1/13: A multi-set is an unordered collection of objects with repeats allowed, like {1,1,1,3,4,4,5}. The number ((n | k)), pronounced 'n multi-choose k', counts the multi-sets of k elements of n possible kinds. Examples:
- ((3 | 2)) counts the multi-sets of 2 elements from the three kinds {1,2,3}; they are:
{1,1} {1,2} {1,3} {2,2} {2,3} {3,3}.
Since there are 6 such multi-sets, ((3 | 2)) = 6.
- ((2 | 3)) counts the multi-sets of 3 elements from the two kinds {1,2}; they are:
{1,1,1} {1,1,2} {1,2,2} {2,2,2}.
Thus ((2 | 3)) = 4.
- A typical real-world example of a multi-set is a handful of 7 jellybeans taken from a big jar with 5 flavors (Red, Yellow, Green, Blue, White): this is equivalent to a multi-set of 7 elements from 5 kinds.
For example, a handful with 3 of R, none of Y, 1 of G, 2 of B, 1 of W, corresponds to the multi-set {R,R,R,G,B,B,W}.
The number of different handfuls is thus ((5 | 7)), which we compute below.
- We can also describe a multi-set by the list of multiplicities for each possible kind. For example, the above multi-set of jelly beans could be described by the multiplicity-list (3,0,1,2,1), and the size is 3+0+1+2+1 = 7.
The Stretching Transformation changes multi-sets into into ordinary sets, which will allow us to compute ((n | k)).
This is a reversible transformation (one-to-one correspondence) defined as follows. We assume the elements of the multi-set M are listed in order: a1 ≤ a2 ≤ … ≤ ak; and we define the elements of the set S by adding 0 to the first entry of M, 1 to the second entry, etc.
M = {a1,...,ak} →
S = {b1,...,bk} = {a1+0, a2+1, a3+2,..., ak+k−1} .
Since 1 ≤ a1 ≤ a2 ≤ … ≤ ak ≤ n, we have: 1 ≤ b1 < b2 < … < bk ≤ n+k−1. The set S is thus a k-element subset of {1, 2,..., n+k−1}
We show the Stretching Transformation is a one-to-one correspondence by defining its inverse, the Shrinking Transformation, which changes sets back into multi-sets:
S = {b1,...,bk} → M = {a1,...,ak}
= {b1−0, b2−1, b3−2,..., bk−k+1} .
These two transformations clearly undo each other, in either order (Stretching, then Shrinking; or Shrinking, then Stretching).
Conclusion: the multi-sets counted by ((n | k)) are in one-to-one correspondence with the sets counted by (n + k − 1 | k), meaning that these numbers are equal:
((n | k)) = (n + k − 1 | k) ,
where we know how to compute the right-hand side. For example, ((5 | 7)) = (5+7−1 | 7) = (11 | 7) = (11 | 4) = 114 / 4! = 330.
Notes 1/18: The Position Transformation is a reversible way of changing the data of lists into sets, which often makes counting easier.
Typical example: How many ways to toss a coin 5 times with 3 heads, such as HTTHH? This naturally corresponds to lists like (H,T,T,H,H) with 3 H's and 2 T's, which cannot be easily counted with any of our usual principles or basic problems. Instead, we transform the data by recording the positions of the H's: (H,T,T,H,H) has an H in the first, fourth, and fifth positions, so it corresponds to the set {1,4,5}. Since there were 3 H's in the list, there are 3 elements in the set, which lies inside {1,2,3,4,5}. The transformation has the table:
| list
| HHHTT
| HHTHT
| HHTTH
| HTHHT
| HTHTH
| HTTHH
| THHHT
| THHTH
| THTHH
| TTHHH
|
| set
| {1,2,3}
| {1,2,4}
| {1,2,5}
| {1,3,4}
| {1,3,5}
| {1,4,5}
| {2,3,4}
| {2,3,5}
| {2,4,5}
| {3,4,5}
|
The point of this transformation is that it outputs all 3-element subsets of {1,2,...,5}, each just once, and we know how to count these: Basic Problem 3 tells us there are (5 | 3) = 10. Of course, in this case we can just write out all the lists and count them, but the argument works in general: the number of ways to get k heads out of n tosses is (n | k).
We could also record the positions of the 2 T's instead of the 3 H's, but this gives us the same answer, since (5 | 2) = (5 | 3), and in general (n | k) = (n | n−k).
We have seen the Position Transform in the following problems:
- Walks on a city grid with 10 North steps and 5 East steps. We transform a walk (a list of N's and E's) by recording the positions of the 5 E's out of the 15 positions. Ans: (15 | 5) = 3003. Note: Recording the 10 N's gives the same number, since (15 | 10) = (15 | 5).
- Rows of 5 red and 3 black balls. We record the postions of the 3 black balls out of the 8 total positions. Ans: (8 | 3).
- What is the number of all subsets of an n-element set, S ⊂ {1,2,...,n}? For example, {1,2,3} has the 8 subsets S = {}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}.
We use the Reverse Position Transformation, which changes the given sets S into lists L = (a1,...,an) with n positions and two kinds of list elements, say + and −. The elements of S give the positions of the +'s. For n = 3, the Reverse Position Transformation has the table:
| set S
| {}
| {1}
| {2}
| {3}
| {1,2}
| {1,3}
| {2,3}
| {1,2,3}
|
| list L
| (−,−,−)
| (+,−,−)
| (−,+,−)
| (−,−,+)
| (+,+,−)
| (+,−,+)
| (−,+,+)
| (+,+,+)
|
The output is all lists of three +/− entries, and the Product Principle says there are 23 = 8 of these. Of course, in this case, we can just write all the sets and count them, but the argument works in general: The number of all subsets of {1,2,...,n} is 2n.