Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination III (Spring 2007) Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B. The statement is false. The following is a counterexample. A = {1}, B = {a, b, c, d}, C = {x, y} and D = {p, q}. Here, A B = {(1, a), (1, b), (1, c), (1, d)} and A B = 4. Note that C = D = 2. Further, C D = {(x, p), (x, q), (y, p), (y, q)} and C D = 4. Thus, even though the conditions A B = C D and C = D hold, A B. Problem 2: Suppose A and B are subsets of a universal set U. Prove that A B if and only if B A. No credit will be given if you use Venn diagrams to prove this result. Part 1: We need to show that A B B A. In other words, under the assumption that A B, we need to show that for any x, the implication x B x A holds. Now, This completes the proof of Part 1. x B x B (Definition of set complement) x A (since A B) x A (Definition of set complement). Part 2: We need to show that B A A B. In other words, under the assumption that B A, we need to show that for any x, the implication x A x B holds. Now, x A x A (Definition of set complement) x B (since B A) x B (Definition of set complement). This completes the proof of Part 2 as well as that of the result. Problem 3: Recall that the NAND operator (denoted by ) is equivalent to AND followed by negation; that is, for any two propositions a and b, the propositional form (a b) is logically equivalent to (a b). Express the propositional form c (a b) using only the NAND operator. First note that, by the definition of NAND, c (a b) [c (a b)] Let X denote [c (a b)]. Thus, the given expression c (a b) X X X. Therefore, we can now focus on expressing X using only the NAND operator. Now, 1
X [c (a b)] [c ( a b)] (Implication rule) [c ( (a b)] (De Morgan s law) [c (a ( b))] (Definition of NAND) [c (a (b b))] (since b (b b)) Thus we have an expression for X using only the NAND operator. Since the given expression c (a b) is equivalent to X X, we have [c (a b)] [c (a (b b))] [c (a (b b))]. Problem 4: Specify a predicate P (x, y) over the set of integers so that all the following conditions are satisfied: x y P (x, y) is false, x y P (x, y) is false and y x P (x, y) is true. Your answer should clearly specify a predicate P (x, y) and explain why the predicate satisfies all the three conditions. Let P (x, y) denote the predicate x = y 2, where x and y take on integer values. (a) The proposition x y P (x, y) is false, since for x = 5, there is no integer y such that 5 = y 2. (b) The proposition x y P (x, y) is also false. To see this, consider two y values, say y = 1 and y = 2. There is no x value that satisfies both the equations x = 1 2 and x = 2 2. (c) The proposition y x P (x, y) is true since for any given value of y, we can choose x to be y 2 to satisfy the equation x = y 2. Problem 5: Let X be a set with 8 elements. How many binary relations on X are either reflexive or symmetric or both? Show work. You need not simplify your answer. To solve this problem, we use the fact that each binary relation on a set with n elements can be represented by an n n Boolean matrix. Let B 1 denote the set of all binary relations over X that are reflexive and let B 2 denote the set of all binary relations over X that are symmetric. Thus, the required answer = B 1 B 2. From the inclusion-exclusion formula, we have B 1 B 2 = B 1 + B 2 B 1 B 2. We now show how each of the cardinality values on the right side of the above equation can be computed. (a) B 1 is the number of reflexive binary relations on X. As mentioned above, any binary relation on X can be represented by an 8 8 Boolean matrix, which has 64 entries. Of these, all the 8 main diagonal entries must be 1, since the relation is reflexive. There are two choices for each of the remaining 56 entries. Hence, B 1 = 2 56. (b) B 2 is the number of binary relations on X that are symmetric. Again, any binary relation on X is represented by an 8 8 Boolean matrix with 64 entries. Of these, 8 are along the main diagonal, 28 are above the main diagonal and 28 are below the main diagonal. When the relation is symmetric, once we choose a 0 or 1 value for each entry above the diagonal, all the entries 2
below the diagonal are determined. Also, there are two choices for each of the 8 entries along the diagonal. Hence, we have two choices for each of the 28+8 = 36 entries which are at or above the main diagonal, but only one choice for each entry below the diagonal. Therefore, B 2 = 2 36. (c) B 1 B 2 is the number of binary relations on A that are both reflexive and symmetric. Here, we have two choices for each of the 28 entries above the diagonal, but only one choice for each of the other entries. In other words, B 1 B 2 = 2 28. Now, using the inclusion-exclusion formula above, the required answer is 2 56 + 2 36 2 28. Problem 6: Let A = {x, y, z}. Specify a binary relation R on A such that R is not transitive but the symmetric closure of R is transitive. Your answer should clearly specify the relation R and and explain why R is not transitive but the symmetric closure of R is transitive. Consider the binary relation R on A defined by R = {(x, x), (y, y), (z, z), (x, y), (y, z), (z, x)}. Now, R is not transitive since (x, y) R, (y, z) R but (x, z) R. Recall that for any binary relation R, the symmetric closure R of R is given by R = R R 1 where R 1, the converse of R, is the relation obtained by flipping each pair in R. Thus, for the relation R above, R 1 = {(x, x), (y, y), (z, z), (y, x), (z, y), (x, z)}. Therefore, R = R R 1 = {(x, x), (y, y), (z, z), (x, y), (y, z), (z, x), (y, x), (z, y), (x, z)}. Note that R = A A; that is, R contains every possible ordered pair that can be formed from the three elements x, y and z. Thus, R is transitive. ( x Problem 7: Find the coefficient of x 2 5 in the expansion of 2 + 3 ) 10 x 3. Show work. You need not simplify your answer. Suppose the term x 2 occurs as the i th term in the expansion. In that term, the factor involving x is [(x 5 ) i ] [(x 3 ) 10 i ] = x 5i x 3(10 i) = x 8i 30. Since we want the exponent of x to be 2, we have the equation for which the solution is i = 4. 8i 30 = 2 By the Binomial Theorem, the 4th term of the above expansion is Therefore, the coefficient of x 2 is C(10, 4) 3 6 /2 4. C(10, 4) ( 1/2) 4 3 6 x 2. Problem 8: Find the number of solutions to the equation x 1 + x 2 + x 3 + x 4 + x 5 = 74 where x 1, x 2 and x 3 are nonnegative integers, x 4 is an integer satisfying the condition x 4 15 and x 5 is an integer satisfying the condition 0 x 5 < 4. Show work. You need not simplify your answer. 3
In this problem, we will use the fact that the number of solutions to the equation z 1 + z 2 +... + z r = q where z 1, z 2,..., z r and q are all non-negative integers, is = C(q + r 1, r 1). To solve the given problem, first define a new variable y 4 = x 4 15. Since x 4 15, we have y 4 0. Substituting for x 4 in terms of y 4 in the given equation, we get x 1 + x 2 + x 3 + y 4 + x 5 = 74 15 = 59 (1) Let N 1 denote the number of solutions to Equation (1) where each of the variables is a non-negative integer. Using the formula mentioned above, N 1 = C(59 + 5 1, 5 1) = C(63, 4). In some of these solutions, x 5 satisfies the condition x 5 < 4 while in others, x 5 4. So, if we find the number of solutions, say N 2, where x 5 4, then the required solution to the problem is N 1 N 2. To find N 2, we proceed in a manner similar to that of N 1. Define a new variable y 5 = x 5 4. Thus, when x 5 4, y 5 0. We substitute for x 5 using y 5 in Equation (1) to get the new equation x 1 + x 2 + x 3 + y 4 + y 5 = 59 4 = 55 (2) The number of solutions N 2 to Equation (2) where each variable is a non-negative integer is = C(55 + 5 1, 5 1) = C(59, 4). Therefore, the required answer is N 1 N 2 = C(63, 4) C(59, 4). Problem 9: Suppose A = {x, y, z, w} and B = {1, 2, 3, 4, 5}. How many functions from A to B are not one-to-one? Since A = 4 and B = 5, the total number of functions from A to B = 5 4 = 625. If N denotes the number of one-to-one functions from A to B, then the required answer is 625 N. We can find the value of N as follows. In constructing a one-to-one functions from A to B, there are 5 choices for x, 4 choices for y, 3 choices for z and 2 choices for w. Thus, N, the number of one-to-one functions from A to B = 5 4 3 2 = 120. Hence, the number of functions from A to B that are not one-to-one = 625 120 = 505. Problem 10: Let R denote the set of real numbers. Consider the function f on R R defined by f(x, y) = (x + y, 2x 3y). (a) Is f one-to-one? Justify your answer. (b) Is f onto? Justify your answer. Part (a): Yes, f is one-to-one. To prove this, we will show that if f(x, y) = f(x, y ) then x = x and y = y. Since f(x, y) = f(x, y ), we have the two equations x + y = x + y 2x 3y = 2x 3y 4
If we multiply the first equation by 2 and subtract the result from the second equation, we get 5y = 5y from which we conclude that y = y. This result in conjunction with the equation x + y = x + y implies that x = x. Thus, f is one-to-one. Part (b): Yes, f is onto. To prove this, we need to show that for any pair (a, b) R R, there is a pair (x, y) R R such that f(x, y) = (a, b). This can be shown as follows. From the definition of f, the equation f(x, y) = (a, b) leads to the two equations x + y = a and 2x 3y = b. The solution to these linear equations is x = (3a + b)/5 and y = (2a b)/5. This completes the proof that f is an onto function. Problem 11: Use induction to prove that for all integers n 0, n 3 + (n + 1) 3 + (n + 2) 3 is divisible by 9. Basis: n = 0. When n = 0, n 3 + (n + 1) 3 + (n + 2) 3 = 0 3 + 1 3 + 2 3 = 9, which is divisible by 9. So, the basis is true. Induction Hypothesis: Assume that for some integer k 0, k 3 + (k + 1) 3 + (k + 2) 3 is divisible by 9. To prove: (k + 1) 3 + (k + 2) 3 + (k + 3) 3 is divisible by 9. Proof: By the inductive hypothesis, k 3 + (k + 1) 3 + (k + 2) 3 is divisible by 9; that is, k 3 + (k + 1) 3 + (k + 2) 3 = 9t (3) for some integer t. Now, (k + 1) 3 + (k + 2) 3 + (k + 3) 3 = (k + 1) 3 + (k + 2) 3 + k 3 + 9k 2 + 27k + 27 (Expansion of (k + 3) 3 ) = [k 3 + (k + 1) 3 + (k + 2) 3 ] + 9[k 2 + 3k + 3] (Rearrangement of terms) = 9t + 9[k 2 + 3k + 3] (By Equation (3)) = 9[t + k 2 + 3k + 3] The last step above shows that (k + 1) 3 + (k + 2) 3 + (k + 3) 3 is divisible by 9, and this completes the proof. 5
Problem 12: Let S = {1, 2, 3, 4, 5, 6, 7, 8, 9}. Prove that every subset of S with 6 or more elements must contain two numbers whose difference is equal to 5. Proof: Let A = {x 1, x 2,... x r } be any subset of S with 6 or more elements. We must show that there are two elements in A whose difference is equal to 5. Partition S into the following five subsets: S 1 = {1, 6}, S 2 = {2, 7}, S 3 = {3, 8}, S 4 = {4, 9} and S 5 = {5}. Note that in each of the sets S 1 through S 4, the difference between the two elements in the set is exactly 5. Consider the function that assigns each element x i of A to the unique set among S 1 through S 5 which contains x i. Since the elements of A are distinct, at most one element of A can be assigned to S 5. The remaining five or more elements of A must be assigned to the four sets S 1 through S 4. By the pigeon hole principle, at least two elements of A, say x i and x j, must be assigned to the same set S k, for some k {1, 2, 3, 4}. Thus, the difference between the elements x i and x j in A is equal to 5, and this completes the proof. 6