1 Advanced Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.

Slides:



Advertisements
Similar presentations
Mathematical Induction
Advertisements

Lecture 2 Based on Chapter 1, Weiss. Mathematical Foundation Series and summation: ……. N = N(N+1)/2 (arithmetic series) 1 + r+ r 2 + r 3 +………r.
5/5/20151 Analysis of Algorithms Lecture 6&7: Master theorem and substitution method.
MA/CSSE 473/474 How (not) to do an induction proof.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
1 Quantifiers Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Induction Sections 41. and 4.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
1 Intro to Logic Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Induction Sections 4.1 and 4.2 of Rosen Fall 2010
1 Intro to Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Inverses and GCDs Supplementary Notes Prepared by Raymond Wong
TR1413: INTRO TO DISCRETE MATHEMATICS LECTURE 2: MATHEMATICAL INDUCTION.
1 Inference Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
CSE115/ENGR160 Discrete Mathematics 03/22/12 Ming-Hsuan Yang UC Merced 1.
1 Solutions to Recurrences Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
1 Recursion, Recurrences and Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Recurrences Part 3. Recursive Algorithms Recurrences are useful for analyzing recursive algorithms Recurrence – an equation or inequality that describes.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Induction and Recursion by: Mohsin tahir (GL) Numan-ul-haq Waqas akram Rao arslan Ali asghar.
What it is? Why is it a legitimate proof method? How to use it?
Mathematical Maxims and Minims, 1988
Lecture 9. Arithmetic and geometric series and mathematical induction
Chapter 6 Mathematical Induction
Analysis of Algorithms
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
1 Inclusion-Exclusion Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Mathematical Induction
Discrete Maths Objective to introduce mathematical induction through examples , Semester 2, Mathematical Induction 1.
MCA 202: Discrete Mathematics Instructor Neelima Gupta
Discrete Mathematics Tutorial 11 Chin
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 2: Basic Proving Techniques.
Discrete Maths: Induction/1 1 Discrete Maths Objective – –to introduce mathematical induction through examples , Semester
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
8.4 Mathematical Induction
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
Proof By Contradiction Chapter 3 Indirect Argument Contradiction Theorems and pg. 171.
Induction & Recursion Weiss: ch 7.1. Recursion –a programming strategy for solving large problems –Think “divide and conquer” –Solve large problem by.
October 3, 2001CSE 373, Autumn Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1.
Solving Recurrences with the Substitution Method.
Divide and Conquer. Recall Divide the problem into a number of sub-problems that are smaller instances of the same problem. Conquer the sub-problems by.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Copyright © Cengage Learning. All rights reserved. Sequences and Series.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
Mathematical Induction I Lecture 5: Sep 20 (chapter of the textbook and chapter of the course notes)
Aids to Formulating and Answering Key Questions NameWhen to use u Construction Methodproving “there exists” u Choose Method proving “for every” u Math.
Section 2.2 More practice with Direct Proofs. Directions for Writing Proofs 1.Copy the statement of the theorem to be proved onto your paper. 2.Clearly.
5-5 Indirect Proof. Indirect Reasoning: all possibilities are considered and then all but one are proved false. The remaining possibility must be true.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Mathematical Induction What it is? Why is it a legitimate proof method? How to use it?
CS151: Mathematical Foundations of Computing Mathematical Induction.
Induction (chapter of the book and chapter of the notes)
11.7 – Proof by Mathematical Induction
MATH 224 – Discrete Mathematics
Advanced Algorithms Analysis and Design
CS201: Data Structures and Discrete Mathematics I
Section 2.1 Proof Techniques Introduce proof techniques:   o        Exhaustive Proof: to prove all possible cases, Only if it is about a.
Elementary Number Theory & Proofs
Sullivan Algebra and Trigonometry: Section 13.4
Induction Chapter
Advanced Analysis of Algorithms
Copyright © Cengage Learning. All rights reserved.
Mathematical Induction
Mathematical Induction
Presentation transcript:

1 Advanced Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

2 e.g.1 (Page 5) Let n be a non-negative power of 2. Suppose that T(n)  2T(n/2) + cn for some constant c. T(n) > 0 Prove that T(n) = O(n log n) Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n)

