9.5 Counting Subsets of a Set: Combinations 1 r-Combination An r-combination from a set of n-elements is an r-subset of an n-set. Any of the symbols C(n, r ), n Cr , C n, r , is used to count the number of r-subsets from an n-set 2 r-Combinations Consider the set A={a, b, c, d}. Calculate the number of r-combinations below by showing the subsets counted in each case æ 4ö æ 4ö ç ÷ = ç ÷ = è0ø è1 ø æ 4ö æ 4ö ç ÷ = ç ÷ = è2ø è3 ø æ 4ö ç ÷= è 4ø 3 Counting r-Combinations Take A={a, b, c, d} Consider the 3-combination {a, b, c}. Notice that {a, b, c}={a ,c, b}={b, c, a} etc. How many 3-permutation are there with the elements from the r-combination {a, b, c}? 3!C(4, 3) = P(4, 3) 4! (4 - 3)! 4! C(4, 3) = 3!(4 - 3)! 3!C(4, 3) = 4 Formula for C(n , r) The number of r-combinations of an n-set is given by r!C(n, r) = P(n, r) n! (n - r)! n! C(n, r) = 0 £ r £ n r!(n - r)! r!C(n, r) = 5 Examples 1. How many distinct five-person teams can be chosen to work on a special project from a group of 12 people? Solution: The number of distinct five-person teams is the same as the number of subsets of size 5 (or 5-combinations) that can be chosen from the set of twelve. This number is . Thus there are 792 distinct five-person teams. 6 Examples 2. Suppose the group of twelve consists of five men and seven women. a. How many five-person teams can be chosen that consist of three men and two women? b. How many five-person teams contain at least one man? (two ways) c. How many five-person teams contain at most one man? 7 Solution a. To answer this question, think of forming a team as a two-step process: Step 1: Choose the men. Step 2: Choose the women. There are ways to choose the three men out of the five and ways to choose the two women out of the seven. Hence, by the product rule, 8 b. How many five-person teams contain at least one man? (two ways) This question can be answered either by the addition rule or by the difference rule. (Difference Rule) Observe that the set of fiveperson teams containing at least one man equals the set difference between the set of all five-person teams and the set of fiveperson teams that do not contain any men. 9 10 (addition rule) observe that the set of teams containing at least one man can be partitioned as shown Teams with At Least One Man 11 The number of teams in each subset of the partition is calculated using the method illustrated in part (a). There are 12 Hence, by the addition rule, 13 c. The set of teams containing at most one man can be partitioned into the set that does not contain any men and the set that contains exactly one man. Hence, by the addition rule, 14 Number of Bit String with Fixed Number of 1’s How many 10-bit strings are there with exactly 3 ones? Label the entries of the bit string from 1-10. ___ ____ ____ _____ ………….._____ _____ 1 2 3 4 9 10 To place 3 ones simply choose three of the entries to place them. For instance {1,7,10} indicates that 1’s will be placed on those entries; {5, 2, 9} indicates that 1’s will be placed on entries 5, 2, 9. The other entries are zeroes. There are a total of æ 10 ö ç ÷ è 3 ø 10-bit strings with 3 ones 15 Permutations of a Set With Repeated Elements Consider different ordering of the letters in the word MISSISSIPPI How many distinguishable orderings are there? IIMSSPISSIP, ISSSPMIIPIS, PIMISSSSIIP, and so on Approach 1: Strings with all entries different. Account for repetitions (labels) Approach 2: Strings and select entries to put each of the different letters in the word 16 APPROACH 1 Consider all the entries different and then take care of repetitions MI1S1S2 I 2 S3S4 I3P1P2 I 4 There are a total of 11 characters, so 11! different words that can be made For each word any reordering of the I’s, S’s, P’s will produce the same word (disregarding the sub-index). There are 4!4! 2! repeated words. Total of different words with the letters in MISSISSIPPI is 11! 1!2!4!4! 17 APPROACH 2 Consider a 11-word where the entries are the letters in MISSISSIPPI ___ ____ ____ _____ ………….._____ _____ _____ 1 2 3 4 9 10 11 Choose the number of ways to place 1 M Then choose the number of ways to place 4 I’s Then choose the number of ways to place 4 S’s Then choose the number of ways to place 2 P’s æ ç è æ ç è æ ç è æ ç è 11 ö ÷ 1 ø 10 ö ÷ 4 ø 6 ö ÷ 4 ø 2 ö ÷ 2 ø 18 By the multiplication principle the total number of different words with the letters in MISSISSIPPI is æ 11 öæ 10 öæ 6 öæ 2 ö 11! 10! 6! 2! ç ÷ç ÷ç ÷ç ÷= è 1 øè 4 øè 4 øè 2 ø 1!10! 4!6! 2!2! 2!0! 11! 10! 6! 2! = 1!10! 4!6! 4!2! 2!0! 11! = 1!4!4!2!0! 11! = 1!4!4!2! These is the number of permutations of 11 objects with repetitions 19 Formula 11! P(11;1, 4, 4, 2) = 1!4!4!2! Permutation with repetitions of n characters of k different types 1 2 k n + n +… + n = n n! P(n;n1, n2 ,… , nk ) = n1 !n2 !… nk ! 20 Exercise 1. How many passwords of length 8 can be made with the letters A, B, C, D, E, F? 2. How many of those passwords have three B’s, two E’s, and three F’s? 3. How many of those passwords are permutations of the letters A, B, C, D, E, F? 21