Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department.

Similar presentations


Presentation on theme: "Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department."— Presentation transcript:

1 Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department

2 Outline Rules of Sum and Product Permutations Combinations: The Binomial Theorem Combinations with Repetition: Distribution Probability 2

3 Counting and Probability Coin tossing Different PINs number Rolling pair of dice – possible outcomes 3

4 Possibility Trees Teams A and B are to play each other repeatedly until one wins two games in a row or a total three games –What is the probability that five games will be needed to determine the winner? Suppose there are 4 I/O units and 3 CPUs. In how many ways can I/Os and CPUs be attached to each other when there are no restrictions? 4

5 Multiplication Rule (Rule of Product) Multiplication rule: If an operation consists of k steps each of which can be performed in n i ways (i = 1, 2, …, k), then the entire operation can be performed in  n i ways Assume: If an operation consists of k steps and –The step 1 can be performed in n 1 ways –The step 2 can be performed in n 2 ways –The step k can be performed in n k ways Then the entire operation can be performed in n 1 n 2 …n k ways 5

6 Multiplication Rule (Rule of Product) 6

7 Example (1) Suppose a computer installation has 4 I/O unit (A,B,C,D) and 3 CPU (X,Y,Z) Any I/O can be paired with any CPU How many ways to pair an I/O with a CPU Pairing the two types of units as a two-step operation: –Step 1: Choose the I/O unit –Step 2: Choose the CPU unit There are 12 ways (e.g AX, AY, AZ,…) 7

8 Example (2) The drama club of Central University is holding tryouts for a spring play With six men and eight women auditioning for the leading male and female roles, by the rule of product the director can cast his leading couple in 6 x 8 = 48 ways 8

9 Example (3) Consider the manufacture of license plates consisting of 2 letters followed by 4 digits. (e.g. AM1234) If no letter or digit can be repeated, there are 26 x 25 x 10 x 9 x 8 x 7 = 3,276,000 different possible plates With repetitions of letters and digits, 26 x 26 x 10 x 10 x 10 x 10 = 6,760,000 different plates are possible If repetitions are allowed, as in part (b), how many of the plates have only vowels (A,E,I,O,U) and even digits? (0 is an even integer) 9

10 Example (4) Three officers – a president, a treasurer and a secretary are to be chosen from four people: Alice, Bob, Cindy and Dan. Alice cannot be a president, either Cindy or Dan must be a secretary. How many ways can the officers be chosen? Construct the possibility tree! 10

11 Addition Rule (Rule of Sum) Addition rule: If a finite set A is a union of k mutually disjoint sets A 1, A 2, …, A k, then n(A) =  n(A i ) Assume: –Task 1 can be performed in m ways –T ask 2 can be performed in n ways –And the two tasks cannot be performed simultaneously Then performing either task can be accomplished in any one of m + n ways 11

12 Addition Rule (Rule of Sum) More formally, the rule of sum is a fact about set theory It states that sum of the sizes of a finite collection of pairwise disjoint sets is the size of the union of these sets That is, if A 1, A 2,..., A n are pairwise disjoint sets, then we have: |A 1 |+|A 2 | + … +|A n | = |A 1  A 2  …  A n | n(A) = n(A 1 ) + n(A 2 ) + n(A 3 ) + … + n(A k ) 12

13 Example (1) A college library has 40 textbooks on Databases and 50 textbooks dealing with Calculus By the rule of sum, a student can select among 40 + 50 = 90 textbooks to learn more about one or the other of these two languages 13

14 Example (2) A computer science instructor has 7 different introductory books each on C++, Java, and Perl He can recommend any one of these 21 books to a student who is interested in learning a first programming language 14

15 Example (3) A lady has decided to shop at one store today, either in the north part of PJ or the south part of PJ If she visits the north part of PJ, she will either shop at a mall, a furniture store, or a jewelry store (3 ways) If she visits the south part of PJ then she will either shop at a clothing store or a shoe store (2 ways) Thus there are 3+2=5 possible shops the woman could end up shopping at today 15

