Discrete Mathematics Summer 03 Midterm Solutions 1. In each of these tables, the last column contains the truth-value of the given expression. If this column contains all T, then the expression is a tautology. If it contains all F, then it is a contradiction. Otherwise, it is neither. (p~q) (q ~p) NEITHER p F F T T q F T F T ~p T T F F ~q T F T F p~q F F T F q~p T T T F (p~q) (q ~p) F F T F p V q V r V ~p TAUTOLOGY p F F F F T T T T q F F T T F F T T r F T F T F T F T ~p T T T T F F F F p V q V r V ~p T T T T T T T T (pq) V (~pV(p~q)) TAUTOLOGY p F F T T q F T F T pq F F F T ~p T T F F ~q T F T F p~q F F T F (~pV(p~q) T T T F (pq) V (~pV(p~q)) T T T T (pq) (p~q) ~p NEITHER p F q F ~p T ~q T pq T p~q T (pq) (p~q) ~p T Discrete Mathematics F T T T F T T F F F T F Summer 03 T F T T T F T F F 2. “ If my car is in the repair shop, then I cannot get to class”. Let A = “my car is in the repair shop” B = “I cannot get to class” (1) (2) (3) (4) (5) statement: A B negation: A ^ ~B contrapositive: ~B ~A inverse: ~A ~B converse: B A (1) and (3) are equivalent. (4) and (5) are equivalent. 3. Critical rows – where the premises are all – are shown in dark gray. The argument is valid if there are no critical rows where the conclusion is false. pq Hence : ~p V q p F F T T q F T F T Premise pq T F F T Conclusion ~pVq T T F T Valid. pq qr ~p Hence: ~r p F F F F T T Q F F T T F F r F T F T F T pq T T T T F F Premises qr T T F T T T ~p T T T T F F Conclusion ~r T F T F T F Discrete Mathematics T T T T F T Summer 03 T T F T F F T F Invalid. 2nd and 3rd critical rows have false conclusion. r~r Hence: ~r Premise r~r F T r T F Conclusion ~r F T Valid. pVq r>~r Hence: p q p F F F F T T T T q F F T T F F T T R F T F T F T F T ~r T F T F T F T F PVq F F T T T T T T Premises r~r F F F F F F F F Conclusion pq F F F F F F T T Valid. (There are no critical rows in which the conclusion is false because there are no critical rows at all) 4. (1) x y, x>y (2) x y, x>y The first statement says that for any x, there exists a smaller y. The second statement says that there exists an x which is larger than all y. Note that the second statement can never be true, because it implies that x > x. If the variables range over the integers, then the first is true and the second is false. Discrete Mathematics Summer 03 If the variables range over the positive integers, then neither is true. The first statement is false, because when x = 1, there is no smaller positive integer y. Negations: (1) x y, x <= y (2) x y, x<= y 5. De Morgan’s laws: (1) ~(pq) = ~p V ~q (2) ~(pVq)= ~p ~q 6. Prove: Product of 2 odd integers is odd. Let a , b be any two odd integers. This means that a = 2k+1 and b = 2m+1 for some integers m, k. Then the product a*b = (2k+1)*(2m+1) = 4km+2k+2m+1 = 2(2km+k+m) +1 Hence, a*b is odd. Prove by induction: Every positive integer is either even or odd. Base Case: The smallest positive integer is 1. 1 is odd since 1 = 2*0+1. Inductive Hypothesis: Any positive integer k is either even or odd. Show that the integer k+1 is either even or odd. Inductive Step: According to the inductive hypothesis, the integer k is either even or odd. Case1: k is even. I.e., k = 2m for some integer m. Hence k+1 = 2m+1. Therefore, by definition of odd, k+1 is odd. Case2: k is odd. I.e., k=2m+1 for some integer m. Hence k+1 = 2m+2. Therefore, by definition of even, k+1 is even. Prove using the quotient remainder theoren: Every positive integer is either even or odd. Discrete Mathematics Summer 03 The theorem that for any integer n and positive integer d, there are unique integers q,r such that n = qd+r and 0r<d. Let d=2. Then this case of the theorem states that any integer n can be written as n=2q+r, where r=0 or 1. If r=0, then n=2q, and hence n is even. If r=1, then n=2q+1, and so n is odd. Hence n is either odd or even. 7. Statement: There is no smallest positive rational number. Proof: For a contradiction, suppose the opposite, i.e., that there exists a smallest positive rational number, call it R. Since R is rational, we can write it as a/b, for positive integers a,b. Let R’ = a/(2b). R’ is also a ratio of integers, and hence rational. It is easy to show that R’ < R. But this contradicts our assertion that R is the smallest rational number. 8. Statement: For all integers a, x, and y, if a | xy then a | x or a | y. This statement is false. A counter example is a=12, x=3, y=4. 12 | 3*4, but neither 12 | 3 nor 12 | 4. 9. 504 = 23*32*7. 10. gcd(48, 20) = gcd(20, 8); since 48 = 2*20+8. gcd(20, 8) = gcd( 8, 4); since 20 = 2*8 + 4. gcd(8, 4) = gcd(4, 0); since 8 = 2*4+0. Therefore, gcd(48, 20) = gcd(4, 0) = 4. gcd(p2q3, p3q2) = p2q2. lcm(p2q3, p3q2) = p3q3. Extra Credit: lcm(a,b)*gcd(a,b) = a*b. Discrete Mathematics Summer 03