Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
The University of Sydney School of Mathematics and Statistics Solutions to Tutorial 3 (Week 4) MATH2069/2969: Discrete Mathematics and Graph Theory Semester 1, 2017 1. A factory makes jelly beans of 15 different flavours, which it sells in bags of 10. If the jelly beans in a bag must all have different flavours, how many possible kinds of bag are there? What about if this restriction is removed? Solution: We are making an unordered selection of 10 from 15 possibilities. If 15 repetition is not allowed (i.e. you can’t repeat a flavour), the answer is 10 = 3003. If repetition is allowed, the answer is 15+10−1 = 1961256. 10 2. If there are 10 chairs in a row and 8 students who want to sit down, you would normally say there are 10(8) = 1814400 possible outcomes (a case of ordered selection with repetition not allowed). What unusual circumstances would make you 17 10 8 change this answer to 10 ? How about 8 or 8 ? Solution: The answer would be 108 if repetition was allowed; in the context of the question, this would mean that more than one student was allowed to sit in a single chair (in fact, for the answer to be truly 108 , you would even have to allow the possibility that all the students sit in the same chair). The answer would be 10 if repetition was not allowed, but the students were indistinguishable in 8 the sense that it didn’t matter which student sat where – in this case, it is an unordered selection, and you are really just which 8 of the 10 chairs are choosing 10+8−1 17 occupied. The answer would be = 8 if repetition was allowed and it 8 was an unordered selection – in other words, if more than one student per chair was allowed, and the students were indistinguishable – in which case you are really just choosing how many students are sitting on each chair, with a fixed total of 8. 3. Suppose that A and B are subsets of some set X, and |A| = 140, |B| = 92. (a) Find |A ∪ B|, given that |A ∩ B| = 36. Solution: By the Inclusion/Exclusion Principle, we have |A ∪ B| = |A| + |B| − |A ∩ B| = 140 + 92 − 36 = 196. (b) Find |A ∩ B|, given that |A ∪ B| = 150. Solution: By the Inclusion/Exclusion Principle, we have |A ∩ B| = |A| + |B| − |A ∪ B| = 140 + 92 − 150 = 82. *(c) Prove that it is impossible to have another subset C of X such that |C| = 58, |A ∩ B| = 32, |A ∩ B ∩ C| = 10, |A ∪ B ∪ C| = 250. c 2017 The University of Sydney Copyright 1 Solution: Suppose there exists a C with these properties. Then by the Inclusion/Exclusion Principle, we have 250 = = = = |A ∪ B ∪ C| |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C| 140 + 92 + 58 − 32 − |A ∩ C| − |B ∩ C| + 10 268 − |A ∩ C| − |B ∩ C| But both A ∩ C and B ∩ C contain A ∩ B ∩ C, so |A ∩ C| ≥ 10, |B ∩ C| ≥ 10. Thus 250 ≤ 268 − 10 − 10 = 248, which is a contradiction. Hence no such set C exists. 4. If you are dealt 5 cards from a standard deck of 52 (4 suits, each containing 52 A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2), the number of possible hands is 5 = 2598960. (a) How many of these hands contain the ace of spades? Solution: If we know that the hand contains the ace of spades, choosing the rest of it amounts to choosing 4 cards from the other 51. So the answer 51 is 4 = 249900. (b) How many of the hands contain exactly two aces? Solution: There are four aces in the deck, so we can choose the two aces in 42 = 6 ways. Then we have to choose the remaining 3 cards from the 48 non-aces, which can be done in 48 ways. So the answer is 6 48 = 103776. 3 3 (c) How many of the hands contain at least two aces? Solution: We need to add to the previous answer the number of hands which contain exactly three aces and the number which contain all four aces. The number which contain exactlythree aces is 4 48 = 4512, and the 2 48 number which contain all four aces is 1 = 48, by the same reasoning as in the previous part. So the answer is 103776 + 4512 + 48 = 108336. Note that , as you might expect if you thought of choosing the answer is not 42 50 3 two aces first and then choosing the three other cards. The reason is that this will count hands which have more than two aces more than once. (d) How many of the hands are a full house (three of one value and two of another, with no condition on the suits)? Solution: We can choose the values involved in 13(2) = 13 × 12 = 156 ways (13 choices for the value which occurs three times and 12 choices for the value which occurs twice). Then we can choose the suits for the triplet 4 4 in 3 = 4 ways and the suits for the pair in 2 = 6 ways. So the answer is 156 × 4 × 6 = 3744. (e) How many of the hands are a flush (all of the same suit), but not a straight flush (all of the same suit and five consecutive values, counting J = 11, Q = 12, K = 13, A = 14)? 2 Solution: The number of flushes (including straight flushes) is 4 × 13 = 5 5148, because you can choose the suit in 4 ways and then the cards from that suit in 13 ways. The number of straight flushes is 4 × 9 = 36, because once 5 the suit is chosen you just need to specify the lowest card of the straight, which can be anything from 2 to 10 (inclusive). So the number of flushes which are not a straight flush is 5148 − 36 = 5112. *(f) By replacing “at least two” with “at least zero” in part (c), show the equality 4 48 4 48 4 48 4 48 4 48 52 . + + + + = 1 4 2 3 3 2 4 1 5 0 5 Of what general identity is this a special case? Solution: Obviously every hand has at least zero aces, so the number of hands with at least zero aces is 52 . But we could also work it out as 5 in part (c), by dividing into the cases of no aces, one ace, two aces, three aces, and four aces, and these would give rise to the terms of the sum on the right-hand side. This proves the equality. The same argument shows the general identity: X k n − n1 n1 n , = k − k k k 1 1 k =0 1 for all 0 ≤ n1 ≤ n and k ≥ 0 (notice that some of the terms on the right-hand side may be zero, if k1 > n1 or k − k1 > n − n1 ; the argument still works). 5. The 4 players in a bridge game (North, South, East, and West) are each dealt 13 cards from the same deck of 52. (a) How many possible deals are there (assuming that it matters who gets which cards)? Solution: A deal corresponds to a way of writing the set of all 52 cards in the deck as a disjoint union of four numbered subsets of size 13. These are counted by the multinomial coefficient 52! 52 39 26 52 = = . 13 13 13 13, 13, 13, 13 (13!)4 *(b) In how many of these deals do North and South end up with all the spades between them? Solution: The easiest way to count this is to imagine that you first remove all the spades from the deck, and then make 3 hands of 13 from the remaining 39 39 cards, in 13,13,13 ways. The first two of these three hands can then be given to East and West. The remaining hand can be mixed back with the 26 spades, and then those 26 cards divided between North and South in 13,13 ways. So the answer is 39! 26! 26 39 = . 13, 13, 13 13, 13 (13!)5 6. In this question you should use the Stirling numbers S(5, 2) = 15, S(5, 3) = 25, S(5, 4) = 10 computed in lectures. 3 (a) Count the surjective functions {1, 2, 3, 4, 5} → {1, 2, 3, 4}. Solution: By the result proved in lectures, the answer is 4! S(5, 4) = 24 × 10 = 240. (b) Count the ways of assigning five students to five tutors so that exactly one of the tutors is not assigned any students. Solution: There are 5 ways to choose which tutor gets no students, and having made this choice the number of ways is the same as the surjective functions counted in the previous part. So the answer is 5 × 240 = 1200. (c) Count the ways of assigning five students to four tutors so that at most two of the tutors are assigned students. Solution: If the number of tutors who are assigned students is 2, then there are 42 = 6 ways to choose which two, and then 2! × S(5, 2) = 30 ways to do the assignation. If only one tutor is assigned any students, there are 4 ways to choose which one, and then the assignation is automatically determined. So the answer is 6 × 30 + 4 = 184. (d) Write n5 as a linear combination of binomial coefficients nk . 5 X n 5 , we get k! S(5, k) Solution: Using the formula n = k k=1 n n n n n . + 120 + 240 + 150 + 30 n = 5 4 3 2 1 5 *7. The Bell number B(n) is defined to be the total numberPof partitions of the set {1, 2, · · · , n} (or any set with n elements). Thus B(n) = nk=0 S(n, k). Prove the following recurrence relation for the Bell numbers: n X n−1 B(n − i), for all n ≥ 1. B(n) = i−1 i=1 (Hint: say that the first step in constructing a partition of {1, 2, · · · , n} is to choose the block containing n.) Solution: To construct a partition of the set {1, 2, · · · , n}, we can first choose the block containing n, and then all that remains is to choose a partition of the complement of that block. The size i of the block containing n can be anything from 1 to n, and for each specified i the block can be chosen in n−1 ways (since i−1 we know it contains the element n, so we only need to choose i − 1 of the remaining n − 1 elements). The complement then has size n − i, so there are B(n − i) ways to choose a partition of it. The desired equation follows. *8. Suppose that m, k ∈ N with m ≥ k. Prove that the number of surjective functions f : {1, 2, · · · , m} → {1, 2, · · · , k} equals X m . m1 , m2 , · · · , mk m ,m ,··· ,m ≥1 1 2 k m1 +m2 +···+mk =m 4 How many terms are there in this sum? Solution: A surjective function f : {1, 2, · · · , m} → {1, 2, · · · , k} is completely determined by the preimages f −1 (1), f −1(2), · · · , f −1 (k), which are all nonempty, and of which {1, 2, · · · , m} is the disjoint union. If the size of f −1 (i) is mi , then we must have mi ≥ 1 and m1 + m2 + · · · + mk = m. Having fixed the sizes of the preimages, the number of ways of choosing them is by definition the multinomial coefficient m1 ,m2m,··· ,mk . So we get the formula in the question. The problem with this formula is that the number of terms in the sum is too large for it to be of any practical use. Choosing the mi ’s is equivalent to choosing the ni ’s where ni = mi −1; these are nonnegative integers which add up to m − k. We saw in lectures that the number of ways of choosing a k-tuple of nonnegative integers which add up to n is n+k−1 , so the number of terms in our sum is m−1 . k−1 k−1 **9. Prove the formula k 1 X i k (k − i)n (−1) S(n, k) = i k! i=0 by induction on n, using the recurrence relation for the Stirling numbers. Solution: When n = 0, the left-hand side is 1 if k = 0 and 0 otherwise. The right-hand side is k k 1 X 1 X 1 0 i k i k (k − i) = = (1 + (−1))k , (−1) (−1) i i k! i=0 k! i=0 k! which is obviously also 1 if k = 0 and 0 otherwise. Now assume that n ≥ 1, and that the formula for S(n − 1, k) holds. The recurrence relation then gives S(n, k) = S(n − 1, k − 1) + k S(n − 1, k) k−1 k X k X 1 n−1 i k−1 i k (k − i − 1) + (k − i)n−1 (−1) (−1) = i i (k − 1)! i=0 k! i=0 # " k k X X k 1 k − 1 (k − i)n−1 (k − i)n−1 + (−1)i = (−1)i−1 i i−1 (k − 1)! i=1 i=0 k X 1 k−1 k (k − i)n−1 = − (−1)i i−1 i (k − 1)! i=0 k X 1 i k−1 (k − i)n−1 . = (−1) i (k − 1)! i=0 To derive the claimed formula only use k−i and complete the induction step, wenneedn(i) k the fact that k−1 = , which follows easily from the formula = . Note i k i i i! that the result can also be obtained from the Inclusion/Exclusion count of surjective functions given in lectures, since the number of surjective functions {1, 2, · · · , n} → {1, 2, · · · , k} is k! S(n, k). 5