3 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n nn0n0 T(n) k. n log n How can we find the value for n 0 ? How can we find the value for k? The above equation can be proved by our traditional induction if we know the value for n 0 and k. How can we prove it?

4 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n log n……………..(*) ” We don ’ t know the base case. Thus, we need to test the “ smallest ” value of n for the base case. Consider P(1) RHS of (*) = k. 1 log 1 We want to see whether P(1) is true. (i.e., “T(1)  k. 1 log 1……………..(*)”) = k = 0 In other words, according to (*), we need to prove T(1)  0 Since T(n) > 0, we have T(1) > 0 We conclude that P(1) is false P(1) is false. Thus, it is not possible to prove that T(1)  0 Since we don ’ t want “ n = 1 ” to happen, I want that n is larger (e.g., n = 2, 2 2, … ) n 0  1 Since n > n 0, we have “ n 0  1 ”

5 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n log n……………..(*)” We don ’ t know the base case. Thus, we need to test the “ smallest ” value of n for the base case. Consider P(2) RHS of (*) = k. 2 log 2 We want to see whether P(2) is true. (i.e., “T(2)  k. 2 log 2……………..(*)”) = k = 2k In other words, according to (*), we need to prove T(2)  2k Currently, we don ’ t know the value of k. P(1) is false. P(2) is true. In order to prove T(2)  2k, we should set a value of k such that k  T(2)/2 k  T(2)/2 Thus, P(2) is true. n 0  1

6 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n log n……………..(*)” P(1) is false. P(2) is true. k  T(2)/2 We guess that P(2), P(2 2 ), P(2 3 ) … are also true. Thus, the base case is when n = 2. P(2) n 0  1

7 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n Suppose that n > n 0. Let P(n) be “T(n)  k. n log n……………..(*)” P(1) is false. P(2) is true. k  T(2)/2 Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 2. Step 2(a): Assume that P(n/2) is true for n > 2. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k. (n/2) log (n/2) Consider T(n) We want to show that T(n)  k. n log n n 0  1  2T(n/2) + cn  2. (k. (n/2) log (n/2)) + cn = k. n log (n/2) + cn = k. n log n – k. n log 2 + cn = k. n log n – kn + cn Currently, we don ’ t know the value of k. In order to prove T(n)  k. n log n, we should set a value of k such that – kn + cn  0 (i.e., k  c) Thus, P(n) is true. P(n) is true. k  c

8 e.g.1 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that T(n) = O(n log n) We want to prove that T(n) = O(n log n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n log n Suppose that n > n 0. Let P(n) be “T(n)  k. n log n……………..(*)” P(1) is false. P(2) is true. k  T(2)/2 Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 2. Step 2(a): Assume that P(n/2) is true for n > 2. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k. (n/2) log (n/2) We want to show that T(n)  k. n log n n 0  1 P(n) is true. k  c We prove that “ P(n/2)  P(n) ” is true for all n > 2 By Mathematical Induction,  n  2, T(n)  k. n log n We should set some values for n 0 and k. Since n 0  1, we set n 0 = 1. Since k  T(2)/2 and k  c, we set k = max{c, T(2)/2}

9 e.g.2 (Page 11) Consider a traditional induction proof. Let n be a non-negative power of 2. Suppose that T(n)  2T(n/2) + cn for some constant c. T(n) > 0 Prove that T(n) = O(n log n) Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that  n > 1, T(n)  k. n log n where k = max{c, T(2)/2}  n > 1, T(n)  k. n log n where k = max{c, T(2)/2}

10 e.g.2 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that  n > 1, T(n)  k. n log n where k = max{c, T(2)/2} Step 1: Prove that P(2) (i.e., the base case) is true. We want to show that “ T(2)  k. 2 log 2 where k = max{c, T(2)/2} ” Consider T(2)= T(2)/2. 2 (i.e., “T(2)  k. 2 where k = max{c, T(2)/2} ”)  k. 2 Thus, P(2) is true. (Since k = max{c, T(2)/2}, k  T(2)/2)

11 e.g.2 Let n be a non-negative power of 2. T(n)  2T(n/2) + cn T(n) > 0 Prove that  n > 1, T(n)  k. n log n where k = max{c, T(2)/2} Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 2. Step 2(a): Assume that P(n/2) is true for n > 2. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k. (n/2) log (n/2) Consider T(n) We want to show that T(n)  k. n log n  2T(n/2) + cn  2. (k. (n/2) log (n/2)) + cn = k. n log (n/2) + cn = k. n log n – k. n log 2 + cn = k. n log n – kn + cn  k. n log n (Since k = max{c, T(2)/2}, k  c and thus –kn + cn  0) Thus, P(n) is true. We prove that “ P(n/2)  P(n) ” is true for all n > 2 By Mathematical Induction,  n  2, T(n)  k. n log n

12 e.g.3 (Page 12) Traditional Induction Proof The values of n 0 and k are given Advanced Induction Proof The values of n 0 and k are to be found when we are proving. Advantage: We can use the original induction for the proof. Disadvantage: The values of n 0 and k look “ strange ”. We don ’ t know the reason why we have these “ strange ” values. Advantage: The values of n 0 and k are found during the proof. Thus, we know why the values of n 0 and k are generated. Disadvantage: It looks more complicated during the proof.

13 e.g.4 (Page 13) Let n be a non-negative power of 3. Suppose that T(n)  T(n/3) + cn for some constant c. T(n) > 0 Prove that T(n) = O(n) Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n)

