AoPS: Introduction to Counting & Probability Chapter 2 Basic Counting Techniques CASEWORK - Problem 2.1 On the island of Mumble, the Mumblian alphabet has only 5 letters, and every word in the Mumblian language has no more than 3 letters in it. How many words are possible? (A word can use a letter more than once, but zero letters does not count as a word.) Solution 2.1 Case 1: 1-letter words; there are 5 1-letter words Case 2: 2-letter words; we have 5 choices for 1st letter & 5 choices for 2nd letter = 5x5 = 25 Case 3: 3-letter words: 5 choices for the 1st, 2nd, and 3rd letters so 5 x 5 x 5 = 125 3-letter words Therefore, 5 + 25 + 125 = 155 words possible. Problem 2.2 How many pairs of positive integers (m, n) satisfy m2 + n < 22? Solution 2.2 Since 0 < m2 < 22, m must be one of 1,2,3, or 4. Case 1: When m = 1, then n < 22 – 1 = 21, so there are 20 possible choices for n when m = 1. Case 2: When m = 2, then n < 22 – 4 = 18, so there are 17 possible choices for n when m = 2. Solution 2.2 Since 0 < m2 < 22, m must be one of 1,2,3, or 4. Case 3: When m = 3, then n < 22 – 9 = 13, so there are 12 possible choices for n when m = 3. Case 4: When m = 4, then n < 22 – 16 = 6, so there are 5 possible choices for n when m = 4. There are 20 + 17 + 12 + 5 = 54 possible pairs. Problem 2.3 How many squares of any size can be formed by connecting dots in the grid shown? . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 1: 1 x 1 horizontal sqs – there are 16 1 x 1 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 2: 2 x 2 horizontal sqs – there are 9 2 x 2 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 3: 3 x 3 horizontal sqs – there are 4 3 x 3 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 4: 4 x 4 horizontal sqs – there is 1 4 x 4 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 There are 16 + 9 + 4 + 1 = 30 horizontal squares. Does that cover all cases? . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 There are 16 + 9 + 4 + 1 = 30 horizontal squares. Does that cover all cases? NO, Diagonal sqs . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 5: √2 x √2 diagonal sqs – there are 9 √2 x √2 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 6: √5 x √5 horizontal sqs – there are 8 √5 x √5 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 And √5 x √5 diagonal sqs – these √5 x √5 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 7: √8 x √8 diagonal sqs – there is 1 √8 x √8 square . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 8: √10 x √10 diagonal sqs – there are 2 √10 x √10 squares . . . . . . . . . . . . . . . . . . . . . . . . . Solution 2.3 Case 8: √10 x √10 horizontal sqs – there are 2 √10 x √10 squares . . . . . . . . . . . . . . . . . . . . . . . . . Think about this: There are 30 horizontal squares + (9+8+1+2) diagonal squares = 50 squares in the grid. But how do you know that we have ALL of the squares? We’re pretty sure we have all the squares with integers side lengths. But what about the squares with sides that are irrational? Think about this: We can prove from the Pythagorean Theorem that we have all the diagonal squares, because they must have side lengths that equal √ m2 + n2 , where m and n are positive integers less than 4. m n Side Length 1 1 √2 1 2 √5 1 3 √10 2 2 √8 Exercises 2.1 How many 3-letter words can we make from the letters A, B, C, and D, if we are allowed to repeat letters, and we must use the letter A at least once? Exercises: Case 1: 3 letter word that contains one A. The letter A can be in 1st, 2nd, or 3rd position. Each of the other positions can be B, C, or D. There are 3 x 3 x 3 = 27 words for this case. Exercises: Case 2: 3 letter word that contains two A’s. The letter that is not A can be in 1st, 2nd, or 3rd position. It can be one of B, C, or D. There are 3 x 3 = 9 words for this case. Exercises: Case 3: 3 letter word that contains three A’s. There is only 1 such word, namely AAA. The total # of words is 27 + 9 +1 = 37 Exercise 2.2 I have two hats. In one hat are balls numbered 1-15. In the other hat are balls numbered 16-25. I first choose a hat, then from the hat, I choose 3 balls, without replacing the balls between selections. How many different ordered selections of 3 balls are possible? Exercise 2.2 Case 1: The first hat is picked. There are 15 balls in the 1st hat. The 1st ball can be any of the 15 balls. The 2nd ball can be any of the 14 remaining balls. The 3rd ball can be any of the remaining 13 balls, so the number of ordered selections of three balls is 15 x 14 x 13 = 2730. Exercise 2.2 Case 2: The second hat is picked. There are 10 balls in the 1st hat. The 1st ball can be any of the 10 balls. The 2nd ball can be any of the 19 remaining balls. The 3rd ball can be any of the remaining 8 balls, so the number of ordered selections of three balls is 10 x 9 x 8 = 720. The total of possible selections is 2730 + 720 = 3450 Exercise 2.3 How many paths are there from A to H in the diagram shown, if we can only travel in the direction of the arrows? E B A D F C G H Go through either B or C to get to D. The # of paths going from A to D through B is 2 x 1 and the # of paths going from A to D through C is 2 x 3. So the total # of paths from A to D is (2 x 1) + (2 x 3) = 8. Go through either B or C to get to D. The # of paths going from A to D through B is 2 x 1 and the # of paths going from A to D through C is 2 x 3. So the total # of paths from A to D is (2 x 1) + (2 x 3) = 8. Similarly to get from D to H, we go through one of E, F, or G. The three cases give a total of (1 x 1) + (2 x 3) + (2 x 1) = 9 paths from D to H. Similarly to get from D to H, we go through one of E, F, or G. The three cases give a total of (1 x 1) + (2 x 3) + (2 x 1) = 9 paths from D to H. The path choice from A to D is independent of the path choice from D to H . So we multiply the # of paths from A to D by the # of paths from D to H to get the # of paths from A to H. 8 x 9 = 72 Problem 2.4 How many triangles appear in the diagram? Problem 2.4 Case 1: The triangle is one of the smallest triangles. There are 1 + 3 + 5 + 7 = 16 smallest triangles. 1 3 5 7 Problem 2.4 Case 2: The triangle is composed of 4 of the smallest triangles. There are 7 such triangles, 6 pointing up and 1 pointing down. Problem 2.4 Case 3: The triangle is composed of 9 of the smallest triangles. There are 3 such triangles, all pointing up. Problem 2.4 Case 4: The triangle is the biggest triangle. There’s 1. The total # of triangles is 16 + 7 + 3 + 1 = 27. Complementary Counting Complementary Counting refers to the general technique of counting what we don’t want to count. This is often easier than counting what we actually want to count. Problem 2.6 How many 3-digit numbers are not multiples of 7? Problem 2.6 It’s easy to count the # of 3-digit numbers which are multiples of 7: the smallest multiple of 7 which is a 3-digit # is 15 x 7 = 105 and the largest multiple of 7 which is a 3-digit # is 142 x 7 = 994. Problem 2.6 It’s easy to count the # of 3-digit numbers which are multiples of 7: the smallest multiple of 7 which is a 3-digit # is 15 x 7 = 105 and the largest multiple of 7 which is a 3-digit # is 142 x 7 = 994. So there are 142 – 15 + 1 = 128 3-digit #s which are multiples of 7. Problem 2.6 So there are 142 – 15 + 1 = 128 three-digit #s which are multiples of 7. There are 900 three-digit #s in total from 100 to 999, so 900 – 128 = 772 three-digit #s which are not multiples of 7. Problem 2.7 The Smith family has 4 sons and 3 daughters. In how many ways can they be seated in a row of 7 chairs such that at least 2 boys are next to each other? Problem 2.7 There is only one way to assign genders to the seating so that no two boys are next to each other, and that is BGBGBGB. Problem 2.7 There is only one way to assign genders to the seating so that no two boys are next to each other, and that is BGBGBGB. If we seat the kids as BGBGBGB, then there are 4! orderings for the 4 boys, and 3! orderings for the 3 girls, giving a total of 4! X 3! = 144 seatings for the 7 kids. Problem 2.7 If we seat the kids as BGBGBGB, then there are 4! orderings for the 4 boys, and 3! orderings for the 3 girls, giving a total of 4! X 3! = 144 seatings for the 7 kids. These are seatings that we don’t want, so to count the seatings that we do want, we need to subtract these seatings from the total # of seatings without any restrictions. Problem 2.7 These are seatings that we don’t want, so to count the seatings that we do want, we need to subtract these seatings from the total # of seatings without any restrictions. Since there are 7 kids, there are 7! ways to seat them. So the answer is 7! – (4! X 3!) = 5040 – 144 = 4896 Exercises 1. How many 4-letter words with at least one vowel can be constructed from the letters A, B, C, D, & E? (Note that A & E are vowels.) 2. How many 5-digit #s have at least one zero? 3. I have 6 shirts, 6 pairs of pants, and 6 hats. Each item comes in the same 6 colors (so that I have one item of each color). I refuse to wear an outfit which all 3 items are the same color. How many choices for outfits do I have? 4. In how many ways can 7 people be seated in a row of chairs if two people, Wilma & Fred, refuse to sit next to each other? 1. First count all the # of all 4-letter words with no restrictions. Then count the # of 4-letter words with no vowels, then subtract to get the answer. 1. First count all the # of all 4-letter words with no restrictions. Then count the # of 4-letter words with no vowels, then subtract to get the answer. Each letter must be A, B, C, D, or E, so the # of 4-letter words w/ no restrictions is 5 x 5 x 5 x 5 = 625. Each letter must be A, B, C, D, or E, so the # of 4-letter words w/ no restrictions is 5 x 5 x 5 x 5 = 625. Each letter of a word w/ no vowels must be B, C, or D, so the # of all 4-letter words w/ no vowels is 3 x 3 x 3 x 3 = 81. Each letter must be A, B, C, D, or E, so the # of 4-letter words w/ no restrictions is 5 x 5 x 5 x 5 = 625. Each letter of a word w/ no vowels must be B, C, or D, so the # of all 4-letter words w/ no vowels is 3 x 3 x 3 x 3 = 81. Therefore, the # of 4-letter words is 625 – 81 = 544. 2. The 1st digit cannot be 0 and the next 4 can be 0-9 inclusive, so there are 9 x 10 x 10 x 10 x 10 = 90,000 5-digit #s. 2. The 1st digit cannot be 0 and the next 4 can be 0-9 inclusive, so there are 9 x 10 x 10 x 10 x 10 = 90,000 5-digit #s. A 5-digit # w/ no zeros can have only the #s 19 inclusive, so there are 9 x 9 x 9 x 9 x 9 = 59, 049 such 5-digit #s. 2. The 1st digit cannot be 0 and the next 4 can be 0-9 inclusive, so there are 9 x 10 x 10 x 10 x 10 = 90,000 5-digit #s. A 5-digit # w/ no zeros can have only the #s 19 inclusive, so there are 9 x 9 x 9 x 9 x 9 = 59, 049 such 5-digit #s. Therefore the # of 5-digit #s w/ at least one zero is 90,000 – 59, 049 = 30, 951. 3. The number of all outfit combinations is 6 x 6 x 6 = 216. There are 6 outfits in which all 3 items are the same color. So, there are 216 – 6 = 210 outfits in which not all 3 items are the same color. 4. The number of all seating arrangements is 7!. 4. The number of all seating arrangements is 7!. The # of seating arrangements in which Fred & Wilma sit next to each other is 6! x 2!. 4. The number of all seating arrangements is 7!. The # of seating arrangements in which Fred & Wilma sit next to each other is 6! x 2!. We get 6! x 2! by considering Wilma & Fred as one person, arranging the “six” people first, then arranging Wilma & Fred. 4. The number of all seating arrangements is 7!. The # of seating arrangements in which Fred & Wilma sit next to each other is 6! x 2!. We get 6! x 2! by considering Wilma & Fred as one person, arranging the “six” people first, then arranging Wilma & Fred. Thus, the # of acceptable arrangements is 7! – 6! x 2! = 3600. Constructive Counting Often it is not clear how to count the items directly, but if we think we would construct the items that we’re trying to count, we can see a way to count them. This general idea is called constructive counting. Problem 2.8 How many 3-digit numbers have exactly one zero? Problem 2.8 We could solve it by using casework, but we can also solve it directly by thinking about the steps necessary to construct such a 3-digit #, and the # of choices that we have at each step. Concept: Deal with the restriction first. Considering the restriction 1st usually helps when solving constructive counting problems. In this problem, the restriction is that the #s must have exactly one zero. When attempting to construct such a 3-digit #, the 1st choice should be: where do we put the zero? When attempting to construct such a 3-digit #, the 1st choice should be: where do we put the zero? There are 2 choices: zero in the middle or zero at the right. (remember: # cannot start w/ 0). When attempting to construct such a 3-digit #, the 1st choice should be: where do we put the zero? There are 2 choices: zero in the middle or zero at the right. (remember: # cannot start w/ 0). Now choose the other 2 digits: each of the other 2 digits can be any # 1-9 (not 0), so there are 9 choices: When attempting to construct such a 3-digit #, the 1st choice should be: where do we put the zero? There are 2 choices: zero in the middle or zero at the right. (remember: # cannot start w/ 0). Now choose the other 2 digits: each of the other 2 digits can be any # 1-9 (not 0), so there are 9 choices: There are 2 x 9 x 9 = 162 such 3-digit #s. Problem 2.9 How many sequences x1, x2, x3, …, x7 can be formed in which all the xi are integers greater than 0 & less than 6, and no two adjacent xi are equal? Problem 2.9 This is NOT a problem to be done by casework or counting because of all sorts of cases like multiple numbers repeated (ex: 1123344) or a single # repeated many times (ex:1114111), and so on. Problem 2.9 There are five choices for x1: 1,2,3,4, or 5. Problem 2.9 There are five choices for x1: 1,2,3,4, or 5. Now, there are 4 choices left for 2nd #, x2 and 4 choices left for 3rd #, x3 (any # except # chosen for x2) and so on down the line. Problem 2.9 There are five choices for x1: 1,2,3,4, or 5. Now, there are 4 choices left for 2nd #, x2 and 4 choices left for 3rd #, x3 (any # except # chosen for x2) and so on down the line. So there are 5 x 4 x 4 x 4 x 4 = 20, 480 sequences. Problem 2.9 The constructive approach means to ask the question – How would we build a sequence that fits the problem?” This approach can solve seemingly complicated problems. Problem 2.10 In how many ways can we pick a group of 3 different numbers from the group 1, 2, 3, …, 500 such that one # is the average of the other two? (The order in which we pick the #s does not matter.) This one can be tricky to set up. If x < y, then 3rd # z must be x+z=y 2 This one can be tricky to set up. If x < y, then 3rd # z must be x+z=y 2 so z = 2y – x. Also we need z ≤ 500 which means 2y – x ≤ 500, or y ≤ x/2 + 250 This one can be tricky to set up. If x < y, then 3rd # z must be x+z=y 2 so z = 2y – x. Also we need z ≤ 500 which means 2y – x ≤ 500, or y ≤ x/2 + 250 So once we choose x, we must choose y such that x < y ≤ x/2 + 250 in order to end up with a valid set of three numbers. Concept: It often helps to look at a few simple cases of a more general problem, to try to find a pattern. Concept: Start by choosing x = 1, then choose y such that 1 < y ≤ 250.5 and that y must be in the list 2, 3, …, 250, so there are 249 choices for y. Concept: Start by choosing x = 1, then choose y such that 1 < y ≤ 250.5 and that y must be in the list 2, 3, …, 250, so there are 249 choices for y. If x = 2, then choose y so that 2 < y ≤ 251 so y must be in the list 3, 4, …, 251, so there are 249 choices for y. Start by choosing x = 1, then choose y such that 1 < y ≤ 250.5 and that y must be in the list 2, 3, …, 250, so there are 249 choices for y. If x = 2, then choose y so that 2 < y ≤ 251 so y must be in the list 3, 4, …, 251, so there are 249 choices for y. If x = 3, then choose y so that 3 < y ≤ 251.5, so y must be in the list 4, 5, …, 251, so there are 248 choices for y. The following pattern develops: Values of x 1 2 3 4 5 ... Choices for y 249 249 248 248 247 . . . Where does the chart end? The following pattern develops: Values of x 1 2 3 4 5 ... Choices for y 249 249 248 248 247 . . . Where does the chart end? If x = 497, then y must be between 497 < y ≤ 498.5, so there is only 1 choice for y, or y = 498. The following pattern develops: Values of x 1 2 3 4 5 ... Choices for y 249 249 248 248 247 . . . Where does the chart end? If x = 497, then y must be between 497 < y ≤ 498.5, so there is only 1 choice for y, or y = 498. If x = 498, then y must be between 498 < y ≤ 499, so there is only 1 choice for y, or y = 499. The following pattern develops: Values of x 1 2 3 4 5 ... Choices for y 249 249 248 248 247 . . . If x = 497, then y must be between 497 < y ≤ 498.5, so there is only 1 choice for y, or y = 498. If x = 498, then y must be between 498 < y ≤ 499, so there is only 1 choice for y, or y = 499. If x = 499, then y must be between 499 < y ≤ 499.5, which is impossible. So our chart looks like: Values of x 1 2 3 . . . 497 498 Choices for y 249 249 248 . . . 1 1 So our chart looks like: Values of x 1 2 3 . . . 497 498 Choices for y 249 249 248 . . . 1 1 So the # of triples for (x, y, z) is 249 + 249 + 248 + 248 + . . . + 1 + 1 = 2(249 + 248 + … + 1) = 2 x 31, 125 = 62, 250 Sidenote: The very end of the solution used the fact that 249 + 248 + … + 1 = 31, 125 which was not calculated by hand, but by the shortcut 249 x 250 2 which will be covered in greater detail in Chp 3. Exercises 1. How many license plates can be formed if every license plate has 2 different letters followed by 2 different numbers? 2. How many 3-digit #s have the property that the 1st digit is at least twice the 2nd digit? 3. How many 4-digit #s have the last digit equal to the sum of the 1st 2 digits? 1. The 1st letter can be any of 26 letters, while the 2nd can be any of the 25 letters remaining. The 1st digit can be any of 10 digits, and the 2nd can be any of the 9 remaining digits. 26 x 25 x 10 x 9 = 58, 500. 2. Use casework on the choice of the 2nd digit: Second digit First digit 0 1, 2, 3, 4, 5, 6, 7, 8, 9 1 2, 3, 4, 5, 6, 7, 8, 9 2 4, 5, 6, 7, 8, 9 3 6, 7, 8, 9 4 8, 9 2. Use casework on the choice of the 2nd digit: Second digit First digit 0 1, 2, 3, 4, 5, 6, 7, 8, 9 1 2, 3, 4, 5, 6, 7, 8, 9 2 4, 5, 6, 7, 8, 9 3 6, 7, 8, 9 4 8, 9 The 3rd digit can be any of the 10 digits, so the answer is (9 + 8 + 6 + 4 + 2) x 10 = 290. 3. Last digit 0 1 2 3 4 5 6 7 8 9 First 2 digits 10 11, 20 12, 21, 30 13, 22, 31, 40 14, 23, 32, 41, 50 15, 24,33,42, 51,60 16,25,34,43,52,62,70 17,26,35,44,53,62,71,80 18,27,36,45,54,63,73,81,90 Last digit 0 1 2 3 4 5 6 7 8 9 First 2 digits 10 11, 20 12, 21, 30 13, 22, 31, 40 14, 23, 32, 41, 50 15, 24,33,42, 51,60 16,25,34,43,52,62,70 17,26,35,44,53,62,71,80 18,27,36,45,54,63,73,81,90 3rd digit can be any of 10 so (1+2+3+4+5+6+7+8+9) x 10 = 450. 4. How many sequences of 6 digits x1, x2, …, x6 can we form, given the condition that no 2 adjacent xi have the same parity? (Parity means “odd” or “even”; so, for example, x2 and x3 cannot both be odd or both be even.) 4. Regardless of whether x1 is even or odd, we have 5 choices for x2: if x1 is odd then x2 is even or vice versa. Similarly there are 5 choices for x3, 5 choices for x4, and so on. Since x1 can be any of 10 digits, the answer is 10 x 55 = 21, 250. 5. In how many ways can we pick three numbers out of the group 1, 2, 3, …, 100 such that the largest number is larger than the product of the two smaller ones? (The order in which the #s are picked is not important.) Let the 3 #s be x < y < z. Proceed by casework based on the choice of x. For each x possible, list the choices for y so that it is still possible to choose z with z > xy. x x=1 x=2 x=3 x=4 x=5 x=6 x=7 x=8 x=9 y 2 < y ≤ 99 3 < y ≤ 49 4 < y ≤ 33 5 < y ≤ 24 6 < y ≤ 19 7 < y ≤ 16 8 < y ≤ 14 9 < y ≤ 12 10 < y ≤ 11 z # of pairs of (y, z) y < z ≤100 98+97+…+1=4851 2y < z ≤100 94+92+…+2=2256 3y < z ≤100 88+85+…+1=1335 4y < z ≤100 80+76+…+4= 840 5y < z ≤100 70+65+…+5= 525 6y < z ≤100 58+52+…+4= 310 7y < z ≤100 44+37+…+2= 161 8y < z ≤100 28+20+12+4= 64 9y < z ≤100 10 + 1 = 11 If 10 ≤ x < y, then xy > 100, so no choice of z is possible. There fore, the total # of ways to pick three #s satisfying the condition of the problem is 4851+2256+1335+840+525+310+161+64+11 = 10, 353 Counting with Restrictions Problem 2.11 In how many ways can I arrange 3 different math books and 5 different history books on my bookshelf, if I require there to be a math book on both ends? Concept: Consider the effects of the restriction first. Restriction: place math books on each end. There are 3 choices for the math book to place on the left end, then 2 choices for the math book on the right end. Restriction: place math books on each end. There are 3 choices for the math book to place on the left end, then 2 choices for the math book on the right end. Simply arrange the other 6 books in the middle, a basic permutation, 6! ways to arrange the remaining 6 books. Restriction: place math books on each end. So there is a total of 3 x 2 x 6! = 4, 320 ways to arrange the books on the shelf. Problem 2.12 The Smith family has 4 sons and 3 daughters. In how many ways can they be seated in a row of 7 such that all 3 girls sit next to each other? Problem 2.12 Consider the restriction 1st. W/O worrying about which specific boys & girls go in which seats, in how many ways can the girls sit together? W/O worrying about which specific boys & girls go in which seats, in how many ways can the girls sit together? There are 5 basic configurations of boys and girls: GGGBBBB, BGGGBBB, BBGGGBB, BBBGGGB, BBBBGGG There are 5 basic configurations of boys and girls: GGGBBBB, BGGGBBB, BBGGGBB, BBBGGGB, BBBBGGG With each configuration, there are 4! ways in which we can assign the 4 sons to seats, & 3! ways in which we can assign the 3 daughters to seat. So, the # of possible seatings is 5 x 4! x 3! = 720. Another way is to think of the girls as a “supergirl” block, G: GBBBB, BGBBB, BBGBB, BBBBG “supergirl” block = 3! ways & the 4 boys and G = 5! for a possible seating of 5! x 3! = 720 Problem 2.13 The Coventry School’s European debate club has 6 German delegates, 5 French delegates, and 3 Italian delegates. In how many ways can these 14 delegates sit in a row of 14 chairs, if each country’s delegates insist on sitting next to each other? Problem 2.13 Think of each group as a block: Germans = G, French = F, & Italians = I. Then there are 3! ways to arrange the 3 blocks in a row: Problem 2.13 Think of each group as a block: Germans = G, French = F, & Italians = I. Then there are 3! ways to arrange the 3 blocks in a row: FGI, FIG, GFI, GIF, IFG, IGF Problem 2.13 Think of each group as a block: Germans = G, French = F, & Italians = I. Then there are 3! ways to arrange the 3 blocks in a row: FGI, FIG, GFI, GIF, IFG, IGF And w/in each block there are Germans = 6! French = 5! Italian = 3! so Think of each group as a block: Germans = G, French = F, & Italians = I. Then there are 3! ways to arrange the 3 blocks in a row: FGI, FIG, GFI, GIF, IFG, IGF And w/in each block there are Germans = 6! French = 5! Italian = 3! so 3! X 6! X 5! X 3! = 3, 110, 400 ways to seat all 14 delegates. Problem 2.14 Our math club has 20 members & 3 officers: President, Vice President, & Treasurer. However, one member, Ali, hates another member, Brenda. How many ways can we fill the offices if Ali refuses to serve as an officer if Brenda is also an officer? Problem 2.14 There are 20 x 19 x 18 ways to choose the 3 officers if we ignore restrictions about A & B. So now count the # of ways both Ali & Brenda serve as officers using constructive reasoning. There are 20 x 19 x 18 ways to choose the 3 officers if we ignore restrictions about A & B. So now count the # of ways both Ali & Brenda serve as officers using constructive reasoning. Pick an office for A, pick an office for B, then put someone in the last office so there are 3 x 2 x 18 ways to pick officers if both serve. There are 20 x 19 x 18 ways to choose the 3 officers if we ignore restrictions about A & B. Pick an office for A, pick an office for B, then put someone in the last office so there are 3 x 2 x 18 ways to pick officers if both serve. But these are the cases to be excluded so there are (20 x 19 x 18) – (3 x 2 x 18) = 6732. Problem 2.15 We have the same club (20 members & 3 officers), but this time, Ali has a huge crush on Brenda, and won’t be an officer unless she is one too. Brenda is unaware of Ali’s affections, and doesn’t care if he is an officer or not; she’s perfectly happy to an officer even if Ali isn’t one. In how many ways wan the club choose its officers? Use complementary counting again Look at the problem w/o restrictions 1st: there are (20 x 19 x 18) ways to choose officers. Use complementary counting again Look at the problem w/o restrictions 1st: there are (20 x 19 x 18) ways to choose officers. Cases to exclude: A is an officer and B is not. Using constructive counting there are 3 choices for office that A will hold. There are 18 choices for remaining offices (exclude A & B), then there are 17 choices for last office leaving: 3 x 18 x 17 total choices. So (20 x 19 x 18) – ( 3 x 18 x 17) = 5922. Exercises 1. A senate committee has 5 Republicans & 4 Democrats. In how many ways can the committee sit in a row of 9 chairs, such that all 4 Democrats sit together. 2. The Happy Valley Kennel has 4 chickens, 2 dogs, and 5 cats. In how many ways can the 11 animals be placed in a row of 11 cages such that all of the animals of each type are in adjacent cages? 1. Considering the group of Democrats as one person, then there are 6! ways to the 6 people (5 Republicans and the one Democrat group). Then there are 4! ways to arrange arranging the 4 Democrats within their group. So the # of arrangements is 6! X 4! = 17, 280. 2. 1st order the 3 groups of animals, which we can do in 3! ways. Next order the animals w/in each group. There are 4! ways to arrange the group of chickens, 2! ways to arrange the group of dogs, & 5! ways to arrange to arrange the group of cats. The answer is 3! X 4! X 2! X 5! = 34, 560. Exercises 3. The Jones family has 5 boys & 3 girls, and 2 of the girls are twins. In how many ways can they be seated in a row of 8 chairs if the twins insist on sitting together, and their other sister refuses to sit next to either of her sisters? Solution 1: If the twins sit at the end of the row, then the other sister can sit at one of 5 places so that she’s not next to the twins. 1st choose one of the 2 ends (2 choices) and seat the 2 twins (2! choices); then seat the other sister (5 choices); then seat the remaining 5 brothers (5! choices). 2! X 2! X 5! X 5! = 2400 ways. Solution 1: If the twins don’t sit at the end of the row, the other sister can sit at one of 4 places so that she’s not next to the twins. Pick the twin’s seat 1st (5 choices) and arrange the 2 twins (2! choices); then seat the other sister (4 choices); then seat the remaining 5 brothers (5! choices). 5 x 2! x 4 x 5! = 4800 ways. Adding the 2 cases together: 2400 + 4800 = 7200. Solution 2: Find the # of ways to seat the twins together, then subtract the cases where the 3rd sister is sitting next to them. Solution 2: Find the # of ways to seat the twins together, then subtract the cases where the 3rd sister is sitting next to them. If we treat the twins as a block, there are 7! ways to arrange the twin block, the other sister, and the 5 boys. However, there are 2 ways to arrange the twin block, so there are 2! X 7! ways to arrange the siblings such that the twins sit together. Solution 2: If the 3 sisters are treated as a block, then there are 6! ways to arrange the block and the 5 boys. There are 4 ways to arrange the sisters w/in the block such that the twins are sitting together (since the non-twin sister can’t sit between them), meaning there are 4 x 6! ways to arrange the siblings such that the twins are together and the 3 girls are together. If the 3 sisters are treated as a block, then there are 6! ways to arrange the block and the 5 boys. There are 4 ways to arrange the sisters w/in the block such that the twins are sitting together (since the non-twin sister can’t sit between them), meaning there are 4 x 6! ways to arrange the siblings such that the twins are together and the 3 girls are together. So the # of ways to seat the twins together such that the 3 girls don’t seat together is (2 x 7!) – (4 x 6!) = 10080 – 2880 = 7200. Exercises 4. Our club has 20 members, 10 boys & 10 girls. In how many ways can we choose a president and vice-president if: (a) We have no restrictions other than the same person can’t hold both offices? (b) They must be of different gender? (c) They must be of the same gender? (d) How many of your answers to (a), (b), (c) are related? Why? (a) The president can be any one of the 20 members, and the vice-president can be any of the 19 remaining. Answer: 20 x 19 = 380. (a) The president can be any one of the 20 members, and the vice-president can be any of the 19 remaining. Answer: 20 x 19 = 380. (b) The president can be any of the 20 members, and the vice-president can be any one of the 10 members of the opposite sex. Ans: 20x10 = 200. (a) The president can be any one of the 20 members, and the vice-president can be any of the 19 remaining. Answer: 20 x 19 = 380. (b) The president can be any of the 20 members, and the vice-president can be any one of the 10 members of the opposite sex. Ans: 20x10 = 200. (c) The president can be any of the 20 members, and the v.p. can be any one of the 9 remaining members of the same sex. Ans: 20 x 9 = 180. (a) The president can be any one of the 20 members, and the vice-president can be any of the 19 remaining. Answer: 20 x 19 = 380. (b) The president can be any of the 20 members, and the vice-president can be any one of the 10 members of the opposite sex. Ans: 20x10 = 200. (c) The president can be any of the 20 members, and the v.p. can be any one of the 9 remaining members of the same sex. Ans: 20 x 9 = 180. (d) Part (a) can be split into cases (b) & (c), and 380 = 200 + 180. Exercises 5. Our club has 25 members and wishes to pick a president, secretary, and treasurer. In how many ways can we choose the officers if: (a) Individual members can only hold one office? (b) Individual members can hold all 3 offices? (c) Individual members are allowed to hold 2, but not all 3, offices? (a) The president can be any of 25 members, the secretary can be any of the remaining 24, and the treasurer can be any of the remaining 23 members. Ans: 25 x 24 x 23 = 13, 800 ways. (a) The president can be any of 25 members, the secretary can be any of the remaining 24, and the treasurer can be any of the remaining 23 members. Ans: 25 x 24 x 23 = 13, 800 ways. (b) There are 25 choices for each position. Answer: 253 = 15, 625 ways. (a) The president can be any of 25 members, the secretary can be any of the remaining 24, and the treasurer can be any of the remaining 23 members. Ans: 25 x 24 x 23 = 13, 800 ways. (b) There are 25 choices for each position. Answer: 253 = 15, 625 ways. (c) With no restrictions, the president can be any of 25 members, secretary can be any of 25 members, & treasurer can be any of 25 members. If the same member holds all 3 offices, it could be any of the 25 members. Exclude these 25 possibilities. Answer: 253 – 25 = 15, 600. Summary Concept 1: When faced with a series of independent choices, one after the other, multiply the # of options at each step. When faced with exclusive options, (meaning we can’t choose more than one), add the # of options. Summary Concept 2: Often, potentially complicated casework means you should think about trying complementary counting. If it’s hard to count all the cases that we want, then it may be relatively easy to count what we don’t want. Summary Concept 3: When a problem asks “How many are not?”, think instead to count “How many are?” When the problem asks “How many have at least one?” think instead to count “How many have none?” Summary Concept 4: It often helps to look at a few simple cases of a more general problem, to try to find a pattern. Review Problems 1. How many 4-digit numbers have only odd digits? 2. How many 3-letter words can be formed from the standard 26-letter alphabet, if the 1st letter must be a vowel (a, e, i, o, u)? 3. How many different 3-digit security codes are possible using the digits 1-5, if the 2nd digit cannot be the same as the 1st, and the 3rd digit cannot be the same as the 2nd? (Source: MATHCOUNTS) Review Problems 1. Each of the 4 digits can be any one of the 5 odd digits, so there are 54 = 625 numbers. 2. The 1st letter can be any of the 5 vowels, and each of the next 2 letters can be any of the 26 letters, so there are 5 x 26 x 26 = 3380 words. 3. There are 5 choices for 1st digit, 4 choices for 2nd digit (since it must be different from the 1st), then 4 choices for the 3rd digit (since it must be different from the 2nd). So there are 5 x 4 x 4 = 80 choices. Review Problems 4. How many triples (a, b, c) of even positive integers satisfy a3 + b2 + c ≤ 50? 5. How many numbers between 100 and 200 (inclusive) are not perfect squares? 6. How many 3-digit numbers have a first digit which is the triple of the final digit? Review Problems 4. If a ≥ 4, then a3 + b2 + c ≥ 43 > 50, so a = 2. Substituting into the equation, we get b2 + c ≤ 42. Since b2 < 42, b must be one of 2, 4, or 6. Review Problems 4. If a ≥ 4, then a3 + b2 + c ≥ 43 > 50, so a = 2. Substituting into the equation, we get b2 + c ≤ 42. Since b2 < 42, b must be one of 2, 4, or 6. When b = 2, c ≤ 38. There are 19 positive even integers ≤ 38, 2x1, 2x2, …, 2x19. Review Problems 4. If a ≥ 4, then a3 + b2 + c ≥ 43 > 50, so a = 2. Substituting into the equation, we get b2 + c ≤ 42. Since b2 < 42, b must be one of 2, 4, or 6. When b = 2, c ≤ 38. There are 19 positive even integers ≤ 38, 2x1, 2x2, …, 2x19. When b = 4, c ≤ 26. There are 13 positive even integers ≤ 26. Review Problems 4. If a ≥ 4, then a3 + b2 + c ≥ 43 > 50, so a = 2. Substituting into the equation, we get b2 + c ≤ 42. Since b2 < 42, b must be one of 2, 4, or 6. When b = 2, c ≤ 38. There are 19 positive even integers ≤ 38, 2x1, 2x2, …, 2x19. When b = 4, c ≤ 26. There are 13 positive even integers ≤ 26. When b = 6, c ≤ 6. There are 3 positive even integers ≤ 6. Review Problems 4. If a ≥ 4, then a3 + b2 + c ≥ 43 > 50, so a = 2. Substituting into the equation, we get b2 + c ≤ 42. Since b2 < 42, b must be one of 2, 4, or 6. When b = 2, c ≤ 38. There are 19 positive even integers ≤ 38, 2x1, 2x2, …, 2x19. When b = 4, c ≤ 26. There are 13 positive even integers ≤ 26. When b = 6, c ≤ 6. There are 3 positive even integers ≤ 6. Thus the answer is 19 + 13 + 6 = 35. Review Problems 5. There are 200 – 100 + 1 = 101 numbers in the list 100, 101, …, 200. There are 5 perfect squares in the list: 102, …, 142. So the # of non-perfect squares is 101 – 5 = 96. Review Problems 6. There are only 3 possibilities for the 1st digit: First digit Last digit 3 1 6 2 9 3 The middle digit can be any of the 10 digits. The answer is 3 x 10 = 30. Review Problems 7. In how many ways can 6 girls and 2 boys sit in a row if the 2 boys insist on sitting next to each other? 8. How many 4-digit numbers have the second digit even and the fourth digit at least twice the second digit? 9. How many ways can we put 3 math books and 5 English books on a shelf if all the math books must stay together and all the English books must also stay together? (All the books are different). Review Problems 7. Consider the 2 boys as one “person”, arrange the “seven” people 1st, then arrange the 2 boys. So the # of seating arrangements in which the boys sit together is 7! X 2! = 10, 080. 8. The 2nd digit must be even, so it must be 0, 2, 4, 6, or 8. However, it cannot be 6 or 8 since then the 4th digit could not be twice the 2nd digit. Thus there are 18 different possible combinations of the 2nd & 4th digits: Second digit Fourth digit 0 0,1,2,3,4,5,6,7,8,9 2 4,5,6,7,8,9 4 8,9 1st digit can be any of the 9 nonzero digits, & the 3rd digit can be any of 10. The answer is 18 x 9 x 10 = 1620. 9. 1st arrange the 2 groups of books: there are 2! ways in which we can do this. Then arrange the 3 math books in 3! ways & the 5 English books in 5! ways. So there are 2! X 3! X 5! = 1440 ways. Review Problems 10. My school’s science club has 22 members. It needs to select 3 officers: chairman, vicechairman, and sergeant-at-arms. Each person can only hold one office. 2 of the members, Penelope and Quentin, will only be officers if the other one is also an officer. In how many ways can the club choose its officers? 11. How many positive even 3-digit numbers exist such that the sum of the hundreds digit and the tens digit equals the units digit? (Source: MATHCOUNTS) 10. If both Penelope and Quentin are not officers, then there are 20 choices for chairman, 19 choices for v-c, and 18 choices for s-a-arms. There are 20 x 19 x 18 = 6840 ways in this case. If both are officers, Penelope can take one of the 3 positions, Quentin can take one of the 2 remaining positions, and any of the 20 remaining can take the 3rd position. There are 3 x 2 x 20 = 120 ways in this case. The answer is 6840 + 120 = 6960. 11.The units digit must be 2, 4, 6, or 8 (can’t be 0 because then the # would be 000). If the units digit is a, then the hundreds digits can be any digit from 1 to a, and the middle digit is then necessarily a minus the hundreds digit. Therefore there are a such numbers with the units digit a. So there are 2 + 4 + 6 + 8 = 20 such numbers. Challenge Problems 1. The digital sum of a number is the sum of its digits. For how many of the positive integers 24 - 125 inclusive is the digital sum a multiple of 7? (Source: MATHCOUNTS) A naïve approach would be to simply list them: 25, 34, 43, 52, 59, 61, 68, 70,77, 86, 95, 106, 115, 124 giving 14 such numbers. But we might be worried that we skipped one by mistake. A more systematic approach is to observe that the desired numbers’ digital sums could only be either 7 or 14, & the only ones between 24-125 with digital sums of 14 must be 2-digit #s (since to get a 3-digit # beginning w/ 1 whose digital sum = 14, the 2nd digit must be at least 4, since the last digit can be at most 9). So there are 3 exclusive cases: Challenge Problem 2 Mr. Smith brings home 7 animals for his 7 children. There are 4 different cats (Siamese, Persian, Calico, Minx), 2 different cars (Poodle, Golden Retriever), and a goldfish. Anna and Betty refuse to take care of the goldfish, and Charlie & Danny insist on having cats. The other 3 kikds are easier to please – they’ll take anything. In how many ways can Mr. Smith give the children pets? Charlie can take one of the 4 cats and Danny can take one of the remaining 3 cats, so there are 4 x 3 = 12 ways to give cats to those 2 kids. Charlie can take one of the 4 cats and Danny can take one of the remaining 3 cats, so there are 4 x 3 = 12 ways to give cats to those 2 kids. Since Anna & Betty can’t take a goldfish, they select from the 4 remaining animals so there are 4 x 3 = 12 ways to give pets to these 2 kids. For the other 3 kids there are 3 x 2 x 1 = 6 ways to give out the remaining 3 pets. The answer is 12 x 12 x 6 = 864. Challenge Problem 3 The n members of a committee are numbered 1 through n. One of the members is designated as “Grand Pooh-Bah.” The n members sit in a row of n chairs, but no member with a number greater than the Grand Pooh-Bah may sit in the seat to the immediate right of the Grand PoohBah. Suppose that the Grand Pooh-Bah is member number p, where 1 ≤ p ≤ n. Find a formula, in terms of n and p, for the # of ways for the committee to sit. (Source: MATHCOUNTS) 1st, choose the position that the Grand Pooh-Bah sits in. There are 2 cases: Case 1: Person p sits at the far right. There is no further restriction, and the other n – 1 members can sit in (n – 1)! ways. 1st, choose the position that the Grand Pooh-Bah sits in. There are 2 cases: Case 1: Person p sits at the far right. There is no further restriction, and the other n – 1 members can sit in (n – 1)! ways. Case 2: Person p sits anywhere other than the far right. There are n – 1 places where person p sits, and p – 1 choices for the person who sits to her immediate right (since it must be one of 1,2,3,…,p – 1). 1st, choose the position that the Grand Pooh-Bah sits in. There are 2 cases: Case 1: Person p sits at the far right. There is no further restriction, and the other n – 1 members can sit in (n – 1)! ways. Case 2: Person p sits anywhere other than the far right. There are n – 1 places where person p sits, and p – 1 choices for the person who sits to her immediate right (since it must be one of 1,2,3,…,p – 1). Then the remaining n – 2 people can sit in the remaining (n – 2)! ways. So the total # of seatings is (n – 1)! + (n – 1)(p – 1)(n – 2)! which simplifies to p(n – 1)! Challenge 4 In how many ways can you spell the word NOON in the grid below? You can start on any letter, then on each step you can move one letter in any direction (up, down, left, right, or diagonal). You cannot visit the same letter twice. NNNN NOON NOON NNNN Starting at one of the 4 N’s in a corner, then there is only 1 choice for the 1st O, then 3 for the 2nd O, then 5 choices for the 2nd N, for a total of 4 x 1 x 3 x 5 = 60 ways to form NOON starting from a corner. Starting at one of the 4 N’s in a corner, then there is only 1 choice for the 1st O, then 3 for the 2nd O, then 5 choices for the 2nd N, for a total of 4 x 1 x 3 x 5 = 60 ways to form NOON starting from a corner. Starting at one of the 8 N’s on the side, then there are 2 choices for the 1st O, then 3 choices for the 2nd O. If the 2nd O is chosen adjacent to the original N, then there are only 5 choices for the final N, otherwise (for the other 2 choices of the 2nd O), there are 5 choices for the final N. Starting at one of the 8 N’s on the side, then there are 2 choices for the 1st O, then 3 choices for the 2nd O. If the 2nd O is chosen adjacent to the original N, then there are only 5 choices for the final N, otherwise (for the other 2 choices of the 2nd O), there are 5 choices for the final N. So there are 8 x 2 x (2 x 5 + 1 x 4) = 224 ways starting from the side. This gives a total of 60 + 224 = 284 ways to from NOON Challenge 5 A palindrome is a number that reads the same forwards and backwards, such as 12321. (a)How many 4-digit palindromes are there? (b)How many 5-digit palindromes are there? (c)How many 6-digit palindromes are there? (d)Suppose we form all k-digit palindromes that consist of 8’s and 9’s such that there is at least one of each digit. What is the smallest value of k such that there are at least 2004 #s in the list? (a)The 1st two digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, and the 2nd digit can be any of 10 digits. The answer is 9 x 10 = 90. (a) The 1st two digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, and the 2nd digit can be any of 10 digits. The answer is 9 x 10 = 90. (b) The 1st three digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, each of the 2nd and 3rd digits can be any of the 10 digits. The answer is 9 x 10 x 10 = 900. (a) The 1st two digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, and the 2nd digit can be any of 10 digits. The answer is 9 x 10 = 90. (b) The 1st three digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, each of the 2nd and 3rd digits can be any of the 10 digits. The answer is 9 x 10 x 10 = 900. (c) The 1st three digits determine the palindrome. The 1st digit can be any of 9 nonzero digits, and each of the 2nd and 3rd digits can be any of the 10 digits. The answer is 9 x 10 x 10 = 900. (d) If k is even, then the 1st k/2 digits determine the palindrome. Since there are 2 choices for each digit, there are 2k/2 palindromes of length k. If k is odd, then the 1st (k+1)/2 digits determine the palindrome. Again there are 2 choices for each digit, so there is 2(k+1)/2 palindromes of length k. Note that this is the same as the # of palindromes of length k + 1. If k is odd, then the 1st (k+1)/2 digits determine the palindrome. Again there are 2 choices for each digit, so there is 2(k+1)/2 palindromes of length k. Note that this is the same as the # of palindromes of length k + 1. So we are looking for the smallest odd value of k such that 2(k+1)/2 ≥ 2004. We know 210 – 2 = 1022 and 211 – 2 = 2046, so (k + 1)/2 ≥ 11 and the smallest such k is 21. Challenge 6 How many 5-letter ‘words’ (where any string of letters is a word) have at least 2 consecutive letters which are the same? Challenge 6 The total of all 5-letter words is 265, since each letter can be any letter of the alphabet. The # of 5-letter words in which no two consecutive letters are the same is 26 x 254. This is because the 1st letter can be anything, while there are 25 choices for each subsequent letter, since each letter cannot match the previous one. Then subtract to get the answer 265 – (26 x 254) = 1,725,126. Challenge 7 Ten students in a physics class sit at a round table in the following manner: The students line up in alphabetical order. The student whose name is 1st sits anywhere she wants. Each subsequent student chooses a chair that is next to a student who is already seated. How many different seatings are possible, assuming that 2 seatings are the same if each student in both seatings has the same student to the left and the same student to the right? Since we’re looking at relative positions, it doesn’t matter where the 1st student sits. The 2nd student can sit left or right of the 1st. The 3rd can sit left or right of the block of the two students already seated. The 4th student can sit left or right of the block of three already seated, and so on. Finally, the 9th student can sit left or right of the block of eight. The 10th student takes the only seat left. Each of students 2 through 9 has 2 choices, so the # of seatings is 28 = 256.