Dr. Timo de Wolff Institute of Mathematics www.math.tamu.edu/~dewolff/Spring16/math302.html MATH 302 – Discrete Mathematics – Section 501 Midterm 2 Preparation Homework Spring 2016 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. Let 1 Z := {..., −2, −1.5, −1, −0.5, 0, 0.5, 1, 1.5, 2, ...} = 2 3 2 1 0 1 2 3 ..., − , − , − , , , , , ... . 2 2 2 2 2 2 2 denote the set of half integers. Recall that an injective function is also called 1-to-1. More generally, for k ∈ N a function f : S → T is called k-to-1 if for every t ∈ T there exist exactly k elements s1 , . . . , sk such that f (s1 ) = f (s2 ) = · · · = f (sk ) = t. Show that the function 1 f : Z \ {0} → Z \ {0}, 2 x 7→ ⌊x⌋ is 2-to-1. Exercise 4. 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. 1 Exercise 5. 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 6. 1. Find solutions to the following recurrence relations and initial conditions (without proof ): (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 7. 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. Hint: You may use statements like Cantor’s diagonal arguments from the lecture. Exercise 8. Let fj denote the Fibonacci numbers. Prove by mathematical induction that for all n ∈ N∗ it holds: f1 + f3 + · · · + f2n−1 = f2n . Exercise 9. Prove by mathematical induction that for all n ∈ N it holds: n5 − n is divisible by 5. You may use that (k + 1)5 = k 5 + 5k 4 + 10k 3 + 10k 2 + 5k + 1. Exercise 10. Recall that for a number r ∈ N∗ we define rZ := {z ∈ Z : ∃x ∈ Z : z = r·x}. 2 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 11. 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 k j k j |w|+1 , |w| · StringAlgo w 1, return StringAlgo w |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. 3