Midterm Examination for Discrete Mathematics 姓名:_______________ 學號:________________ 2009/12/01 成績:____________ 1 (39 pts) (a) The coefficient of x9 in (2-x)19 is ______________. (b) 0 ≤ k ≤ 1000 (-1)k3k 21000-k = ________________. (c) There are _______ non-negative integer solutions to the equations x1 +x2 + x3 + x4 = 17. (d) There are _______ integer solutions to the equations x1 +x2 + x3 + x4 ≤ 17, where x1≥ -4, x2 ≥ 2, x3≥ 7 and x4 ≥ 0. (e) gcd(500, 284) = _______ = ____x 500 + ____ x 284. (f) The next 3-combination of {3,5,6} in lexicographical order in the set {1,2,3,4,5,6} is ___________________. (g) The next permutation of 634215 is ___________. (h) Let A = p1 (p2 (p3 (p4 (p5 p6))))) be a propositional formula. Then there are _______ rows in the truth table for A in which it is true. (i) There are _____ functions from {1,2,..,10} to {1,…,12}, among which _________ functions are increasing and _____ are strictly increasing. 2 [10 pts] Which of the following statements are true: (a). 2x2+ 100x = O(x3). (b). Every day has 24 hours only if there are two Sundays in a week. (c). xy P(x,y) yx P(x,y) is a valid sentence (d). If n ≥ m≥ 0, then P(n,m) = C(n,m) x m!. (e). ~( p /\ q) and (p ~q) are logically equivalent. 3 [10pts] Translate the following sentences into logical expressions using predicates, quantifiers and logical connectives. (a). John likes Mary. [3pts] (b). Every student in the class owns a car. [3pts] (c). x is a composite number if it is a product of two other numbers. [4pts] 1 4. (6 pts) Identify the error line (or lines) and give your reason in the following supposed proof of x (P(x)/\Q(x) ) from the premise xP(x) /\ xQ(x). 1. 2. 3. 4. 5. 6. 7. Ans: xP(x) /\ xQ(x) xP(x) P(c) xQ(x) Q(c) P(c)/\Q(c) x (P(x)/\Q(x) ) Premise Simplification from (1). Existential Instantiation from (2) Simplification from (1) Existential Instantiation from (4) conjunction from (3),(5) Existential generalization from (6) Line ___________ is(are) incorrect since _______________________________________________________________ 5. [20pts] Let m1,m2,…,mk ( k > 1) be a sequence of k positive numbers such that gcd(mi,mj) = 1 for all 1 ≤ i < j ≤ k. Suppose we have found k numbers: x1,x2,…,xk such that for each 1≤ i ≤ k, xi is a solution of the system of congruence equations: xi 1 (mod mi) and xi 0 (mod mj) for 1≤ j ≤ k and j i. (a). Show that for the system of congruences: x a1 (mod m1), x a2 (mod m2),…,x ak (mod mk), where a1,…,ak are k integers, x = 1≤ t ≤ k at xt is a solution. Now let m1,m2,m3 be 11,21 and 31,respectively and a1 a2 and a3 are 5, 7 and 14. You are now asked to apply the above theorem to solve the system of congruence equations: 2 x 5 (mod 11), x 9 (mod 21) and x 14 (mod 31) (b). What is the corresponding x1 ,x2 and x3 in the range [0, 11*21*31-1]. [6pts] (c). Find the unique solution x of the above congruences in the range [0, 11*21*31-1]. [6pts] 6. (25 pts) Let PV={p,q,r,…} be a nonempty set of logical variables and OP = {/\, ~ } is a set of two logical connectives. The set W of well-formed logical formulas (abbreviated wff) is a set of strings whose symbols come from the alphabet PV OP {(,)}, and is defined inductively as follows: Basis : If p ∈ PV is a logical variable, then p ∈W is a wff. Closure: If A and B are two wffs, then so are (A/\B) and ~A. 3 (a) Find 3 wffs which are not logical variables and do not appear in this sheet. [3pts] (b) Assume p, q and r are logical variables. Explain why (p /\ ~ (q/\ p)) is a wff while (p /\ q /\ r) is not. [6pts] (c) Define a recursive function f: Wff N such that f(A) is the number of occurrences of logical variables appearing in A. So, for instance, if A is (p /\ ~ (q/\p)), then f(A) = 3 since A uses two copies of logical variables p and one logical variable q. [4pts] (d) Similarly define the function g : Wff N recursively such that g(A) is the number of occurrences of logical connectives used in A. So, for example, if A is (p /\ ~ (q/\ p)), then g(A) = 3 ( since A uses two ‘/\’ and one ‘~’). [4pts] 4 (e) Prove by structural induction that for all wff A, f(A) g(A) + 1. [8pts] 7. [10 pts] Show that there exists a onto mapping from N to N2 (=def {(a,b) | a,b ∈ N}). Hence the set N2 is countable. 5