16 Summary: Multiplication and Addition Rules Multiplication Rule: Assuming a)We need to perform procedure 1 AND procedure 2 b)There are n 1 ways to perform procedure 1 and c)n 2 ways to perform procedure 2 There are n 1 n 2 ways to perform procedure 1 AND procedure 2 Addition Rule: Assuming a)We need to perform procedure 1 OR procedure 2 b)There are n 1 ways to perform procedure 1 and c)n 2 ways to perform procedure 2 There are n 1 + n 2 ways to perform procedure 1 OR procedure 2 This “OR” is an “exclusive OR.” One choice or the other, but not both 16

17 Exercises 17 1.You are taking a test that has five True/False questions. If you answer each question with True or False and leave none of them blank, in how many ways can you answer the whole test? 2.A company places a 6-symbol code on each unit of product. The code consists of 4 digits, the first of which is the number 5, followed by 2 letters, the first of which is NOT a vowel. How many different codes are possible? (Repetition is allowed) 3.There is one position available for a faculty job at UPM. The applicant must come from either FK which has 20 candidates or FSKTM which has 50 candidates. What is the total number of possible candidates for the position?  Send in the answers!

18 Permutations Continuing to examine applications of the rule of product, we turn now to counting linear arrangements of objects These arrangements are often called permutation when the objects are distinct Note: order is taken into account 18

19 Permutations A permutation of a set of distinct objects is an ordered arrangement these objects The number of linear permutations of a set of N objects = N! - N possible for 1 st position  (N-1) for 2 nd  …  (1) for last The number of circular permutations of N objects = (N -1)! –Fix one person, –Then (N-1) possible for next position  (N-2) for 2 nd  …  (1) for last 19

20 Example (1) How many ways can the letter in the word COMPUTER be arranged in a row? All the letters in the word COMPUTER are distinct, so 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 1 st 2 nd 3 rd 4 th 5 th 6 th 7 th 8 th = 8! = 40,320 arrangements. 20

21 Example (2) 6 people sit in a row with exactly 6 seats. How many ways can they be seated together in the row? 6 x 5 x 4 x 3 x 2 x 1 1 st 2 nd 3 rd 4 th 5 th 6 th = 6! = 720 arrangements. 21

22 Permutations If there are n elements in a set, and you want to line-up (arrange) only r of them: r- permutation The number of r-permutations of a set with n elements is denoted by P(n, r) P(n, r) = n(n – 1)(n – 2) … (n – r +1) = n! / (n – r)! *Show that P(n, 2) + P(n, 1) = n 2 22

23 Permutations P(n, r) counts (linear) arrangements in which the objects cannot be repeated However, if repetitions are allowed, then by the rule of product there are n r possible arrangements with r ≥ 0 23

24 Permutations Permutations of n objects in which n 1 are of one kind, n 2 are of a second kind,... n k are of a k ‐ th kind, where n 1 + n 2 +... + n k = n, is Eg: In how many ways can the six letters of the word “mammal” be arranged in a row? Since there are 3 “m”s, 2 “a”s and 1 “l” in the word “mammal”, we have: 24

25 Example (1) In a class of 10 students, five are to be chosen and seated in a row for a picture. How many such linear arrangements are possible? 10 x 9 x 8 x 7 x 6 1 st 2 nd 3 rd 4 th 5 th = 10!/5! = 30,240 arrangements. 25

26 Example (2) The number of permutations of the letters in the word COMPUTER is 8! If only four of the letters are used, the number of permutations (of size 4) or 4- permutations is P(8, 4) = 8! = 8! (8 - 4)! 4! = 1680 26

27 Example (3) Unlike example before, the number of (linear) arrangements of the four letters in BALL is 12, not 4! or 24. If the two L’s are distinguished as L1, L2, then we can use our previous ideas; with the four distinct symbols B, A, L1, L2, we have 4! = 24 permutations, including A B L1 L2 and A B L2 L1 and others 27

28 Example (4) The MASSASAUGA is a brown and white venomous snake. Arranging all of the letters in MASSASAUGA, we find that there are arrangements. Arrangements in which all four A’s are together are 7! = 840 3! 1! 1! 1! 1! To get this last result, we considered all arrangements of the seven symbols AAAA (one symbol), S, S, S, M, U, G. 28


Download ppt "Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department."

Similar presentations


Ads by Google