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
Math 1165 Discrete Math Final Exam December 15, 2005 Your name It is important that you show your work. The total value of this test is 260 points. 1. (15 points) For each sequence of integers below, determine whether the sequence is the degree sequence for a (simple) graph. If it is not, tell why not, and if it is, find a graph that has such a degree sequence. (a) 7 6 5 4 1 1 1 1 1 Solution: No, because the sum of the sequence is an odd number. (b) 7 6 5 4 2 2 2 2 1 1 Solution: (c) 10 6 5 4 2 1 1 1 1 1 Solution: No, because the largest degree a vertex in a simple graph can have is one less than the number of vertices. 2. (15 points) Euler graphs and Hamilton graphs. Recall that a graph is called Eulerian if there is a circuit that used each edge exactly once. Its called Hamiltonian if there is a cycle (ie, a circuit that does not revisit any vertex) that contains all the vertices. (a) Give an example of a graph which is Eulerian but not Hamiltonian. •....... . . ...... ......•. ... ............. ............ ... .. .. Solution: .. .. ......•..... ... ............... ............. ... . ...•. •... (b) Give an example of a graph which is Hamiltonian but not Eulerian. Solution: 1 • • • • • • Math 1165 Discrete Math Final Exam 3. (40 points) Let S = {3, 4, 5, 6, 7, 8, 9}. Let D denote the set of all four-digit numbers that can be built using the elements of S as digits and allowing repetition of digits. (a) Find the number of four element subsets of S Solution: C47 = 35 subsets with four elements. (b) How many subsets of S have at least three elements? Solution: C37 +C47 +C57 +C67 +C77 = 35+35+21+7+1 = 99 subsets with at least elements. On the other hand, there are just 1 + 7 + 21 subsets with size at most 2. (c) How many subsets of S have an odd number of members? Solution: Exactly half have an odd number of members. 27 ÷ 2 = 26 = 64. (d) What is |D|? In other words, how many four-digit numbers can be written using only the digits 3,4,5,6,7,8, and 9? Solution: This is sampling with repetition and order matters. Therefore there are E47 = 74 = 2401. (e) How many elements of D have four different digits? Solution: This is sampling without repetition and order matters. Therefore there are P47 = 7!/(7 − 4)! = 840. (f) How many elements of D have exactly three different digits? Solution: There must be two of one digit and one of two others. So, pick the duplicated digit in one of 7 ways, then pick the other two digits in 6 4 = 15 ways. Then select two locations for the duplicated digit =6 2 2 ways, and finally select one of the two orders for the other two digits: 7 · 15 · 6 · 2 = 1260. (g) How many even numbers belong to D? Solution: 3 · 73 = 1029. 2 Math 1165 Discrete Math Final Exam 4. (20 points) Solve the Instant Insanity game shown below. In the nets at the bottom, list the colors which show in the positions determined by your solution. B R B B R B W G G R W B B R G G B W R W B W R W CUBE 1 CUBE 2 CUBE 3 CUBE 4 X CUBE 1 X X CUBE 2 X X CUBE 3 X X CUBE 4 X Solution: First build the composite graph. Then find two target subgraphs. The loop at Blue on cube 1 is not usable, but the loop at White on cube 4 is usable. One target graph is a triangle with vertices B, G, and R and the White loop. The other is a cycle that looks like a square when the vertices are arranged in alphabetical order as we did in class. I used the square as the front-back solution and the other target as the left-right solution. X B R G W X X R W B G X X G G R B X X W B W R X CUBE 1 CUBE 2 CUBE 3 CUBE 4 3 Math 1165 Discrete Math Final Exam 5. (15 points) Consider the equation x + y + z = 11, where x, y, and z are integers. Recall that a solution is an ordered triple (x, y, z). Thus (2, 3, 6) 6= (3, 2, 6). (a) How many solutions are there if x, y, and z are required to be positive? Solution: There are 10 gaps and we need to fill two of them: 10 2 = 45. (b) How many solutions are there if x, y, and z are required to be nonnegative? Solution: 13 = 78. 2 (c) How many solutions are there if y and z are required to be nonnegative and x ≥ 2? Solution: Replace x with u+2 and we have the equation u+2+y+z = 11, which is just u + y + z = 9, but with the condition that all three variables are nonnegative. This can be solved in 11 = 55 ways. Alternatively, 2 subtract from 78 the number of solutions for which x = 0 (12) and the number for which x = 1 (11) to get 78 − 12 − 11 = 55. 6. (15 points) Imagine that the 3 × 7 grid of squares below represents the streets of a part of the city where you live. You must walk 10 blocks to get from the lower left corner at A to the upper right corner at B. (a) How many different 10-block walks are there? Solution: Each path can be coded as an 10 letter string, each letter of which is an u(for up) or an r(for right). There are 10 = 220 such strings. 3 (b) How many 10 block walks avoid the terrible corner marked with the bullet? Solution: Notice that there are 62 · 52 = 15 · 10 = 150 ways to GO THROUGH the terrible corner, so the must be 330 − 150 = 180 ways to avoid it. B • A 4 Math 1165 Discrete Math Final Exam 7. (15 points) An 8 × 10 grid of squares with one shaded square is given. .......... ..... (a) How many different squares are bounded by the gridlines? Solution: This is just 10·8+9·7+8·6+7·5+6·4+5·3+4·2+3·1 = 276 . (b) How many different rectangles are bounded by the gridlines? Solution: The idea we discussed in class of choosing the top and bottom 9 boundaries in 2 = 36 ways and the left and right boundaries in 11 = 2 55 ways for a total of 36 · 55 = 1980. (c) How many different rectangles bounded by the gridlines contain the shaded square? Solution: There are just two ways to pick the lower boundary and two ways to pick the left boundary. There are 9 ways to pick the right boundary and 7 ways to pick the top boundary. Their product is 252. 8. (10 points) How many elements are in the union of four sets if each of the sets has 100 elements, each pair of sets share 50 elements, each triple of sets shares 25 elements and there are 5 elements in all four sets? Solution: Let the sets be A, B, C, and D. Then | A ∪ B ∪ C ∪ D |=| A | + | B | + | C | + | D | − | A∩B | − | A∩C | − | A∩D | − | B∩C | − | B∩D | − | C∩D | + | A∩B∩C | + | A∩B∩C | + | A ∩ B ∩ D | + | A ∩ C ∩ D | + | B ∩ C ∩ D | − | A ∩ B ∩ C ∩ D |= 100+100+100+100−50−50−50−50−50−50+25+25+25+25−5 = 195. 5 Math 1165 Discrete Math Final Exam 9. (15 points) Draw the 12-vertex knight’s graph GK(4, 3) so that no two edges cross each other. This is the graph we used to solve the 4×3 knight interchange problem. Solution: The graph is the one we derived in class, 3• 8• •1 4• • 11 •6 9• 2• •7 10• 5• •12 Part b. Is the graph GK(4, 3) Hamiltonian? Solution: No, by trial and error. Part c. Is the graph GK(4, 3) Eulerian? Solution: No, because it has vertices of odd degree. 6 Math 1165 Discrete Math Final Exam 10. (15 points) Prove that 1 + 3 + 32 + · · · + 3n = 3n+1 − 1 2 for n = 0, 1, 2, . . . . Solution: The proof is by mathematical induction. Base case, n = 0. P (0) : 0+1 k+1 1 = 3 2 −1 = 1. Check. Next assume P (k) : 1 + 3 + 32 + · · · + 3k = 3 2 −1 . k+1 Then the left side of P (k + 1) is 1 + 3 + 32 + · · · + 3k + 3k+1 = 3 2 −1 + 3k+1 = k+1 k+1 k+2 3k+1 −1 + 2·32 = 3·3 2 −1 = 3 2 −1 , which is the right side of P (k +1). Thus, by 2 the Principle of Mathematical Induction, P (n) is true for all integers n ≥ 0. 7 Math 1165 Discrete Math Final Exam 11. (15 points) Use the Euclidean algorithm to solve the decanting problem for decanters of sizes 219 and 177. In other words, find integers x and y such that gcd(219, 177) = 219x + 177y. Solution: Repeated division gets 219 = 1·177+42; 177 = 4·42+9; 42 = 9·4+6 and 9 = 1 · 6 + 3. Unwinding this, we have 3 = = = = = = = = 9−6 9 − (42 − 4 · 9) 9 − 42 + 4 · 9 5 · 9 − 1 · 42 5(177 − 4 · 42) − 42 5 · 177 − 21 · (219 − 177) 5 · 177 − 21 · 219 + 21 · 177 26 · 177 − 21 · 219 so x = −21 and y = 26. 12. (15 points) Find the base 4 and base −4 representation of each of the numbers below. (a) 217 Solution: Repeated division yields 217 = 4 · 54 + 1; 54 = 4 · 13 + 2; 13 = 4·3+1; and 3 = 4·0+1, so the base four representation of 217 is 31214 . To get the base −4 representation, repeatedly divide by −4. You should get 217 = −4·(−54)+1; −54 = −4·14+2; 14 = −4·(−3)+2; −3 = −4·1+1; and 1 = −4 · 0 + 1, so the base −4 representation is 11221−4 . (b) 36.75 Solution: Again use repeated division to find the base 4 representation of 36 and repeated multiplication to find the base 4 representation of 0.75. Thus 36.75 = 210.34 . The base −4 representation is a bit harder. First multiply the number by 10−4 = 16 to get 588. Find the base −4 representation of 588. 588 = 23123−4 . Now divide both sides by 16 to get 36.75 = 231.23−4 . 8 Math 1165 Discrete Math Final Exam 13. (20 points) Consider the following game. Two positive integers a and b are written on a board. The first player Al subtracts the smaller from the larger and writes that difference on the board. The second player Betty selects two numbers on the board and writes down the difference between the larger and the smaller. The winner is the last player to write down a new number. (a) Play this game when a = 105 and b = 119. What numbers are written on the board at the end? Solution: Since 105 = 3·5·7 and 119 = 7·17, at the end of the game, we’ll see exactly the numbers 7, 14, 21, 27, 35, 42, 49, 56, 73, 70, 77, 84, 91, 98, and 105. (b) Would you rather be Al or Betty? Why? Solution: Since the number of new numbers written on the board is 17 − 2 = 15, Al is going to win. 14. (20 points) (a) Prove that the union of two symmetric relations on the set A is also symmetric. Solution: Let R and S be symmetric relations on the set A. To prove that R ∪ S is also symmetric, suppose xR ∪ Sy. Then xRy or xSy by the meaning of union. Since R and S are both symmetric, it follows that yRx or ySx. But this is just what is needed to prove that yR ∪ Sx. Thus R ∪ S is symmetric. (b) Prove that the union of two transitive relations need not be transitive. Solution: Let S = {1, 2, 3, 4}. The relation R = {(1, 2)} is transitive and so it S = {(2, 3)}, but R ∪ S is not. 9 Math 1165 Discrete Math Final Exam 15. (15 points) Let S = {1, 2, 3, 4}. (a) Find a relation on S with 6 ordered pairs that is symmetric and not transitive. Solution: S = {(1, 2), (2, 1), (1, 3), (3, 1), (2, 3), (3, 2)} is symmetric but not transitive. (b) Find a relation on S with 5 ordered pairs that is antisymmetric and not transitive. Solution: S = {(1, 1), (2, 2), (3, 3), (3, 1), (2, 3), } is antisymmetric but not transitive. (c) Find a relation on S with 7 ordered pairs that is transitive and not reflexive. Solution: S = {(1, 1), (2, 2), (3, 3), (3, 1), (2, 3), (2, 1), (4, 1)} 10