20.3: Multiplication Rule
( \newcommand{\kernel}{\mathrm{null}\,}\)
What is |A×B| for A={0,1,2,3} and B={−1,0,1}?
Solution
We can solve this by just writing out the elements of A×B and counting them.
A×B={(0,−1),(0,0),(0,1),(1,−1),(1,0),(1,1),(2,−1),(2,0),(2,1),(3,−1),(3,0),(3,1)}
So |A×B|=12.
What is |C×D| for C={a,b,c,…,z} and D={0,1,2,⋯,99}?
Solution
Writing out all the elements of C×D and then counting them all seems like a lot of work. Instead, using our experience from Worked Example 20.3.1, notice that we usually perform the task of writing the elements of a Cartesian product in a pattern to make sure we get them all. One-by-one we pick a single element of the first set C, and pair it up with every element of the second set D. From this pattern we see that for each c∈C, there are |D| elements of C×D with c as the first coordinate, and there are |C| such groupings of elements from C×D. So we arrive at
|C×D|=|C|⋅|D|=26⋅100=2600.
For sets X and Y, define an equivalence relation on X×Y whose equivalence classes partition X×Y in the manner described in the provided solution to Worked Example 20.3.2. Then describe how the number of classes and the number of objects in each class correspond to |X| and |Y|.
If there are m ways to perform task S and n ways to perform task T, then there are mn ways to perform task S followed by task T.
Warning 20.3.1
The Multiplication Rule only applies to consecutive tasks S,T such that the number of ways of performing task T is independent of the choice made in performing task S.
To create a specific example of an element from A×B, we must first choose an element of A to be the first coordinate (task S), then choose an element of B to be the second coordinate (task T). There are m=|A| ways to perform task S and n=|B| ways to perform task T. Therefore, the Multiplication Rule says there are mn ways to construct an element of A×B, which means |A×B|=mn.
Suppose you are a casting director and need to select both a primary actor and an understudy for the lead role in a play. If n actors audition for the role, then there are n different ways to select the primary actor. Once this choice is made, there remain n−1 different ways to the select the understudy. Hence there are n(n−1) ways to cast the role.
Now, the actual pool of candidates for understudy will differ based on which actor is offered the lead role. However, no matter who is chosen for the lead, the number of remaining candidates for understudy is the same.
We may extend the Multiplication Rule to any (finite) number of consecutive tasks.
If A1,A2,…,Am are finite sets with |Aj|=mj, then
|A1×A2×⋯×Aℓ|=m1m2⋯mℓ.
Recall that, given alphabet Σ and number n∈N, Σ∗n is the set of words of length n. If |Σ|=m, what is |Σ∗n|?
Solution
To construct a specific example word w∈Σ∗n, there are:
- m ways to choose the first letter,
- m ways to choose the second letter,
- …,
- m ways to choose the nth letter.
So there are
m⋅m⋅m⋅⋯⋅m⏟n factors=mn
ways to construct w. We conclude |Σ∗n|=mn.
Suppose |Σ|=5. How many words in |Σ∗5| have no repeated letters? (That is, in which no two letters are the same?)
Solution
To construct a specific example word w∈Σ∗5 in which no two letters are the same, there are
- 5 ways to choose the first letter,
- 4 remaining ways to choose the second letter,
- 3 remaining ways to choose the third letter,
- 2 remaining ways to choose the fourth letter, and
- only 1 remaining way to choose the last letter.
So there are
5⋅4⋅3⋅2⋅1=120
ways to construct w.
Similar to Example 20.3.4, while the actual pool of candidates for the next letter at each step will differ based on which letters have been chosen already, the number of remaining letters is always independent of which letters have actually been chosen so far. So the Multiplication Rule can be applied to this problem exactly as we have applied it.
Let Σ={a,b,c,…,y,z}. How many palindromes w with 3≤|w|≤6 are there in Σ∗?
Solution
Break into cases based on the length of w.
Case |w|=3.
Once we choose the first letter, the last is chosen for us, but we are still free to choose the middle letter. So there are 262 palindromes of length 3.
Case |w|=4.
Once we choose the first two letters, the last two are chosen for us. So there are also 262 palindromes of length 4.
Case |w|=5.
Once we choose the first two letters, the last two are chosen for us, but we are still free to choose the middle letter. So there are 263 palindromes of length 5.
Case |w|=6.
Once we choose the first three letters, the last three are chosen for us. So there are also 263 palindromes of length 6.
Total.
Applying the Addition Rule to these non-overlapping cases, we obtain
262+262+263+263=262(1+1+26+26)=54⋅262=36,504
as the number of palindromes length 3 to 6.
Set A={a,b,c} and B={0,1,2,3,4}. How many functions A→B exist? How many of these are injections? How many are surjections?
Solution
Number of functions.
A function f:A→B can be constructed in three steps: choose f(a), then choose f(b), then choose f(c). Each of the steps can be carried out in |B|=5 ways. So the number of functions is 53=125.
Number of injections.
An injection f:A↪B can be constructed in three steps: choose f(a), then choose f(b) to be different from f(a), then choose f(c) to be different from both f(a) and f(b). First step has |B|=5 choices. Second step has |B∖{f(a)}|=4 choices. Third step has |B∖{f(a),f(b)}|=3 choices. So the number of injections is 5⋅4⋅3=60.
- A look ahead.
-
Notice that the number of injections has turned out to be
|B|!(|B|−|A|)!.
We will understand better how this formula arises in Section 21.4.
Number of surjections.
Suppose f:A→B. Since |A|=3, the largest that |f(A)| can be is 3, which occurs when f is injective. However, even in such a largest case it is still smaller then |B|, so no surjections exist. That is, the number of surjections is 0.