Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University.

Similar presentations


Presentation on theme: "Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University."— Presentation transcript:

1 Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 9.2 Possibility Trees and the Multiplication Rule

2 Possibilities for Tournament Play Teams A and B are to play each other repeatedly until one wins two games in a row or a total of three games. 2 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

3 Possibilities for Tournament Play Teams A and B are to play each other repeatedly until one wins two games in a row or a total of three games. a.How many ways can the tournament be played? 10 b.Assuming that all the ways of playing the tournament are equally likely, what is the probability that five games are needed to determine the tournament winner? 4/10 3 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

4 The Multiplication Rule If an operation consists of k steps and the first step can be performed in ways, the second step can be performed in ways, (regardless of how the first step was performed) the k th step can be performed in ways, (regardless of how the preceding steps was performed) Example What is the number of the possible outcomes of rolling 3 dices in a row? 6 x 6 x 6. 4 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

5 Number of Personal Identification Numbers (PINs) A typical PIN (personal identification number) is a sequence of any four symbols chosen from the 26 letters in the alphabet and the ten digits, with repetition allowed. a.How many different PINs are possible? : 36 x 36 x 36 x 36 = 1,679,616 PINs. b.If all PINs are equally likely, what is the probability that a PIN chosen at random contains no repeated symbol? : 36 x 35 x 34 x 33 / 36 x 36 x 36 x 36 = 0.8417 5 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

6 Counting the Number of Iterations of a Nested Loop Consider the following nested loop: How many times will the inner loop be iterated when the algorithm is implemented and run? 12 6 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

7 When the Multiplication Rule Is Difficult or Impossible to Apply Three officers – a president, a treasurer, and a secretary – are to be chosen from among four people: Ann, Bob, Cyd, and Dan. Suppose Ann became a president Ann (P), Bob (T), Cyd (S) / Ann (P), Bob (S), Cyd (T) Ann (P), Cyd (T), Dan (S) / Ann (P), Cyd (S), Dan (T) Ann (P), Bob (T), Dan (S) / Ann (P), Bob (S), Dan (T) # of possible choices for President = 4 # of possible cases: 4 * 6 = 24 Suppose that, for various reasons, Ann cannot be president and either Cyd or Dan must be secretary. How many ways can the officers be chosen? 7 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

8 When the Multiplication Rule Is Difficult or Impossible to Apply – cont’ Three officers – a president, a treasurer, and a secretary – are to be chosen from among four people: Ann, Bob, Cyd, and Dan. Suppose that, for various reasons, Ann cannot be president and either Cyd or Dan must be secretary. How many ways can the officers be chosen? 8 # of possible choices for President = 3 Cyd is the president Cyd (P), Ann (T), Bob (S) / Cyd (P), Ann (S), Bob (T) Cyd (P), Ann (T), Dan (S) / Cyd (P), Ann (S), Dan (T) Cyd (P), Bob (T), Dan (S) / Cyd (P), Bob (S), Dan (T) Dan is the president Dan (P), Ann (T), Bob (S) / Dan (P), Ann (S), Bob (T) Dan (P), Ann (T), Cyd (S) / Dan (P), Ann (S), Cyd (T) Dan (P), Bob (T), Cyd (S) / Dan (P), Bob (S), Cyd (T) Bob is the president Bob (P), Ann (T), Cyd (S) / Bob (P), Ann (S), Cyd (T) Bob (P), Cyd (T), Dan (S) / Bob (P), Cyd (S), Dan (T) Bob (P), Ann (T), Dan (S) / Bob (P), Ann (S), Dan (T) 8 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

9 More Subtle Use of the Multiplication Rule Three officers – a president, a treasurer, and a secretary – are to be chosen from among four people: Ann, Bob, Cyd, and Dan. Suppose that, for various reasons, Ann cannot be president and either Cyd or Dan must be secretary. How many ways can the officers be chosen? Possible Secretary = 2 (Cyd or Dan) Possible President = 2 (Bob or Dan if Cyd is P, Bod or Cyd if Dan is P) Possible Treasuer = 2 (Reminders) Total possible cases: 2 * 2 * 2 = 8. 9 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

10 Permutations A permutation of a set of objects is an ordering of the objects in a row. For example, the set of elements a, b, and c has six permutations. Theorem 9.2.2 For any integer n with, the number of permutations of a set with n elements is n !. 10 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

11 Permutations of the Letters in a Word How many ways can the letters in the word COMPUTER be arranged in a row? 8! How many ways can the letters in the word COMPUTER be arranged if the letter CO must remain next to each other (in order) as a unit? 7! If letters of the word COMPUTER are randomly arranged in a row, what is the probability that the letters CO remain next to each other (in order) as a unit? 7!/8! = 1/8 11 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

12 Permutations of Objects Around a Circle At a meeting of diplomats, the six participants are to be seated around a circular table. Since the table has no ends to confer particular status, it doesn’t matter who sits in which chair. But it does matter how the diplomats are seated relative to each other. In other words, two seatings are considered the same if one is a rotation of the other. How many different ways can the diplomats be seated? 12 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

13 Permutations of Objects Around a Circle – cont’ Solution Fix one diplomat and consider all possible arrangement for the rest of diplomats. Then, we have 5! cases. If confused, consider a smaller instance. 13 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

14 Permutations of Selected Elements Given the set { a, b, c }, there are six ways to select two letters from the set and write them in order. Each such ordering of two elements of { a, b, c } is called a 2-permutation of { a, b, c }. An r -permutation of a set of n elements is an ordered selection of r elements taken from the set of n elements. The number of r-permutations of a set of n elements is denoted 14 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

15 Theorem 9.2.3 If n and r are integers and, then the number of r -permutations of a set of n elements is given by the formula Example – Evaluating r -Permutations Evaluate P (5, 2) = 20 How many 4-permutations are there of a set of seven objects? P (7, 4) = 840 How many 5-permutations are there of a set of five objects? P (5, 5) = 120 15 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

16 Permutations of Selected Letters of a Word How many different ways can three of the letters of the word BYTES be chosen and written in a row? How many different ways can this be done if the first letter must be B ? 16 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

17 Proving a Property of P ( n, r ) Prove that for all integers 17 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University


Download ppt "Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University."

Similar presentations


Ads by Google