Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department Outline • • • • • Rules of Sum and Product Permutations Combinations: The Binomial Theorem Combinations with Repetition: Distribution Probability 2 Example: Lotto • Pick 6 numbered balls out of 49 (numbered consecutively 1,2,3,…,49) without replacing them. How many ways can this be done (the order is important here) • First ball: 49 choices, Second : 48, Third: 47, Fourth: 46, Fifth: 45, Sixth: 44 • Total: 49 48 47 46 45 44 = 10,068,347,520 • So there are over 10 billion ways to pick the six balls 3 Example: Lotto • But the order is not important when playing Lotto 123456 654321 1 3 2 4 5 6 etc. are the same and should not be counted separate • So we can NOT use the permutation formula • We use the COMBINATION formula 4 Combinations • Permutation is an ordered selection, combination is an unordered selection • An r-combination of a set of n elements is an unordered selection of r elements from the set, repetition is not allowed: C(n, r) = n! / [ r!(n - r)! ] • Or: Number of subsets of size r that can be chosen from a set of n elements • Notes: (a) C(n, r) = P(n, r) / r! (c) C(n, 0) = 1 (b) C(n, n) = 1 (d) C(n, r) = C(n, n ‐ r) Binomial Coefficient • The number of r-combination of a set with n distinct elements is denoted by C(n, r) • Note that C(n, r) is also denoted by is called the binomial coefficient n r and • “n choose r” 6 Example (1) • How many ways can 2 out of 3 paintings of an artist be selected for shipment to an exhibition? • Let the paintings correspond to {A,B,C} First choice A B C Second B or C A or C A or B Ordered (A,B) ; (A,C) (B,A) ; (B,C) (C,A) ; (C,B) • There are 6 permutations, but only 3 combinations: {A,B},{A,C},{B,C} 7 Example (2) • Find the number of ways in which 3 components can be selected from a batch of 20 different components C(20, 3) = 20! / [ 3!(20 – 3)! ] = 20! / (3!17!) = 1140 8 Example (3) • In how many ways can a group of 4 boys be selected from 10 if (a) the eldest boy is included in each group? (b) the eldest boy is excluded? (c) What proportion of all possible groups contains the eldest boy? 9 Example (3) (a) Choose 3 from 9, since the eldest boy is fixed: C(9, 3) = 9! / [ 3! (9 - 3)! ] = 84 (b) If the eldest boy is excluded, it is actually choose 4 boys from 9: C(9, 4) = 9! / [ 4! (9 - 4)! ] = 126 (c) The number of all possible groups is C(10, 4) = 10! / [ 4! (10 - 4)! ] = 210 So the proportion of all possible groups containing the eldest boy is: 84 / 210 = 40% 10 The Binomial Theorem • In algebra, the sum of two terms, such as x + y is called binomial • The binomial theorem gives an expression for the powers of a binomial (x + y)n, for each positive integer n and all real numbers x and y • The expansion of (x + y)3 can be found using combinatorial reasoning instead of multiplying the three terms out 11 Multiplying the terms: (x + (x + y)3 3 y) = (x + y)(x + y)(x + y) = (xx + xy + yx + yy)(x + y) = xxx + xyx + yxx + yyx + xxy + xyy + yxy + yyy = x3 + 3x2y + 3xy2 + y3 12 Combinatorial reasoning: (x + y)3 • When (x + y)3 = (x + y)(x + y)(x + y) is expanded, terms of the form x3 , x2y, xy2, and y3 arise. • To obtain a term of the form x3 , an x must be chosen in each of the sums, and this can be done in only one way. Thus, the x3 term in the product has a coefficient of l. • x2y: choose x in two of the three sums (and consequently a y in the other sum). Hence, the number of such terms is the number of 2-combinations of three objects, 3 2 2 • xy : choose x from one of the three sums (and consequently take a y from each of the other two sums). This can be done in 3 1 ways. • y3 : choose the y for each of the three sums in the product, and this can be done in exactly one way. 13 Binomial Theorem • Given any real numbers a and b and any nonnegative integer n, n nk k = a b k 0 k n (a + b)n n n 0 n n 1 1 n n2 2 n 1 n 1 n 0 n a b a b = a b a b a b ... 0 1 2 n 1 n 14 Example (1) • What is the expansion of (x – 4y)4? 4 4 (x +(– 4y)) = 4 x 4k (4 y) k k 4 41 4 4 2 4 4 3 4 1 2 x x (4 y ) x (4 y ) x (4 y )3 (4 y ) 4 1 2 3 x 4 4 x3 (4 y) 6 x 2 (16 y 2 ) 4 x(64 y 3 ) (256 y 4 ) k 0 x 4 16 x3 y 96 x 2 y 2 256 xy3 256 y 4 • What is the coefficient of term x3y? Ans: -16 15 Example (2) • What is the coefficient of a5b7 in (a – 2b)12? The term is 12 5 a (2b) 7 792a 5 (128)b 7 101376a 5b 7 7 Ans: The coefficient is – 101376 16