14 e.g.4 We want to prove that T(n) = O(n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n nn0n0 T(n) k.nk.n How can we find the value for n 0 ? How can we find the value for k? The above equation can be proved by our traditional induction if we know the value for n 0 and k. How can we prove it? Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n)

15 e.g.4 We want to prove that T(n) = O(n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n ……………..(*)” We don ’ t know the base case. Thus, we need to test the “ smallest ” value of n for the base case. Consider P(1) RHS of (*) = k. 1 We want to see whether P(1) is true. (i.e., “T(1)  k. 1 ……………..(*)”) In other words, according to (*), we need to prove T(1)  k Currently, we don ’ t know the value of k. P(1) is true. In order to prove T(1)  k, we should set a value of k such that k  T(1) k  T(1) Thus, P(1) is true. I guess n can be 1, 3, 3 2, … Since n > n 0, we have “ n 0  0 ” n 0  0 Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n) = k

16 e.g.4 We want to prove that T(n) = O(n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n ……………..(*)” We guess that P(1), P(3 1 ), P(3 2 ) … are also true. Thus, the base case is when n = 1. P(1) P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n)

17 e.g.4 We want to prove that T(n) = O(n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n Suppose that n > n 0. Let P(n) be “T(n)  k. n ……………..(*)” Step 2: Prove that “ P(n/3)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/3) is true for n > 1. Step 2(b): According to P(n/3), we deduce that P(n) is true. That is, T(n/3)  k. (n/3) Consider T(n) We want to show that T(n)  k. n  T(n/3) + cn  k. (n/3) + cn = k. n + (c – 2k/3)n Currently, we don ’ t know the value of k. In order to prove T(n)  k. n, we should set a value of k such that c – 2k/3  0 (i.e., k  3c/2) Thus, P(n) is true. P(n) is true. k  3c/2 P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n) = k. n – 2kn/3 + cn

18 e.g.4 We want to prove that T(n) = O(n) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n Suppose that n > n 0. Let P(n) be “T(n)  k. n ……………..(*)” Step 2: Prove that “ P(n/3)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/3) is true for n > 1. Step 2(b): According to P(n/3), we deduce that P(n) is true. That is, T(n/3)  k. (n/3) We want to show that T(n)  k. n We prove that “ P(n/3)  P(n) ” is true for all n > 1 By Mathematical Induction,  n  1, T(n)  k. n We should set some values for n 0 and k. Since n 0  0, we set n 0 = 0. Since k  T(1) and k  3c/2, we set k = max{3c/2, T(1)} P(n) is true. k  3c/2 P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that T(n) = O(n)

19 e.g.5 (Page 15) Consider a traditional induction proof. Let n be a non-negative power of 3. Suppose that T(n)  T(n/3) + cn for some constant c. T(n) > 0 Prove that T(n) = O(n) Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that  n > 0, T(n)  k. n where k = max{3c/2, T(1)}  n > 0, T(n)  k. n where k = max{3c/2, T(1)}

