MAT230
Discrete Mathematics
Fall 2019
MAT230 (Discrete Math) Combinatorics Fall 2019 1 / 29 Outline
1 Basic Counting Techniques—The Rule of Products
4 Permutations and Combinations with Repetition
5 Summary of Combinatorics
6 The Binomial Theorem and Principle of Inclusion-Exclusion
MAT230 (Discrete Math) Combinatorics Fall 2019 2 / 29 There are 256 + 128 = 384 people, so there are 384 different ways to choose a president.
There are 256 ways to choose a president. For each of those ways there are 128 ways to choose a vice president. Thus there are 256 × 128 = 32, 768 ways to choose both.
Basic Counting Techniques
1 How many ways are there to pick a president from a class of 256 women and 128 men?
2 How many ways are there to pick a president from 256 women and a vice president from 128 men?
MAT230 (Discrete Math) Combinatorics Fall 2019 3 / 29 There are 256 ways to choose a president. For each of those ways there are 128 ways to choose a vice president. Thus there are 256 × 128 = 32, 768 ways to choose both.
Basic Counting Techniques
1 How many ways are there to pick a president from a class of 256 women and 128 men? There are 256 + 128 = 384 people, so there are 384 different ways to choose a president.
2 How many ways are there to pick a president from 256 women and a vice president from 128 men?
MAT230 (Discrete Math) Combinatorics Fall 2019 3 / 29 Basic Counting Techniques
1 How many ways are there to pick a president from a class of 256 women and 128 men? There are 256 + 128 = 384 people, so there are 384 different ways to choose a president.
2 How many ways are there to pick a president from 256 women and a vice president from 128 men? There are 256 ways to choose a president. For each of those ways there are 128 ways to choose a vice president. Thus there are 256 × 128 = 32, 768 ways to choose both.
MAT230 (Discrete Math) Combinatorics Fall 2019 3 / 29 Basic Counting Techniques
These problems are examples of counting problems. Our first two counting rules are: 1 The Rule of Sums: If a first task can be done n ways and a second task can be done m ways, and if these tasks cannot be done at the same time, then there are n + m ways to do either task.
2 The Rule of Products: If a first task can be done n ways and a second task can be done m ways, and if the tasks must be done sequentially, then there are n · m ways to do the two tasks.
MAT230 (Discrete Math) Combinatorics Fall 2019 4 / 29 Basic Counting Techniques
The first question we encountered required the Sum Rule because we needed to choose a president and we could do that from the group of women (task 1) or from the group of men (task 2). The two tasks could not both be done; we could only do one or the other.
The second question required the Rule of Products because we had to pick a president from the group of women (task 1) and then pick a vice president from the group of men (task 2). The order of the tasks is not important, just that each one is independent of the other.
MAT230 (Discrete Math) Combinatorics Fall 2019 5 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: bit string:
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: bit string:
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 bit string:
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 bit string:0
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 bit string: 0
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 bit string: 01
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 bit string: 0 1
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 bit string: 0 11
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 2 bit string: 0 1 1
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 2 bit string: 0 1 10
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 2 2 bit string: 0 1 1 0
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 2 2 bit string: 0 1 1 01
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 Basic Counting Techniques
Example How many different bit strings having 5 bits are there?
A bit string with 5 bits has five “slots” that can hold bits. To “create” a bit string we need to first choose the first bit, then the second bit, and so on. Thus the product rule will apply here. number of choices: 2 2 2 2 2 bit string: 0 1 1 0 1
If we find the product of all the “number of choices” values we see that there are 32 different bit strings of length 5.
MAT230 (Discrete Math) Combinatorics Fall 2019 6 / 29 In this case we are considering a “digit string” of length 2. This is an example that again calls for the product rule. If we allow zero as the first digit then there are 10 ways to choose the first digit. For each of these there are 10 ways to choose the second digit. So there are 10 × 10 = 100 different two digit base 10 numbers.
If, however, we don’t want to allow zero as leading digit, then there are only 9 ways to choose the first number, but still 10 ways to choose the second number. Thus there are 9 × 10 = 90 different two digit base 10 numbers.
Basic Counting Techniques
Example How many two digit base 10 numbers are there?
MAT230 (Discrete Math) Combinatorics Fall 2019 7 / 29 If, however, we don’t want to allow zero as leading digit, then there are only 9 ways to choose the first number, but still 10 ways to choose the second number. Thus there are 9 × 10 = 90 different two digit base 10 numbers.
Basic Counting Techniques
Example How many two digit base 10 numbers are there?
In this case we are considering a “digit string” of length 2. This is an example that again calls for the product rule. If we allow zero as the first digit then there are 10 ways to choose the first digit. For each of these there are 10 ways to choose the second digit. So there are 10 × 10 = 100 different two digit base 10 numbers.
MAT230 (Discrete Math) Combinatorics Fall 2019 7 / 29 Basic Counting Techniques
Example How many two digit base 10 numbers are there?
In this case we are considering a “digit string” of length 2. This is an example that again calls for the product rule. If we allow zero as the first digit then there are 10 ways to choose the first digit. For each of these there are 10 ways to choose the second digit. So there are 10 × 10 = 100 different two digit base 10 numbers.
If, however, we don’t want to allow zero as leading digit, then there are only 9 ways to choose the first number, but still 10 ways to choose the second number. Thus there are 9 × 10 = 90 different two digit base 10 numbers.
MAT230 (Discrete Math) Combinatorics Fall 2019 7 / 29 There are 26 = 64 bit strings of length 8 beginning with 101 or 010.
This is again a product rule type problem. The best way to think of this is to think of there being 6 choices: Choose one of two prefixes to start the string and then choose each of the 5 remaining bits.
number of choices: 2 2 2 2 2 2 bit string: ········
Basic Counting Techniques
Example How many bit strings of length 8 start with 101 or 010?
MAT230 (Discrete Math) Combinatorics Fall 2019 8 / 29 There are 26 = 64 bit strings of length 8 beginning with 101 or 010.
Basic Counting Techniques
Example How many bit strings of length 8 start with 101 or 010?
This is again a product rule type problem. The best way to think of this is to think of there being 6 choices: Choose one of two prefixes to start the string and then choose each of the 5 remaining bits.
number of choices: 2 2 2 2 2 2 bit string: ········
MAT230 (Discrete Math) Combinatorics Fall 2019 8 / 29 There are 26 = 64 bit strings of length 8 beginning with 101 or 010.
Basic Counting Techniques
Example How many bit strings of length 8 start with 101 or 010?
This is again a product rule type problem. The best way to think of this is to think of there being 6 choices: Choose one of two prefixes to start the string and then choose each of the 5 remaining bits.
number of choices: 2 2 2 2 2 2 bit string: 101 0 1 1 0 1
MAT230 (Discrete Math) Combinatorics Fall 2019 8 / 29 Basic Counting Techniques
Example How many bit strings of length 8 start with 101 or 010?
This is again a product rule type problem. The best way to think of this is to think of there being 6 choices: Choose one of two prefixes to start the string and then choose each of the 5 remaining bits.
number of choices: 2 2 2 2 2 2 bit string: 101 0 1 1 0 1
There are 26 = 64 bit strings of length 8 beginning with 101 or 010.
MAT230 (Discrete Math) Combinatorics Fall 2019 8 / 29 As in the other examples, we have 3 ways to choose the first letter, 26 ways to choose the second. Next we need to pick a digit; there are 10 ways to do this. Finally we have to pick three more letters and have 26 choices for each. Thus we have
3 × 26 × 10 × 26 × 26 × 26 = 13, 709, 280
There are 13,709,280 possible novice class callsigns. (The real allowable number is somewhat less than this as certain three-letter combinations are disallowed).
Basic Counting Techniques
Example U.S. Novice class amateur radio (ham) radio callsigns have two letters, a single digit, and then three more letters. The first letter must be K, N, or W. How many different novice callsigns are there?
MAT230 (Discrete Math) Combinatorics Fall 2019 9 / 29 Basic Counting Techniques
Example U.S. Novice class amateur radio (ham) radio callsigns have two letters, a single digit, and then three more letters. The first letter must be K, N, or W. How many different novice callsigns are there?
As in the other examples, we have 3 ways to choose the first letter, 26 ways to choose the second. Next we need to pick a digit; there are 10 ways to do this. Finally we have to pick three more letters and have 26 choices for each. Thus we have
3 × 26 × 10 × 26 × 26 × 26 = 13, 709, 280
There are 13,709,280 possible novice class callsigns. (The real allowable number is somewhat less than this as certain three-letter combinations are disallowed).
MAT230 (Discrete Math) Combinatorics Fall 2019 9 / 29 There are 4 ways to choose a person to stand at the far left. There are 3 ways to choose the next person, then 2 ways to choose the next, and only 1 way to choose the last person to stand on the right. Thus there are
4 × 3 × 2 × 1 = 4! = 24
ways to arrange four people for a photograph.
Basic Counting Techniques
Example How many ways can four people be arranged in a line for a photograph?
MAT230 (Discrete Math) Combinatorics Fall 2019 10 / 29 Basic Counting Techniques
Example How many ways can four people be arranged in a line for a photograph?
There are 4 ways to choose a person to stand at the far left. There are 3 ways to choose the next person, then 2 ways to choose the next, and only 1 way to choose the last person to stand on the right. Thus there are
4 × 3 × 2 × 1 = 4! = 24
ways to arrange four people for a photograph.
MAT230 (Discrete Math) Combinatorics Fall 2019 10 / 29 As before, there are 4! = 24 ways to arrange the four people. However, the arrangement ABCD is equivalent to the arrangements BCDA, CDAB, and DABC. There are four such “equivalent” arrangements. Thus there are really only 4! = 3! = 6 4 different ways to arrange the four people at the card table.
Basic Counting Techniques
Example How many ways can four people be arranged at a card table?
MAT230 (Discrete Math) Combinatorics Fall 2019 11 / 29 Basic Counting Techniques
Example How many ways can four people be arranged at a card table?
As before, there are 4! = 24 ways to arrange the four people. However, the arrangement ABCD is equivalent to the arrangements BCDA, CDAB, and DABC. There are four such “equivalent” arrangements. Thus there are really only 4! = 3! = 6 4 different ways to arrange the four people at the card table.
MAT230 (Discrete Math) Combinatorics Fall 2019 11 / 29 There are 17 choices for president, but then only 16 choices for vice-president, and finally only 15 choices for secretary. (This assumes that no person can hold two or more offices at the same time). This means that there are 17 × 16 × 15 = 4, 080 different outcomes in the election.
Permutations
How many ways are there to choose a president, vice-president, and secretary from a group of 17 people?
MAT230 (Discrete Math) Combinatorics Fall 2019 12 / 29 Permutations
How many ways are there to choose a president, vice-president, and secretary from a group of 17 people?
There are 17 choices for president, but then only 16 choices for vice-president, and finally only 15 choices for secretary. (This assumes that no person can hold two or more offices at the same time). This means that there are 17 × 16 × 15 = 4, 080 different outcomes in the election.
MAT230 (Discrete Math) Combinatorics Fall 2019 12 / 29 Permutations
Notice that The order of selection matters. The two election outcomes President: Alice President: Bob Vice-President: Bob Vice-President: Mark Secretary: Mark Secretary: Alice represent two different election outcomes even thought the same three people are elected. Repetition is not allowed. We made use of the Rule of Products.
MAT230 (Discrete Math) Combinatorics Fall 2019 13 / 29 Permutations
Definition If n is a positive integer then n factorial is the product of the first n positive integers and is denoted n!. Additionally, we define 0! to be 1.
Definition An ordered arrangement of k elements selected from a set of n elements, 0 < k ≤ n, where no two elements of the arrangement are the same, is called a permutation of n objects taken k at a time. The total number of such permutations is denoted by P(n, k).
P(n, k) = n(n − 1)(n − 2) ··· (n − k + 1) n! = (n − k)!
MAT230 (Discrete Math) Combinatorics Fall 2019 14 / 29 Answer: Since order matters, and repetition is not allowed, this is a permutation problem. The number of possible outcomes is P(20, 3) = 20 · 19 · 18 = 6, 840.
Question: A group of twenty people have bought tickets for a raffle for free Large Beef from Nick’s Famous Roast Beef. How many possible outcomes are there if three people will each win the prize? Answer: Now order does not matter: Amy, Jessica, and Mike are the same three winners if we list them as Mike, Jessica, and Amy. To count this, we need to compute the number of permutations and then divide by the number of ways the winners can be arranged: Thus, the number of possible outcomes is P(20, 3) 20 · 19 · 18 = = 1, 140. 3! 6
Combinations Question: A group of twenty people are competing in a race. How many possible outcomes are there if prizes are awarded for the first three places?
MAT230 (Discrete Math) Combinatorics Fall 2019 15 / 29 Question: A group of twenty people have bought tickets for a raffle for free Large Beef from Nick’s Famous Roast Beef. How many possible outcomes are there if three people will each win the prize? Answer: Now order does not matter: Amy, Jessica, and Mike are the same three winners if we list them as Mike, Jessica, and Amy. To count this, we need to compute the number of permutations and then divide by the number of ways the winners can be arranged: Thus, the number of possible outcomes is P(20, 3) 20 · 19 · 18 = = 1, 140. 3! 6
Combinations Question: A group of twenty people are competing in a race. How many possible outcomes are there if prizes are awarded for the first three places? Answer: Since order matters, and repetition is not allowed, this is a permutation problem. The number of possible outcomes is P(20, 3) = 20 · 19 · 18 = 6, 840.
MAT230 (Discrete Math) Combinatorics Fall 2019 15 / 29 Answer: Now order does not matter: Amy, Jessica, and Mike are the same three winners if we list them as Mike, Jessica, and Amy. To count this, we need to compute the number of permutations and then divide by the number of ways the winners can be arranged: Thus, the number of possible outcomes is P(20, 3) 20 · 19 · 18 = = 1, 140. 3! 6
Combinations Question: A group of twenty people are competing in a race. How many possible outcomes are there if prizes are awarded for the first three places? Answer: Since order matters, and repetition is not allowed, this is a permutation problem. The number of possible outcomes is P(20, 3) = 20 · 19 · 18 = 6, 840.
Question: A group of twenty people have bought tickets for a raffle for free Large Beef from Nick’s Famous Roast Beef. How many possible outcomes are there if three people will each win the prize?
MAT230 (Discrete Math) Combinatorics Fall 2019 15 / 29 Combinations Question: A group of twenty people are competing in a race. How many possible outcomes are there if prizes are awarded for the first three places? Answer: Since order matters, and repetition is not allowed, this is a permutation problem. The number of possible outcomes is P(20, 3) = 20 · 19 · 18 = 6, 840.
Question: A group of twenty people have bought tickets for a raffle for free Large Beef from Nick’s Famous Roast Beef. How many possible outcomes are there if three people will each win the prize? Answer: Now order does not matter: Amy, Jessica, and Mike are the same three winners if we list them as Mike, Jessica, and Amy. To count this, we need to compute the number of permutations and then divide by the number of ways the winners can be arranged: Thus, the number of possible outcomes is P(20, 3) 20 · 19 · 18 = = 1, 140. 3! 6
MAT230 (Discrete Math) Combinatorics Fall 2019 15 / 29 Combinations The number of combinations of n objects “taken” k at a time is computed as P(n, k) n! C(n, k) = = . k! k!(n − k)!
There are several different notations used for counting combinations and permutations: n Permutations: P(n, k), P(n, k), nPk , Pk n Combinations: C(n, k), C(n, k), C , C n, n k k k