Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide01.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide02.html Counting Basic prev | slides | next prev | slides | next Question 1: How many ways are there to pick a president from a class of 256 women and 128 men? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Counting Basic 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:00 PM 1 of 1 10/02/2003 04:00 PM Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide03.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide04.html Counting Basic Counting Basic prev | slides | next prev | slides | next Question 1: How many ways are there to pick a president from a Question 1: How many ways are there to pick a president from a class of 256 women and 128 men? class of 256 women and 128 men? Question 2: How many ways are there to pick a president from 256 Question 2: How many ways are there to pick a president from 256 women and a vice president from 128 men? women and a vice president from 128 men? Answer 1: There are 256+128 = 384 people, so there are 384 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 different ways to choose a president. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM
Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide05.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide06.html Counting Basic Counting Basic prev | slides | next prev | slides | next Question 1: How many ways are there to pick a president from a These problems are examples of counting problems. There are two class of 256 women and 128 men? rules that we will use in this section: Question 2: How many ways are there to pick a president from 256 1. The Sum Rule: If a first task can be done n ways and a second women and a vice president from 128 men? 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. Answer 1: There are 256+128 = 384 people, so there are 384 The first question we examined fits this form, because we different ways to choose a president. 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 Answer 2: There are 256 ways to choose a president. For each of those ways there are 128 ways to choose a vice president. Thus two tasks could not both be done. there are 256×128 = 32,768 ways to choose both. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide07.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide08.html Counting Basic Counting Basic prev | slides | next prev | slides | next Examples These problems are examples of counting problems. There are two rules that we will use in this section: How many different bit strings having 5 bits are there? 2. The Product Rule: 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 sequentially, then there are n × m ways to do the two tasks. The second question fits this form 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). Note that the order of the tasks is not important, just that one is independent of the other. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM
Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide09.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide10.html Counting Basic Counting Basic prev | slides | next prev | slides | next Examples Examples How many different bit strings having 5 bits are there? How many two digit base 10 numbers are there? Answer: A bit string with 5 bits has five "slots" that can hold bits. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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. bit string: 0 1 1 0 1 number of choices: 2 2 2 2 2 If we find the product of all the "number of choices" values we see that there are 32 different bit strings of length 5. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide11.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide12.html Counting Basic Counting Basic prev | slides | next prev | slides | next Examples Examples How many two digit base 10 numbers are there? How many bit strings of length 8 start with 101 or 010? Answer: As before, we are really considing a "digit string" of 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM
Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide13.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide14.html Counting Basic Counting Basic prev | slides | next prev | slides | next Examples Examples How many bit strings of length 8 start with 101 or 010? U.S. Novice class amateur radio (ham) radio callsigns have two letters, a single digit, and then three more letters. The first letter Answer: This is again a product rule type problem. The best way to must be K, N, or W. How many different novice callsigns are think of this is to think of there being only 5 choices: Chose one of there? two prefixes to start the string, and then choose each of the 5 remaining bits. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 bit string: 101 0 1 1 0 1 number of choices: 2 2 2 2 2 2 There are 2 6 = 64 bit strings of length 8 beginning with 101 or 010. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide15.html Counting Basic http://localhost/~senning/courses/ma229/slides/counting/slide16.html Counting Basic Counting Basic prev | slides | next prev | slides | next Examples The Pigeonhole Principle U.S. Novice class amateur radio (ham) radio callsigns have two Theorem: If k +1 or more objects are placed into k boxes, then at letters, a single digit, and then three more letters. The first letter least one box contains more than one object. must be K, N, or W. How many different novice callsigns are there? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Answer: 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 callsigns. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 of 1 10/02/2003 04:01 PM 1 of 1 10/02/2003 04:01 PM
Recommend
More recommend