20 e.g.5 Step 1: Prove that P(1) (i.e., the base case) is true. We want to show that “ T(1)  k. 1 where k = max{3c/2, T(1)} ” Consider T(1)= T(1). 1  k. 1 Thus, P(1) is true. Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that  n > 0, T(n)  k. n where k = max{3c/2, T(1)} (since k = max{3c/2, T(1)}, k  T(1))

21 e.g.5 Step 2: Prove that “ P(n/3)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/3) is true for n > 1. Step 2(b): According to P(n/3), we deduce that P(n) is true. That is, T(n/3)  k. (n/3) Consider T(n) We want to show that T(n)  k. n  T(n/3) + cn  k. (n/3) + cn = kn/3 + cn = kn – 2kn/3 + cn = kn + (c – 2k/3)n  kn (Since k = max{3c/2, T(1)}, k  3c/2 and thus c – 2k/3  0) Thus, P(n) is true. We prove that “ P(n/3)  P(n) ” is true for all n > 1 By Mathematical Induction,  n  1, T(n)  k. n Let n be a non-negative power of 3. T(n)  T(n/3) + cn T(n) > 0 Prove that  n > 0, T(n)  k. n where k = max{3c/2, T(1)}

22 e.g.6 (Page 16) Let n be a non-negative power of 2. Suppose that T(n)  4T(n/2) + cn for some positive constant c. T(n) > 0 Prove that T(n) = O(n 2 ) Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 )

23 e.g.6 We first show an “inappropriate” proof After that, we show an “appropriate” proof Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 )

24 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n 2 nn0n0 T(n) k.n2k.n2 How can we find the value for n 0 ? How can we find the value for k? The above equation can be proved by our traditional induction if we know the value for n 0 and k. How can we prove it? Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 )

25 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n 2 Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n 2 ……………..(*)” We don ’ t know the base case. Thus, we need to test the “ smallest ” value of n for the base case. Consider P(1) RHS of (*) = k. 1 2 We want to see whether P(1) is true. (i.e., “T(1)  k. 1 2 ……………..(*)”) In other words, according to (*), we need to prove T(1)  k Currently, we don ’ t know the value of k. P(1) is true. In order to prove T(1)  k, we should set a value of k such that k  T(1) k  T(1) Thus, P(1) is true. I guess n can be 1, 2, 2 2 … Since n > n 0, we have “ n 0  0 ” n 0  0 Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) = k

26 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n 2 Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k. n 2 ……………..(*)” We guess that P(1), P(2 1 ), P(2 2 ) … are also true. Thus, the base case is when n = 1. P(1) P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 )

27 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n 2 Suppose that n > n 0. Let P(n) be “T(n)  k. n 2 ……………..(*)” Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/2) is true for n > 1. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k. (n/2) 2 Consider T(n) We want to show that T(n)  k. n 2  4T(n/2) + cn  4. k. (n/2) 2 + cn = 4. k. n 2 /4 + cn In order to prove T(n)  k. n 2, we should have the following cn  0 The inequality “ cn  0 ” is impossible. P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) = k. n 2 + cn Note that c is positive and n is positive

28 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k  R such that  n > n 0, T(n)  k. n 2 Suppose that n > n 0. Let P(n) be “T(n)  k. n 2 ……………..(*)” The inequality “ cn  0 ” is impossible. P(1) is true. k  T(1) n 0  0 Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) Note that c is positive and n is positive What went wrong? Statement P(n) is too weak to be proved by induction. To fix this, let’s see if we can prove something that is actually stronger that we were originally trying to prove – namely T(n)  k 1. n 2 – k 2 n for some positive constants k 1 and k 2

29 e.g.6 Now, we show an “appropriate” proof.

30 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k 1, k 2  R such that  n > n 0, T(n)  k 1 n 2 – k 2 n nn0n0 T(n) k 1 n 2 – k 2 n How can we find the value for n 0 ? How can we find the value for k 1 and k 2 ? The above equation can be proved by our traditional induction if we know the value for n 0, k 1 and k 2. How can we prove it? Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 )

