Dr. Timo de Wolff Institute of Mathematics www.math.tamu.edu/~dewolff/Fall14/math302.html MATH 302 – Discrete Mathematics – Section 501 Midterm 2 Preparation Homework Fall 2014 Exercise 1. Compute the following sets: 1. ({3, 6, 4, 1} \ {2, 3, 6}) ∪ ({8, 1, 3} ∩ {1, 2.5, 8}) 2. ({x ∈ N : x is prime } ∩ {x ∈ Z : x is even }) ∪ {7, 9, 10} 3. {x ∈ N : ∃z ∈ N : x = 3z} ∩ {x ∈ N : ∃z ∈ N : x = 2z} ∩ {x ∈ N : ∃z ∈ N : x = 5z} Exercise 2. Prove the de Morgan law Ac ∩ B c = (A ∪ B)c . Exercise 3. Prove or disprove the following statements: 1. If a function f : S → T is injective and a function g : T → U is not injective, then g ◦ f cannot be injective. 2. If a function f : S → T is surjective and a function g : T → U is not injective, then g ◦ f cannot be injective. Exercise 4. Let f1 : R → R and f2 : R → R be functions such that f1 is strictly monotonically increasing and f2 is strictly monotonically decreasing. Let f : R → R be defined piecewise via ( f1 (x) for x ≤ 0, x 7→ f2 (x) for x > 0. 1. Show f is piecewise injective, namely f is injective on the subsets (−∞, 0] and (0, ∞) of the domain R of f . 2. Is f also injective? Prove or disprove. Exercise 5. 1. Find solutions to the following recurrence relations and initial conditions (without proof ): 1 (a) an := 3an−1 , a0 := 2 (b) an := an−1 + n, a0 := 1 (c) an := 2an−1 − 1, a0 := 1 2. Compute the following sums: P4 (a) j=1 j! P3 P3 k2 (b) k=0 j! j=1 Exercise 6. Prove the following statements: 1. The set of all closed intervals of finite length over the real numbers is not countable. √ 2. The set {x : x is rational or of the form p · 5 with p prime} is countable. Exercise 7. Let fj denote the Fibonacci numbers. Prove by mathematical induction that for all n ∈ N∗ holds: f1 + f3 + · · · + f2n−1 = f2n . Exercise 8. Recall that for a number r ∈ N∗ we define rZ := {z ∈ Z : ∃x ∈ Z : z = r · x}. 1. Prove that for every r ∈ N∗ and n ∈ N∗ holds: r n Z ⊆ rZ. 2. Show: p ∈ N∗ is in rZ if and only if r is a divisor of p. Exercise 9. For a string w (over some given alphabet) let |w| denote its length and for every 1 ≤ i, j ≤ |w| let w(i, j) denote the substring given by the i-th, (i + 1)-st,. . .,j-th character in w. For two strings w1 and w2 we denote by w1 · w2 its concatenation. Investigate the following pseudocode: Input: A string w. Output: A string w ′. begin if |w| = 1 then return w else j k j k |w|+1 return StringAlgo w |w| , |w| · StringAlgo w 1, 2 2 Algorithm 1: StringAlgo 1. Compute StringAlgo(“Hase”), StringAlgo(“Rabbit”) and StringAlgo(“Halloween”). Describe in own words, what the algorithm does. 2. Show via strong induction: StringAlgo is injective. 2