THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DISCRETE MATHMATICS DISCUSSION ECOM 2011 Eng. Huda M. Dawoud December, 2015
Section 1: Mathematical Induction 3. Let P(n) be the statement that 1 2 + 2 2 + +n 2 = n(n + 1)(2n + 1)/ for the positive integer n. a) What is the statement P(1)? b) Show that P(1) is true, completing the basis step of the proof. c) What is the inductive hypothesis? d) What do you need to prove in the inductive step?
e) Complete the inductive step, identifying where you use the inductive hypothesis. f) Explain why these steps show that this formula is true whenever n is a positive integer. a) P(1) is the statement: 1 2 = 1 2 3/. b) 1 2 = 1 1 2 3/ = / = 1 both sides equal 1, so the statement P(1) is true. c) The inductive hypothesis is the statement that 1 2 + 2 2 +... + k 2 = k(k + 1)(2k + 1). d) For the inductive step, we want to show for each k 1 that P(k) implies P(k + 1). In other words, we want to show that assuming the inductive hypothesis P(k): 1 2 + 2 2 +... + k 2 = can show P(k+1): 1 2 + 2 2 +... + k 2 + (k + 1) 2 = k(k + 1)(2k + 1), we (k + 1)(k + 2)(2(k + 1) + 1). e) If we add (k + 1) 2 to both sides in the inductive step: 1 2 + 2 2 +... + k 2 k(k + 1)(2k + 1) = 1 2 + 2 2 +... + k 2 + (k + 1) 2 k(k + 1)(2k + 1) = + (k + 1) 2 Remember we want to show P(k+1) in part d: 1 2 + 2 2 + + k 2 + (k + 1) 2 = = k(k + 1)(2k + 1)+(k+1)2 (k + 1)[k(2k + 1)+(k+1)] = (k + 1)[2k2 +7k+]
= = (k + 1)(k + 2)+(2k+3)] (k + 1)(k + 2)+(2(k+1)+1)] f) In part b we have completed the basis step and In part e we have completed the inductive step, so by the principle of mathematical induction, the statement is true for every positive integer n. 5. Prove that 1 2 + 3 2 + 5 2 + +(2n + 1) 2 = (n + 1)(2n + 1)(2n + 3)/3 whenever n is a nonnegative integer. Basis Step: P (0): (2 0 +1) 2 = (0+1) (2 0+1)(2 0+3)/3 1 = 1 P(0) is true Inductive Step: Inductive hypothesis: assume that P(k) is true for an arbitrary fixed integer k 0 1 2 + 3 2 + 5 2 + +(2k + 1) 2 = (k + 1)(2k + 1)(2k + 3)/3 We want to prove P(k+1): 1 2 + 3 2 + 5 2 + +(2k + 1) 2 +(2(k+1) + 1) 2 = ((k+1) + 1)(2(k+1) + 1)(2(k+1) + 3)/3 1 2 + 3 2 + 5 2 + +(2k + 1) 2 +(2k + 3) 2 = (k + 2)(2k + 3)(2k + 5)/3 Starting from the assumption of P(k) and adding (2k + 3) 2 to both sides 1 2 + 3 2 + 5 2 + +(2k + 1) 2 + (2k + 3) 2 = (k + 1)(2k + 1)(2k + 3)/3 +(2k + 3) 2 = (k + 1)(2k + 1)(2k + 3)+ 3(2k + 3) 2 /3
= (2k+3)[(k + 1)(2k + 1)+3(2k + 3)] /3 = (2k+3)[2k 2 + 9k + 10] /3 = (2k+3)(k + 2)(2k + 5)/3 By mathematical induction, P(n) is true for all integers n with n 0 21. Prove that 2 n > n 2 if n is an integer greater than 4. Basis Step: 2 5 > 5 2 32 > 25 Inductive Step: Inductive hypothesis: assume that P(k) is true for an arbitrary fixed integer k 5 2 k > k 2 We want to prove P(k+1) 2 k+1 > (k+1) 2 2 2 k > (k+1) 2 From the right hand side (k+1) 2 = k 2 + 2k + 1 < k 2 + 2k + k < k 2 + 3k < k 2 + 3k (since k >3) < k 2 + k 2 < k 2 + k 2 < 2 k 2 (and from the Inductive hypothesis) 2 k 2 < 2 2 k
Section 3: Recursive Definitions and Structural Induction. Determine whether each of these proposed definitions is a valid recursive definition of a function f from the set of nonnegative integers to the set of integers. If f is well defined, find a formula for f (n) when n is a nonnegative integer and prove that your formula is valid. a) f (0) = 1, f (n) = f (n 1) for n 1 c) f (0) = 0, f (1) = 1, f (n) = 2f (n + 1) for n 2 a) This is valid recursive definition, since we are provided with the value at n = 0 and each subsequent value is determined by the previous one. f (n) = f (n 1) f (n) = { -1, 1, -1, } for n 1 So we can write it as f (n) = (-1) n for n 1 To prove that it is a valid formula by induction, that f (n) = f (n 1) = (- 1) n for n 1 Basis Step: f (1) = f (0) = (-1) 1 -(1) = -1 Inductive Step inductive hypothesis: f (k) = f (k) = (-1) k for k 1 We want to prove f (k+1) = f (k+1-1) = (-1) k+1 from the inductive hypothesis. f (k+1) = f (k) = (-1) k+1 = (-1) k (-1) 1 = -(-1) k f (k) = (-1) k
c) This is invalid. We are told that f(2) is defined in terms of f(3), but f(3) has not been defined. 8. Give a recursive definition of the sequence {an}, n = 1, 2, 3,... if a) an = 4n 2. b) an = 1 + ( 1) n a) We can write the first 5 elements and then try to notice a recursive definition a1 = 4(1) -2 = 2 a2 = 4(2) -2 = = 2 + 4 a3 = 4(3) -2 = 10 = + 4 a4 = 4(4) -2 = 14= 10 + 4 a5 = 4(5) -2 = 18= 14 + 4 As we notice, an element is equal the an-1 + 4 b) a1 = 1 + (-1) 1 = 0 a2 = 1 + (-1) 2 = 2 a3 = 1 + (-1) 3 = 0 a4 = 1 + (-1) 4 = 2 a5 = 1 + (-1) 5 = 0 As we notice, a1 and a2 repeats so if we take them as basis we can write that an = an-2
Section 4: Recursive Algorithms 7. Give a recursive algorithm for computing nx whenever n is a positive integer and x is an integer, using just addition. As we know we can represent the multiplication process nx as a n repeated summation of x. procedure product(n: positive integer; x: integer) if n = 1 then return x else return product(n - 1, x) + x To understand how the previous procedure works, look at the following tracing: P1 Let s call the procedure to calculate 4 5 product(4,5) if 4 = 1 then return 5 else return product(3, 5) + 5 P2 P4 retruns 5 to P3 P3 returns 5 + 5 to P2 P2 returns 5 + 5 + 5 to P1 P1 returns 5 + 5 + 5 + 5 if 3 = 1 then return 5 else return product(2, 5) + 5 P3 P1 calls P2 and wait for it to return the result P2 calls P3 and wait for it to return the result P3 calls P4 and wait for it to return the result if 2 = 1 then return 5 else return product(2, 5) + 5 P4 if 1 = 1 then return 5 else return product(0, 5) + 5 Now P1 after waiting the results will return 5 + 5 + 5 + 5 Now you know how recursive algorithms works :D, Try to solve some other problems on it by yourself.