31 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k 1, k 2  R such that  n > n 0, T(n)  k 1 n 2 – k 2 n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k 1 n 2 – k 2 n ……………..(*)” We don ’ t know the base case. Thus, we need to test the “ smallest ” value of n for the base case. Consider P(1) RHS of (*) = k – k 2. 1 We want to see whether P(1) is true. (i.e., “T(1)  k – k 2. 1 ……………..(*)”) In other words, according to (*), we need to prove T(1)  k 1 – k 2 Currently, we don ’ t know the values of k 1 and k 2. P(1) is true. In order to prove T(1)  k 1 – k 2, we should set values of k 1 and k 2 such that k 1 – k 2  T(1) k 1 – k 2  T(1) Thus, P(1) is true. I guess n can be 1, 2, 2 2, … Since n > n 0, we have “ n 0  0 ” n 0  0 Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) = k 1 – k 2

32 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k 1, k 2  R such that  n > n 0, T(n)  k 1 n 2 – k 2 n Step 1: Prove that P( ? ) (i.e., the base case) is true. Suppose that n > n 0. Let P(n) be “T(n)  k 1 n 2 – k 2 n ……………..(*)” We guess that P(1), P(2 1 ), P(2 2 ) … are also true. Thus, the base case is when n = 1. P(1) P(1) is true. Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) k 1 – k 2  T(1) n 0  0

33 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k 1, k 2  R such that  n > n 0, T(n)  k 1 n 2 – k 2 n Suppose that n > n 0. Let P(n) be “T(n)  k 1 n 2 – k 2 n ……………..(*)” Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/2) is true for n > 1. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k 1. (n/2) 2 –k 2 (n/2) Consider T(n) We want to show that T(n)  k 1 n 2 – k 2 n  4T(n/2) + cn  4. (k 1 (n/2) 2 –k 2 (n/2)) + cn = 4. (k 1. n 2 /4–k 2 n/2) + cn Currently, we don ’ t know the value of k. In order to prove T(n)  k 1 n 2 – k 2 n, we should set a value of k such that c – k 2  0 P(1) is true. Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) = k 1 n 2 – 2k 2 n + cn = k 1 n 2 – k 2 n – k 2 n+ cn (i.e., k 2  c) k 2  c P(n) is true. k 1 – k 2  T(1) n 0  0 = k 1 n 2 – k 2 n + (c– k 2 )n Thus, P(n) is true.

34 e.g.6 We want to prove that T(n) = O(n 2 ) By the definition of big O, we need to show the following.  n 0  Z and k 1, k 2  R such that  n > n 0, T(n)  k 1 n 2 – k 2 n Suppose that n > n 0. Let P(n) be “T(n)  k 1 n 2 – k 2 n ……………..(*)” Step 2: Prove that “ P(n/2)  P(n) ” is true for all n > 1. Step 2(a): Assume that P(n/2) is true for n > 1. Step 2(b): According to P(n/2), we deduce that P(n) is true. That is, T(n/2)  k 1. (n/2) 2 –k 2 (n/2) We want to show that T(n)  k 1 n 2 – k 2 n P(1) is true. Let n be a non-negative power of 2. T(n)  4T(n/2) + cn where c:+ve T(n) > 0 Prove that T(n) = O(n 2 ) k 2  c P(n) is true. k 1 – k 2  T(1) n 0  0 We prove that “ P(n/2)  P(n) ” is true for all n > 1 By Mathematical Induction,  n  1, T(n)  k 1 n 2 – k 2 n We should set some values for n 0, k 1, k 2. Since n 0  0, we set n 0 = 0. Since k 2  c, we set k 2 = c. Since k 1 – k 2  T(1) (i.e., k 1  T(1) + k 2 ) we set k 1 = T(1) + c.

35 e.g.7 (Page 19) Why was it easier to prove stronger statement T(n)  k 1 n 2 – k 2 n than to prove weaker statement T(n)  kn 2 ?

36 e.g.7 Why was it easier to prove stronger statement T(n)  k 1 n 2 – k 2 n than to prove weaker statement T(n)  kn 2 ? Proving something about p(n) uses p(1)  …  p(n-1) The stronger that p(1)  …  p(n-1) are, the greater help they provide in proving p(n). Our first proof was that p(n-1) were too weak, and thus we were not able to use them to prove p(n). When we give an induction proof with a stronger statement, we are using a stronger inductive hypothesis.