More Examples 2. At a local deli you can choose from six kinds of soda, 10 kinds of sandwiches and 12 desserts. How many ways are there to order: a. a sandwich b. exactly one item c. a full meal (soda, sandwich and dessert) d. any two items (repetition allowed) e. any two distinct items f. items of two different kinds 3. In Fortran, an identifier is a character string with length 1 to 7. The first character must be a letter. How many different identifiers are there? Two basic variations: 1) order in which the objects are chosen or placed is significant 2) order in which the objects are chosen or placed is not significant Permutations and Combinations Number of orders in which the white balls can be chosen A permutation of a set of n distinct objects is an ordered arrangement of the n objects. If only r of the n objects are used we have an r-permutation. Notation: P(n, r) P(n, r) = P(n, n) = P(n, 0) = Example 1: Consider the set {a, b, c, d, e, f} # of ways to form 4-character string # of ways to form 4-character string if no letter is repeated Example 2: How many four-digit numbers contain only odd digits contain only even digits do not contain 0 have all digits distinct contain at least one 3 contain exactly one 3 with all digits distinct Example—the Pick Three Game Rules: Ways to win: Combinations An r-combination is Notation: C(n, r) or Choose five white balls and two red balls Combinatorial Identities C(n, r) = C(n, n-r) n Σ C(n, i) = 2n i=0 Examples Example 1: Menu with 6 sodas, 10 sandwiches, 12 desserts. How many ways are there to order 3 sodas, 5 sandwiches and 2 desserts, all different? Example 2: A committee is chosen from a group of 4 men and 6 women. a) In how many ways can a committee of size three be chosen? b) In how many ways can a committee of size three be chosen if there must be 1 man and 2 women? Example 3: A student must answer 10 of 13 questions on an exam. How many ways can he or she take the exam if a. there are no restrictions b. the first two questions must be answered c. the first or second question, but not both must be answered d. exactly three of the first five questions must be answered e. at least three of the first five questions must be answered More examples Example 4: How many five card poker hands contain a. 2 spades and 3 red cards b. 2 cards each of two ranks c. all red cards with two cards each of two ranks d. exactly one queen and exactly three spades e. contain at least one ace? Why won’t the following approach work? Example 5: How many ternary strings of length 10 are there with a. exactly two 0’s, three 1’s and five 2’s b. exactly two 0’s, three 1’s and five 2’s with each 1 immediately preceded by a 2. Example 6: You invite nine friends to join you at dinner. How many ways can the ten of you be seated around a circular table? Inclusion/Exclusion Examples 1. Let S = {a, b, c, d, e, f}. How many strings of length 5 begin or end with a? 2. Find the number of positive integers 100 that are even or divisible by 7. 3. Find the number of four digit numbers that have exactly one 3. Case 1: Case 2: 4. How many powerball tickets have white numbers 13 or 43 but not both?