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
Yuncong Chen Assignment HW3 due 04/20/2014 at 11:59pm PDT CSE21 Spring2014 allowed at most 1. Let’s pass give each girl one red jellybean so that we only have 6 left to distribute. Now, we must break the problem into the different possibilities: 1. (3 pts) REMEMBER that you can use C(n,k) or P(n,k) as functions in your answer. 1. The 6 jellybeans are distributed to all 4 girls (and none go to the boys) 2. 5 jellybeans go to the 4 girls, and 1 goes to one boy 3. 4 jellybeans go to the 4 girls, and 2 go to two boys (the boys can have at most one) 4. 3 jellybeans go to the 4 girls, and 3 go to the three boys How many ways are there to distribute 10 red jellybeans and 8 blue jellybeans to 4 girls and 3 boys if: ◦ There are no restrictions? We do not have anymore cases because we cannot give 4 beans to 3 boys, since they are allowed at most one jellybean. Now let’s find the number of distributions for each case: ◦ Everyone gets at least one red jellybean? 1. This isvery similar to the previous problems. There are 6+4−1 ways to distribute 6 jellybeans among 4 girls. 4−1 2. Now we have 5 jellybeans for the girls. There are 5+4−1 4−1 ways to distribute them. However, we still need to give one of theboys a jellybean. Since there are three boys, 3 there are 31 ways to do this. Thus, there are 5+4−1 4−1 1 possibilities for this case. 3. This case can be calculated very similarly to case 2. This time, there are only 4 beans for the 4 girls, and we need to choose two 3boys to give the last two beans to. This gives us 4+4−1 4−1 2 ways to distribute 4 beans among the girls and 2 beans among the boys. 4. This last case is also similar to case 2. There are 3+4−1 3 3+4−1 = ways to distribute 3 jellybeans to 4 4−1 3 4−1 girls, and 3 boys to three boys such that each boy can only receive one bean. ◦ Every girl gets exactly two blue jellybeans and at least one red jellybean, and every boy gets at most one red jellybean and at most one blue jellybean. SOLUTION: (a) The number of ways to distribute all the jellybeans is the number of ways to distribute the red jellybeans times the number of ways to distribute the blue jellybeans. Once the problem is separated this way, we can think stars and bars. To distribute the red jellybeans, consider the 10 jellybeans to be 10 starsthat must be distributed among 7 people (6 bars). This is 10+7−1 . We can 7−1 do the same thing for blue jellybeans: 8+7−1 . So, the number 7−1 10+7−1 8+7−1 of ways to distribute all the jellybeans is 7−1 · 7−1 . Since these cases are disjoint, we can add them together to get the total number of ways to distribute the jellybeans with the given constraints: 6+4−1 5+4−1 3 4+4−1 3 3+4−1 + + + 4−1 4−1 1 4−1 2 4−1 (b) This can be solved the same way as above, though we need to modify the number of ways to distribute the red jellybeans. Each girl and boy must get at least one, so give each of them one red jellybean. This leaves us with 3 red jellybeans that need to be distributed to the 7 people. This means that there are 3+7−1 7−1 ways to distribute the red jellybeans, making the totalnumber 8+7−1 of ways to distribute all the jellybeans 3+7−1 7−1 · 7−1 . Correct Answers: • C(10+7-1,7-1)*C(8+7-1,7-1) • C(3+7-1,7-1) * C(8+7-1, 7-1) • C(6+4-1, 4-1) + C(5+4-1,4-1)C(3,1) + C(4+4-1,4-1)C(3,2) + 2. (1 pt) Let A and B be events with P(A) = 17 , P(B) = 12 , and P((A ∪ B)c ) = 37 . What is P(A ∩ B)? (c) The first thing to recognize is that each of the four girls must have exactly 2 blue jellybeans. This means that there are no blue jellybeans to distribute among the boys, and there is only one way to give each girl exactly 2 blue jellybeans. So, we will ignore the blue jellybeans for the rest of this problem. For the red jellybeans, each girl must receive at least 1, and each boy is 1 SOLUTION: 4. (2 pts) (a) What is the coefficient of x2 y3 in the expansion of (2x−3y)5 ? P(A ∪ B) = P(A) + P(B) − P(A ∩ B) This can be rewritten as: (b) What is the coefficient of xy2 z3 in the expansion of (x + 2y + 3z)6 ? P(A ∩ B) = P(A) + P(B) − P(A ∪ B) Recall that P(A ∪ B) = 1 − P((A ∪ B)C ) so: P(A ∩ B) = P(A) + P(B) − (1 − P((A ∪ B)C )) So plug in the given probabilities: P(A ∩ B) = SOLUTION: 1 1 3 + − (1 − ) 7 2 7 (a) Theorem 8 in your book, the Binomial Theorem, states: n Correct Answers: (x + y)n = • [1]/7 + 1/2 - (1-[3]/[7]) 3. (2 pts) n ∑ k xn−k yk k=0 We can use this equation to find the coefficient we need. n = 5, since the expression is (2x − 3y)5 , and k = 3 since we are looking for x2 y3 . So, the term when n = 5 and k = 3 is 5 5! 5−3 · 22 x2 · (−3)3 y3 = (10 · 4 · −27)x2 y3 = (−3y)3 = 3!2! 3 (2x) −1080 · x2 y3 . 5 light bulbs are chosen at random from 16 bulbs of which 6 are defective. (a) What is the probability that exactly 2 are defective? (b) For (x + 2y + 3z)6 we first need to derive a formula. We can do this by using the Binomial Theorem twice: (b) What is the probability that at most 1 is defective? (x + y + z)n = (x + w)n where w = y + z n = ∑ k=0 SOLUTION: n = ∑ (a) The probability that exactly 2 bulbs are defective is the number of ways to count exactly 2 defective bulbs divided by the number of ways to count 5 bulbs. When we count bulbs, we do not care about the order. This means that the number of ways to count 5 bulbs is 16 5 . The number of ways to count exactly 6 10 2 defective bulbs is 2 3 because there are 6 defective bulbs, so there are 62 ways to count them, and there are 10 working bulbs, and we need to count 3 of them. So the probability of (6)(10) finding exactly 2 defective bulbs is 2 16 3 . (5) k=0 n = ∑[ k=0 n n n−k k w k x n n−k (y + z)k k x n n−k k x k = ∑ ∑ k=0 j=0 n k = ∑ ∑ k=0 j=0 (b) The probability to count at most 1 defective bulb is the probability to count exactly 1 defective bulb plus the probability to count 0 defective bulbs. Each probability can be solved like in (a). So, the final answer is (61)(104) (60)(105) + 16 (165) (5) n k = ∑ ∑ k=0 j=0 n k = ∑ ∑ k=0 j=0 k ∑ j=0 k k− j j z j y n k n−k k− j j y z k j x k! n! n−k yk− j z j (n−k)!k! (k− j)! j! x n! n−k yk− j z j (n−k)!(k− j)! j! x n−k k− j j n y z (n−k),(k− j), j x Correct Answers: Now that we have a formula, we can find the coefficient of • (C([6],2) C([16-6],[5-2]))/C([16], [5]) • C([6],1)C([16-6],[5-1])/C([16],[5]) + C([6], 0) C([16-6], xy2 z3 in[5])/C([16],[5]) (x + 2y + 3z)6 . n = 6, n − k = 1, k − j = 2, and j = 3. 2 6 So, the term we are looking for is 1,2,3 (1x)1 (2y)2 (3z)3 = 6! 2 2 3 3 2 3 2 3 1!2!3! x2 y 3 z = (60 · 4 · 27)xy z = 6480 · xy z . (a) There is exactly one arrangement - (1,2,3,4,5,6,7,8,9) (b) We do this by counting those arrangements that have ai ≤ ai+1 except, perhaps, for i = 5. Then we subtract off those that also have a5 < a6 . In set terms: ◦ S is the set of rearrangements for which a1 < a2 < a3 < a4 < a5 and a6 < a7 < a8 < a9 , ◦ T is the set of rearrangements for which a1 < a2 < a3 < a4 < a5 < a6 < a7 < a8 < a9 , and ◦ we want |S \ T | = |S| − |T |. Correct Answers: • C(5,3)2ˆ(5-3)(-3)ˆ3 • 6!/(1!2!3!)*2ˆ2*3ˆ3 5. (1 pt) A rook on a chessboard attacks its own square, and every square in the same column or row on the board. Given an 8 x 8 chessboard with all 64 squares distinguished (columns a-h, rows 1-8), if 8 rooks are placed onto 8 random squares, what is the probability that they are mutually non-attacking (that is, no rook attacks another)? An arrangement in S is completely determined by specifying the set {a1 , · · · , a5 }, of which there are C(9,5)=126. In (a), we saw that |T|=1. Thus the answer is 126-1=125. Correct Answers: • 1 • 125 SOLUTION: 7. (6 pts) Since rooks are not distinguished, the total number of configurations of 8 rooks is C(64,8). You draw 9 cards at random, one at a time WITH replacement, from an ordinary 52-card deck. Now we want to count the number of choices of squares for rooks that are non-attacking. In any configuration of non-attacking rooks, there can be at most one rook per row (rank). In addition, since rooks can attack along columns (files), the column of rooks in each row must be different. Thus we can imagine enumerating every configuration of nonattacking rooks by originally placing rooks along the diagonal of the board, then permuting the rows of the board. There are 8! ways that rows of a chessboard can be permuted, thus 8! non-attacking rook configurations. (a) What is the probability that no Ace appears in any of the draws? (b) What is the probability that at least one King appears? (c) What is the probability that at least 2 Queens appear? So the probability is 8!/C(64,8). Correct Answers: • 8!/C(64,8) 6. (2 pts) Now, answer the same three questions assuming that the 9 cards are drawn at random WITHOUT replacement. Consider all possible 9-lists (a1 , a2 , . . . , a9 ) without repetition that can be made from the 9-set {1,2,3,4,5,6,7,8,9}. For example, (9,2,4,5,6,1,3,7,8) is one such list. (a) How many have the property that ai < ai+1 for all i ≤ 8? (d) What is the probability that no Ace appears in any of the draws? (e) What is the probability that at least one King appears? (b) How many have the property that ai < ai+1 for all i ≤ 8 except i = 5? (f) What is the probability that at least 2 Queens appear? SOLUTION: 3 SOLUTION: (a) Suppose that, among the initial 5 cards, exactly three cards are of the same suit. The player decides to keep these three cards, and replaces the other two cards. (a) To compute probability of no Ace, we need to find the total number of 9-card hands and the number of 9-card hands without an Ace. The number of ways to draw ten cards with replacement is 529 and the number of ways to draw 9 cards with replacement 9 and not pull in Ace is 489 . Thus P(no Ace) = 48 . 529 What is the probability of her ending up with a flush? (b) The number of ways to draw 9 cards with replacement and draw at least one king is the same as using the complement and subtracting the number of hands without kings from the number of possible hands. So, the probability to draw at least one king 9 9 9 = 1 − 48 . is 52 52−48 9 529 (b) Suppose that, among the initial 5 cards, there is exactly one pair (e.g., 8♥, 8♣) and one “kicker” (e.g., A♠). The player decides to keep the pair and the kicker, and replaces the other two cards. (c) For this problem we do the same as part b, but we also must subtract the number of ways to draw exactly 1 Queen. The number of ways to draw exactly one Queen is 4 · 488 · 9, since there are 4 Queens to draw from, and 10 places to draw as the Queen. So, the probability to draw at least 2 Queens is 9 8 529 −489 −4·9·488 = 1 − 48 − 4·9·48 . 529 529 529 What is the probability of her ending up with: ◦ 3 of a kind? (note: this means exactly 3-of-a-kind, not including those that can also fall in a higher category. The same goes for the following two questions) ◦ 2 pair? If without replacement, the total number of 9-card hands is C(52, 9). All answers below are counts for the specific event. To get the probability of the event, simply divide the count by the total number, C(52, 9). ◦ full house? (d) There are C(48, 9) 9-card hands that do not contain Ace. (e) This is the total number of 9-card hands minus those that do not contain King. The count is C(52, 9) −C(48, 9). SOLUTION: (f) Similar to (e), except that we also need to remove those hands that have exactly one Queen. There are C(4, 1) ·C(48, 8) hands of this kind. So the count is C(52, 9) −C(48, 9) −C(4, 1) · C(48, 8). (a) Suppose the suit of the three cards is spade. The total number of ways to choose 2 cards from the deck of remaining cards is C(52 − 5, 2). Out of these, there are C(13 − 3, 2) cases where both cards are spade. So the probability of ending up with a flush is C(13 − 3, 2)/C(52 − 5, 2). Correct Answers: • • • • • • 48ˆ[9]/52ˆ[9] (52ˆ[9] - 48ˆ[9])/(52ˆ[9]) (52ˆ[9] - 48ˆ[9] - 4*[9]*48ˆ[9-1])/(52ˆ[9]) C(48,[9])/C(52,[9]) (C(52,[9])-C(48,[9]))/C(52,[9]) (C(52,[9])-C(48,[9])-C(4,1)*C(48,[9-1]))/C(52,[9]) 8. (4 pts) In 5-card draw poker, a player receives an initial hand of 5 cards, and is then allowed to replace up to three of her cards with the remaining cards in the deck. (b) Suppose the rank of the pair is 8, and the kicker is Ace. To end up with a three-of-a-kind, the two newly-drawn must contain exactly one 8 and no Ace. The probability of this is 2 · (52 − 5 − 2 − 3)/C(52 − 5, 2). (c) To end up with a two pair, either she draws exactly one Ace and no 8, or she draws exactly a pair that are neither Ace or 8. Of the former, there are 3·(52−5−2−3) cases. Of the latter, there are (13 − 2) ·C(4, 2) cases. Finally, you must remove the 6 pairs that used the two cards you threw away. The probability is therefore, (3 · (52 − 5 − 2 − 3) + (13 − 2) ·C(4, 2) − 6)/C(52 − 5, 2) (d) To end up with a full house, either she draws (8,A), or she draws (A,A). There is 2 · 3 = 6 cases for the former, and 4 C(3, 2) cases for the latter. The probability is therefore, (2 · 3 + C(3, 2))/C(52 − 5, 2) 10. (1 pt) Correct Answers: • • • • A bin contains 8 Red marbles and 6 Blue marbles. 4 marbles are randomly drawn without replacement. After that, one more marble is drawn. C(13-3,2)/C(52-5,2) 2 * (52-5-2-3) / C(52-5,2) (3 * (52-5-2-3)+(13-2)*C(4,2) - 6 )/C(52-5,2) (2 * 3 + C(3,2))/C(52-5,2) What is the probability that this last marble drawn is Red? 9. (1 pt) In seven-card games (7-card stud, Texas Hold-em) you make the best five-card hand possible out of seven available cards. SOLUTION: How many combinations of seven cards contain a full house as the best five-card hand? Simple solution: We are not given the results of the 4 randomly drawn marbles, so we can answer this question as though the 4 marbles were drawn with replacement. Since there are 8 red marbles, and a total of 8 + 6 = 14 marbles, the probability that the last marble 8 drawn is red is 14 . SOLUTION: With 7 cards, a full house may be constructed in 1 of 3 ways: Alternate solution: ◦ 1 triple, 1 pair and 2 kickers If the above solution is unsatisfactory, we can calculate this using the many cases: ◦ Draw 4 red marbles + 0 blue marbles, then draw a red marble: For this problem, we do not care about the order of the first 4 marbles, we only care how many of each color were drawn, and how many ways we can choose the number of marbles of each color. The number of ways to choose 4 of 8 red marbles is 8 and the number of ways to choose 0 of 6 blue mar4 bles is 60 . So, the number of ways to choose 4 red marbles and 0 blue marbles is 84 60 . Lastly, we need to account for the number of ways to draw the fifth marble as red. Since there were 8 marbles, and we already pulled out 4, there are 4 marbles left, or 41 ways to choose the last marble as red. This makes the total number of ways for this case: The triple may be 1 of 13 ranks, and by definition 3 of the 4 of that rank are chosen. The pair may be 1 of the remaining 12 ranks, and (again, by definition) 2 of the 4 of that rank are chosen. The ranks of the 2 kickers are chosen from the remaining 11 ranks, and 1 of the 4 of each rank are chosen. Thus, the total number of full houses in this form is: C(13, 1)C(4, 3)C(12, 1)C(4, 2)C(11, 2)C(4, 1)2 = 3, 294, 720 ◦ 1 triple and 2 pairs The triple is chosen the same way as before, the ranks of the two pairs are chosen from the remaining 12 ranks, and the 2 of the 4 of each rank are chosen as usual. Thus, the total number of full houses in this form is: C(13, 1)C(4, 3)C(12, 2)C(4, 2)2 = 123, 552 8 6 4 4 0 1 ◦ Draw 3 red marbles + 1 blue marbles, then draw a red marble: 8 6 5 3 1 1 ◦ Draw 2 red marbles + 2 blue marbles, then draw a red marble: 8 6 6 2 2 1 ◦ Draw 1 red marbles + 3 blue marbles, then draw a red marble: ◦ 2 triples and 1 kicker The ranks of both triples are chosen from the 13, then the rank of the kicker is chosen from the remaining 11 ranks. Thus, the total number of full houses in this form is: C(13, 2)C(4, 3)2C(11, 1)C(4, 1) = 54, 912 Thus, the total number of full houses is 3, 473, 184: Correct Answers: • 3473184 5 8 6 7 1 3 1 ◦ Draw 0 red marbles + 4 blue marbles, then draw a red marble: 8 6 8 0 4 1 So the total number of ways to choose 4 marbles, and then choose a red marble is: 8 6 4 8 6 5 + 4 0 1 3 1 1 probability of drawing a white marble in the second draw. There are 4 white marbles, but now the total number of marbles in the 4 jar is 8 + 4 + 2 = 14, making this second probability 14 . So, the probability of drawing a red marble in the first draw and then 4 9 × 14 . drawing a white marble in the second draw is 15 (b)) The process for this question is very similar to part a. The 4 probability of drawing white on the first draw is 15 and the probability of drawing white on the second draw, assuming that it 3 . Thus, the probability of drawwas white in the first draw is 14 ing a white marble in the first draw and then a white marble in 4 3 the second draw is 15 × 14 . 8 6 6 8 6 7 8 6 8 + + + 2 2 1 1 3 1 0 4 1 (c)) For yellow not to be drawn at all, then either red or white need to be drawn on the first draw, and then we need to draw either red or white on the second draw. Since there are 9 + 4 = 13 red or white marbles, and there are a total of 9 + 4 + 2 = 15 marbles in the jar, the probability of not drawing a yellow marble in the first draw is 13 15 . Assuming that we drew red or white on the first draw, then there are 13 − 1 = 12 red or white marbles left in the jar, and a total of 14 marbles left in the jar. So, the probability of not drawing yellow in the second draw is 12 14 , making 13 12 the probability of not drawing yellow at all to be 15 × 14 . = 280 + 1680 + 2520 + 1120 + 120 = 5720 Lastly, we need to divide this total by the number of ways to randomly choose 4 marbles and then draw a fifth one. The number of ways to draw 4 of 14 marbles is 14 . Then, there are 10 4 marbles left to choose the last marble, or 10 1 ways. So, the total 14 10 number of ways is 4 1 = 10010. Correct Answers: So, the probability to choose a red marble on the fifth draw is: 8 5720 10010 = 14 • (9/15) * (4/14) • (4/15)*(3/14) • (13/15)*(12/14) Correct Answers: • 8/14 12. (2 pts) 11. (3 pts) (a) How many one-to-one (i.e., injective) maps are there from the set {1, 2, 3, 4} to {a, b, c, d, e, f}? Two marbles are drawn randomly one after the other, WITHOUT replacement, from a jar that contains 9 red marbles, 4 white marbles, and 2 yellow marbles. Find the probability of the following events: (b) How many onto (i.e., surjective) maps are there from {a, b, c, d, e, f} to {1, 2, 3, 4}? (a) A red marble is drawn rst followed by a white marble. (b) A white marble is drawn rst followed by a white marble. SOLUTION: (a) A map f : A → B is one-to-one if f(x) = f(y) implies that x = y. In other words, every element in A must be mapped to a unique element in B. If A = {1, 2, 3, 4} and B = {a, b, c, d, e, f}, then we want to find the number of ways we can map the four elements in A to 4 of the 6 elements in B. There are 6 ways ways to map the first element, then 5 for the second, 4 for the third, and lastly 3 for the fourth. This gives us a total of 6 · 5 · 4 · 3 = 360 mappings. (c) A yellow marble is not drawn at all. SOLUTION: (a) First we need to find the probability of drawing a red marble in the first draw. There are 9 red marbles and 9 + 4 + 2 = 15 9 marbles total in the jar, giving us a probability of 15 . Assuming we drew a red marble in the first draw, now we need to find the (b) A map f : A → B is onto if for b ∈ B, there exists a ∈ A such that f(a) = b. In other words, every element in B must be mapped to at least once. So, if A = {a, b, c, d, e, f} and B = 6 {1, 2, 3, 4}, then we need to find how many ways we can map the 6 elements in A to the 4 elements in B. One way to think of this is to count all the ways we can break up the 6 elements into 4 groups, and then assign the groups to an element of B. As can be read about in your book, the number of ways to break up 6 elements into 4 groups is S(6, 4). Since this only gives us 4 sets, we also need to calculate the number of ways we can assign the elements of B to the 4 sets: 4!. Thus, the total number of mappings is S(6, 4) · 4! = 65 · 4!. Correct Answers: • 360 • 65*4! c Generated by WeBWorK, http://webwork.maa.org, Mathematical Association of America 7