TOPIC 2: HOW TO COUNT Problems and solutions on 'How many ways?' (Combinatorics). These start with very simple situations and illustrate how the methods can be extended to more difficult cases. 2. How Many I. A girl has pair of jeans, skirt and 3 different jumpers. How many different outfits can she wear? 2. The kit of a football team includes black shorts, white shorts, and jerseys in red, blue, white and striped. How many different strips can they wear? 3. Given 4 beads,, Y, G, B: a) How many ways can the, Y, G be placed in a line? b) How many ways can all four be placed in a line? c) How many ways of choosing bead from Y G B? d) How many ways of choosing 2 beads from Y G B if the order is important? e) How many ways of choosing 2 beads from Y G B if the order doesn't matter? 4. Four children are named uth, Yvonne, Geraldine and Brenda a) How many ways can they be placed in a line? b) How many ways of choosing 2, one to get st prize, the other to get 2 nd? c) How many ways of choosing 2, to go on a school trip? d) How many ways of choosing 3 to go on a school trip 5. Given 5 beads YY, all alike apart from colour: a) How many ways of choosing 2 of them (without regard to order)? b) How many ways of choosing 3 of them (without regard to order)? c) How many ways of arranging all of them in a line? 6. Given 3 identical beads, how many ways of distributing them: a) into 2 boxes A box may be left empty, so 2 possible ways are b) into 3 boxes and c) into 4 boxes 2.2 How Many II ) The number 7 can be made up from 's and 2's as 7 = 2 + 2 + 2 + How many different ways if the order matters - so that 222 and 222 are different? Try the same problem for making up 6 (and then 5, and 8, and 9 ). Can you see a pattern? 2) Paving stones for a path come in two sizes, x units and x2 units. A path of length 6 might look like this: How many other paths of length 6 can you find? How many paths of length 7 can you find? How many paths of length 4? Of length 5? Can you see a pattern? 2 (b) A boy runs upstairs, sometimes going up 2 steps at a time, and sometimes only step. How many different ways can he run up a flight of 7 steps? How many for 6 steps? For 8 steps? Can you see a pattern? 3) Answer Question if order doesn't matter - so that 2 + 2 + + 2 counts as the same as 2 + 2 + 2 + for making up 7
4) A regular pentagon is to be coloured by painting in either red or blue a spot on each vertex. Possible designs are: B B B Suppose we want to find out how many different designs there are. Start by trying the easier problems for an equilateral triangle and a square first. Now solve the problem for a regular pentagon and then for a regular hexagon - but first decide what you think the answer is going to be! 5) This is a domino (2 squares). B B This is a tromino (3 squares). Draw another tromino. Can you find any more? Draw as many tetrominos (4 squares) as you can. eg. How many? There are 2 different pentominos. Draw as many as you can. 6) Pancake problem A circular pancake is divided into pieces by 3 straight cuts. What is the maximum number of pieces formed? What if there are 4 cuts? 5 cuts? 0 cuts? N cuts? n=2, =2 n=3, =4 n=4, =8 n=5, =6 7) Some points are placed on the circumference of a circle, and each pair of points is joined, creating regions inside the circle. How is (n), the maximum possible number of regions, related to n, the number of points? Try n = 2, 3, 4, 5, 6,.. (Be careful not to put the points in special positions. eg with 6 points in the form of a regular hexagon, you will lose a region.) 8) I have a supply of stamps, of value, 2, 4 units. In how many ways can I combine them to make up a sum of 4 units (disregarding order)? [Answer 4, since 4 =, 22, 2, 4]. How many ways are there of making up n units, where n =, 2, 3, 4, 5,...? 2
2.3 How many IIIPart A Pascal's Triangle a) What is the law of the table? Write the next two rows. b) What do you notice about the numbers in diagonal A? In diagonal B? In diagonal C? c) Add the numbers in each row across. What do you notice? d) Put a faint pencil ring around all the odd numbers. What do you notice? How many numbers in each row are odd? Make a conjecture (ie. a sensible guess) e) Consider division by 3. ing in red those which leave remainder, and in green those which leave remainder 2. (Leave unmarked those which leave no remainder). Any conjectures?? f) Look at the numbers in the diagonals E, F, and G. Their sums are 8, 3, 2. Draw some more lines parallel to these and find the sums of the numbers in each 'diagonal' [Compare with Q II.] g) The 20 th row will begin with, 9, What is the next number? How is each number related to the one before it in the row? This is too hard, so try an easier version: Start with row eight, which begins, 7, 2, 35,.. What are the multiplying factors - (which change into 7, 7 into 2, etc.?) - they are 7, 3, 5/3, Now look at row seven -, 6, 5, and look at the multiplying factors here. When you have seen the pattern, go back and re-examine row eight. Now write the first few numbers in row 20 -, 9, 7,.. h) Write down anything else you notice - try to prove or justify statements or conjectures you have already made. Part B. Four bags each contain one red bead and one yellow bead. In how many different ways can I pick one bead from each bag and end up with: i) ii)3, Y iii) 2, 2Y iv), 3Y v) YYYY? [The order in which the beads are chosen is not important - we are only interested in the final result] 2. There is space on the bus for 2 children to go to the zoo. 4 girls and boy want to go. How many ways of choosing 2 from the 5 children? How many ways of choosing 2 from the 4 girls? How many ways if one boy is chosen, together with one of the girls? 3. I have a bag containing 6 beads, 5 are white and one is black. 3
I want to choose 2 beads from the 6. In how many different ways can I do this (if the order of choosing is not important)? [assume the white beads are numbered, say -5, so we can tell which is which] If I choose 2 beads and one of them is the black one, in how many ways can I do this? If I choose 2 beads and none of them is the black one, in how many ways can I do this 4. Answer the questions in Q3 if I now choose three beads from the six [(a) with no restriction, (b) choosing the black one, (c) not choosing the black one] 2.4 How Many IV Suppose I have an unlimited supply of beads of 5 colours YGBW. How many ways of choosing 2 beads using only and Y? How many ways of choosing 2 beads using only, Y and G? How many ways of choosing 2 beads using only, Y, G, B? How many ways of choosing 2 beads using all 5 colours? epeat for 3 beads. Make a table like the one below and complete it. Explain! No. of colours 2 3 4 5 No. of beads 0 2 3 4 5 2. 3. 0. 3..... 4.... 70 How many - Solutions 2.5 Solutions If I have a choice at breakfast of I can have 3 2 2 different breakfasts in all. We could make a list of these, or show them in a "tree": This is an example of a useful idea which underlies nearly all the problems in this 'How Many?' series. 4
If I can do action A in a ways and action B in b ways, then I can do A followed by B in a b ways. A different situation might occur at lunch: I can have a meat course of lamb or chicken or pork, (3 choices) O a vegetarian choice of mushroom pie or cheese omelette. (2 choices). Here I do A O B and the number of choices is 3 + 2 = 5. Answers: ) 6 2) 8 3) a) st bead can be chosen in 3 ways, second in 2, third in. Ans 3 2 =6 [The arrangements are YG, GY, YG, YG, GY, GY] b) st bead can be chosen in 4 ways, 2 nd in 3, 3 rd in 2, 4 th in Ans 4 3 2 = 24 [Alternatively, given any arrangement of YG - say G Y the blue bead can be inserted in any one of 4 positions] In the same way, 5 objects can be placed in order in 5 4 3 2 = 20 ways 6 objects can be placed in order in 6 5 4 3 2 = 720 ways and 0 objects in 0! ways, where 0! means 0 9 8 7 6. 3 2 [This is about 3.5 million - so if you enter a competition where you have to place 0 objects in order of merit and you do it randomly, your chance of winning is less than in 3 million] In general, n objects can be placed in order in n! ways, where n! ('n factorial') = n (n-) (n-2) 4 3 2 3c) 4 ways 3d) Choose st in 4 ways, 2 nd in 3 ways Ans 4 3 = 2 3e) If the order doesn't matter, the choice G is the same as G - so the choices go in pairs and there are 2/6different choices [They are Y, G, B, YG, YB, GB] Problem (4) is just like Problem (3) 'in disguise'. We say the problems are 'isomorphic' - that is, they have the same shape or same structure.[ iso= same (isotherm, isobar, isometric ), morph = shape or structure] 4d) Ans 4 - you have to leave out one, so 4 choices. Note on 3e) Choosing where order doesn't matter. Suppose we have to choose 3 people from 7. If order does matter, we have 7 choices for st, 6 for 2 nd, 5 for 3 rd - ie. 7 6 5 choices in all. 7 6 5 = 20 But if order doesn't matter, the choice Amy, Susan, Brenda (ASB) is equivalent to ABS, BSA, BAS, SAB, SBA ie there are 6 equivalent choices (6 = 3 2, the number of ways of arranging A, S, B in order) So the number of different choices is 20/6 = 35. We write this as 7 C 3 (from 7, CHOOSE 3) = 7 6 5 2 3 Similarly, the number of ways of choosing 5 people from a group of 0 to receive a gift is 0 C 5 which is 0 9 8 7 6 = 6x7x6 = 252 2 3 4 5 5a) 3 -, Y, YY 5b) 3 -, Y, YY 5c) More difficult! YY i) By making a table YY ii) Where shall we put the two yellows? YY 2 st, 5 choices, 2nd 4 choices, so 20 in all?? YY But Y and Y 2 can be interchanged, so there are 20/2 = 0 ways YY 5C 2 = 0 YY 3 Similarly, with children ABCDE, st 2 nd 3 rd YY YY YY 5C 3 = 5 4 3 =0 YY 4 3 2 5
reorder (3 chosen in 3 2 ways) Note that 5 C 2 = 5 C 3 (??) iii) Attach labels so we have 2 3 Y Y 2, so there are 5! ways of arranging. Now permute (rearrange) the 's in 3! ways and the Y's in 2! ways. Number of distinct arrangements is 5!/(3!2!) = 0 as before. Similarly, with YYBBBB there are 9! arrangements of 9 objects, but the 's can be rearranged in 3! ways, the Y's in 2! ways and the B's in 4! ways, so there are 9!/(3!2!4!) = 9 8 7 6 5/(6 2) = 260 distinct ways of arranging YYBBBB in a line. Interlude - 5 C 2 = 5 C 3??? Suppose 5 chairs are arranged in a line and we have to seat 3 boys on them. In how many ways can this be done? If we choose the 3 seats where the boys sit there are 5C 3 ways If we choose the 2 seats left empty, there are 5 C 2 ways. Notice 5 C 3 = 5 4 3/( 2 3)= 5 4/( 2) = 5 C 2 Why is 7 C 3 = 7 C 4? - because when we choose 3 from 7, we reject 4 of the 7. B B B In general, n C r = n C n-r [ n C r - 'from n, choose r' ] The number of ways of choosing r things from n = the number of ways of 6 choosing Answers a) (n-r) 4, b)0, things c) from 20 n [order being irrelevant] Methods: i) by a tree ii) by lists 2 3 0 3 4 6 An alternative: 6
The pattern 3000 can arise in 4 ways (3 in any one of 4 boxes ie. 3000, 0300, 0030, 0003) Similarly, 200 arises in 2 ways (4 places to put the '2', 3 places to put the '', the rest are '0' ) and 0 in 4 ways (places to put the '0') Total 20 Comment on the list method: In the 3 box problem, if the first box is empty we have to place 3 beads in 2 boxes [this is problem (a)] In the 4 box problem, if the first box is empty we have to place 4 beads in 3 boxes [this is problem (b)] So the problem of 4 boxes contains within itself the 3 box problem, which in turn contains the 2 box problem. Two remarks (i) We can often solve a problem by breaking it down into simpler problems of the same type. This method is called 'recursion' (ii) We can explain how the relation 0 = + 2 + 3 + 4 arises in this way: {3 beads in 3 boxes} = 3 beads in box and {0 in the other 2} way + 2 beads in box and { in the other 2} 2 ways + bead in box and {2 in the other 2} 3 ways + 0 beads in box and {3 in the other 2} 4 ways Similarly, 20 = + 3 + 6 + 0: {3 beads in 4 boxes} = 3 beads in box and {0 in the other 3} way + 2 beads in box and { in the other 3} 3 ways + bead in box and {2 in the other 3} 6 ways + 0 beads in box and {3 in the other 3} 0 ways When you spot a pattern it is worth trying to understand why it arises 2.6 Solutions II, 2a, 2b are isomorphic problems - ie. the same problem in 3 different 'disguises'. By counting we find Number n (path length, no. of steps) 2 3 4 5 6 7 Number of ways 2 3 5 8 3 2 You may have met the sequence, 2, 3, 5, 8 before - it is called the Fibonacci sequence and has many interesting properties. Did you spot the rule of the sequence? Some examples are 5 + 8 = 3, 8 + 3 = 2. ie. each term is the sum of the two preceding terms t + t 2 = t 3 t 2 + t 3 = t 4, etc. Why is this? Consider t 4 = t 2 + t 3 2 2 2 2 2 2 2 2 To represent the number 4 we can either start with a '2' - and then we have to continue with the representations of 2 - in t 2 ways O we can start with a '' and continue in t 3 ways with the representations of 3. ie. t 2 + t 3 = t 4. In the same way t 8 = t 6 + t 7 = 3 + 2 = 34 (start with 2) (start with ) 3. Number n 2 3 4 5 6 7 No. of ways 2 2 3 3 4 4 If order doesn't matter we can place all the '2's first, so 7 = 2 + 2 + + + = 2 + a representation of 5 So t 7 = t 5 + (for the representation of 7 as + + + + + + ) This explains the table. Number of ways is (n+2)/2 if n is even, (n+)/2 if n is odd, = [(n+2)/2] 7
where [x] = largest whole number not greater than x, ie. the whole number part of x. eg. [3.7] = 3 7 5 2 2 2 2 2 2 2 2 2 4. For the triangle, 4 + + + = 4 For the square, 6 + + 2 + + = 6 For the pentagon, 8 + + 2 + 2 + + = 8 Can you see why (for the square) the number of patterns with spot = no. of patterns with 3 spots? (and with 0 spots is the same as for 4 spots?) For the hexagon, there are 3 x 3 patterns, where x=3 if we count as the same (reflecting, or turning the hexagon over), and x=4 if they are regarded as different. [So, 3 or 4 patterns; the answer isn't 0 as we might have expected - a misleading sequence] For the heptagon (7 sides) 3 x 3, x=4 if reflections allowed, x=6 if not [4 or 6] For the octagon (8 sides) 4 x x 4, x=5 if reflections allowed, x=7 if not [22 or 26] 5. There are five tetrominoes and 2 pentominoes (allowing pieces to be turned over). Counting gets progressively more difficult as n increases. N 2 3 4 5 6 No. of pieces 2 4 2 35 The 2 pentominoes 6. cuts n 2 3 4 5 6 7 regions n 2 4 7 6 22 29 n = (n 2 + n + 2)/2 The pattern continues, since when we add a 5 th line, this is cut by the other 4 lines into 5 pieces, creating 5 new regions ( + 5 = 6), and so on. 7. Points n 2 3 4 5 6 7 egions n 2 4 8 6 3 57 We might expect 32 regions for n=6, and people sometimes spend a lot of time looking for the 'missing' 32 nd region - but there isn't one! This is another misleading pattern; the correct formula is known but is too difficult to explain here. 8. Yet another misleading pattern! (There is a way of calculating the answer, but it is not easy) n 2 3 4 5 6 7 ways 2 3 4 5 7 8 2.7 Solutions III A) Pascal's Triangle. Each number is the sum of the two above it eg. 0 + 0 = 20, 20 + 5 = 35. Next two rows 9 36 84 26 26 84 36 9 8
0 45 20 20 252 20 20 45 0 2. A is 2 3 4, B is 3 6 0 triangular numbers (oranges, arranged in triangles!), C is 4 0 20 tetrahedral numbers (oranges arranged in pyramids) The numbers in A are the differences of those in B, those in B the differences of those in C etc. (Why?) 3. Totals are 2 4 8 6 powers of 2 (2 0 = ). Why? [Numbers in each row are each used twice in getting the numbers of the next row] 4. The sequence of the number of odd coefficients, 2 2 4 2 4 4 8, continues 2 4 4 8 4 8 8 6 Whenever the number of odd coefficients reaches a maximum, the next number is 2, and the whole sequence so far appears, doubled. We can explain this by an analogy - we imagine a tree where twigs die (of "overcrowding"). Evidently, for rows 9-2 the pattern of rows 5-8 is repeated - at 2, half of the tree reaches "full growth" and dies back to only 2 twigs, which grow in rows 3-6 until the whole tree reaches full growth - ie 6 odd coefficients. No. of coefficients which are odd 2 2 4 2 4 4 8 5. There are patterns in the numbers of, G and blanks in each row, which can be explained as above in (4). [Write O for the blanks, for and 2 for G. The pattern reaches ( 0 0 ) in row 4, ( 0 0 0 0 0 0 0 0 )in row 0 and so on (4=3+, 0 = 9+, 28 = 27+,..). After each stage, the pattern repeats from the beginning, but doubled. 6. Conjecture - the sums are Fibonacci numbers (see II Q,2,3). [eason - each number in G is obtained by adding one number from F and one from E] We can see another reason why the Fibonacci numbers are involved by re-examining Q, part II where they were mentioned earlier. To represent 7 we may use 222, 22, 2, and their re-arrangements. In the first there are 4 C 3 choices for the position of the 2s; in the second, 5 C 2 choices for the position of the 2s; in the third and fourth, 6 C and 7 C 0 choices, respectively. So 4 C 3 + 5 C 2 + 6 C + 7 C 0 = 4 + 0 + 6 + = 2. [If we consider the placing of the s, we have 4 C + 5 C 3 + 6 C 5 + 7 C 7 =2 - the second suffix increases by 2 each time as each 2 is replaced by two s.] 6. 7 2 35 35 2 7 7 3 5/3 3/5 /3 /7 6 5 20 5 6 6 5/2 4/3 3/4 2/5 /6 The second pattern of multipliers is 6/, 5/2, 4/3, 3/4, 2/5, /6. If we write 3 = 6/2, the pattern in row 8 is 7/, 6/2, 5/3, 4/4, 3/5, 2/6, /7. ow 20 is 9 9 8/2 9 8 7/(2 3) 9 8 7 6/(2 3 4) ie. 9 7 969 3876 Part B. i) way ii) Y 4 ways ( 4 C for Y) iii) YY 6 ways ( 4 C 2 for Y) These are row 5 of the Pascal triangle iv) YYY 4 ways ( 4 C 3 for Y) so the Pascal triangle numbers are choosing numbers v) YYYY way ( 4 C 4 for Y) eg. 5 C 2 = 0, 6 C 3 = 20, 6 C 2 = 5 9
The triangle is: 0C 0 C 0 C 2C 0 2C 2C 2 2 3C 0 3C 3C 2 3C 3 3 3 4C 0 4C 4C 2 4C 3 4C 4 4 6 4 2) i) 5 C 2 = 0, ii) 4 C 2 = 6 iii) 4 C = 4. [Notice that 0 = 6 + 4] 3) (Choose 2) 6C 2 = 5 Choose b, then choose w from 5 5C = 5 O choose 2w from 5 5C 2 = 0. 5 = 0 + 5 So 6 C 2 = 5 C + 5 C 2 choose any 2 0 black black 4) (Choose 3) a) 6 C 3 = 20 b) 5 C 2 = 0 c) 5 C 3 = 0, 20=0+0 So 6 C 3 = 5 C 2 + 5 C 3 Generally, n+ C r = n C r- + n C r This is the rule you noticed in Pascal's triangle - each number is the sum of the two immediately above it. 2.8 Solutions IV The completed table is: No. of colours 2 3 4 5 No. of beads 0 2 3 4 5 2 3 6 0 5 3 4 0 20 35 4 5 5 35 70 Two things may be noticed:. Sums of numbers like +3+6 =0, +4 +0 +20 =35 2. The table is like Pascal's triangle, turned through 45 degrees How does the pattern of () arise? Consider the problem of choosing 3 beads from 3 colours, order irrelevant, repetitions allowed. Suppose the number of ways is denoted by 3 K 3. Let the 3 colours be YG and consider 3 types of selection: i) those containing G, with no other restriction ii) iii) those not containing G, but containing Y, no other restriction those not containing G or Y, but containing, no other restriction (the last condition is irrelevant) Then the number (i) is 2 K 3 (since we have to choose the remaining 2 beads from 3 colours) The number (ii) is 2 K 2 (since we have to choose the remaining 2 beads from 2 colours) And the number (iii) is 2K (since we have to choose the remaining 2 beads from colour). If we have already worked out the values of 2 K 3, 2 K 2 and 2 K as 6, 3 and, we arrive at 0 = 3 K 3 = 6 + 3 + 3 6 0 3 K 3 = 2 K 3 + 2 K 2 + 2 K An alternative sum is: 2 3 0 3 0 K = K + K + K + K 3 0 2 2 2 2 3 2 and this may be obtained as follows:
Take as the 'most important 'colour, then Y then G Use the most important colour only - way, () 0 K 2 Use, then either Y or G - 2 ways, (Y, G) K 2 Use,, then either Y or G - 3ways, (YY, YG, GG) 2 K 2 Use no, then either Y or G - 4 ways, (YYY, YYG, YGG, GGG) 3 K 2 Where does Pascal's triangle arise? (2) To see this it may be helpful to go back to Q 6 of part I - putting beads into boxes. There we found that 3 beads could be put into 3 boxes in 0 ways - We can represent the 0 ways like this, where the * signs take the place of the box partitions ** ** ** ** ** ** ** * * ** But now we see that the problem is equivalent to arranging two *s and 3 's in a row - which we can do in 5 C 2 ways (ie. 0 ways, corresponding to the 0 choices of places for the *s). Note: 5 = 3 + 2 = 3 + (3 -) = beads + boxes - Similarly, 3 beads can be placed in 2 boxes in 3+ C (ie 4 ways) and 3 beads in 4 boxes in 3+3 C 3 ways (ie. 20 ways). Now suppose we are choosing 3 beads from 6 colours ( 3 K 6 in our earlier notation). Suppose we have 6 boxes into which we place 3 (colourless) beads; xx x Y G B W O Label the boxes with the 6 colours and regard this as a choice of GGW So, 3 K 6 is the number of ways of placing 3 beads in 6 boxes ie. 3 K 6 = 8 C 5 (= 8 C 3 by work above; Part I, Q5) This gives a very easy solution to the whole problem - but I have to admit I only found this at the end, after using a lot of other methods! Even easier! If the table is Pascal's triangle, we ought to be able to see why each number is the sum of the two numbers immediately "above" (and to the left of ) it - for example 4 K 5 = 4 K 4 + 3 K 5. But the number of ways of choosing 4 beads from the 5 colours YGBW may be split into those where at least one is chosen ( 3 K 5 ) and those where no is chosen ( 4 K 4 ). So we can build up the table from the edges working inwards, since choosing 0 beads can be done in only way, and choosing any number of beads from only colour can be done in only one way.