RMIT University; Taylor's College1 Lecture 6  To apply the Principle of Mathematical Induction  To solve the Towers of Hanoi puzzle  To define a recurrence.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms II
Advertisements

Week 6 - Wednesday CS322.
AE1APS Algorithmic Problem Solving John Drake
1.1The Principle of Mathematical Induction 1.2Divisibility Chapter Summary Case Study Mathematical Induction 1.
Mixed Recursion: Sec. 8.4 Exercise 3. The closed-form formula for the Towers of Hanoi problem, M n = 2 n – 1, can be proved by mathematical induction.
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 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
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Recursion.
Chapter 10 Sequences, Induction, and Probability Copyright © 2014, 2010, 2007 Pearson Education, Inc Mathematical Induction.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Copyright © Cengage Learning. All rights reserved.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
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.
Induction and recursion
Copyright © Cengage Learning. All rights reserved.
What it is? Why is it a legitimate proof method? How to use it?
Week 6 - Monday CS322.
Induction and recursion
CSNB143 – Discrete Structure Topic 5 – Induction Part I.
Chapter 4: Induction and Recursion
13.2 Recursive Definitions Objective 1) Provide the recursive definition for sequences; 2) Identify the type of a sequence from a recursive definition.
CSC201 Analysis and Design of Algorithms Asst.Proof.Dr.Surasak Mungsing Oct-151 Lecture 2: Definition of algorithm and Mathematical.
1 CMSC 250 Chapter 4, con't., Inductive Proofs. 2 CMSC 250 Description l Inductive proofs must have: –Base case: where you prove that what it is you are.
Discrete Mathematics Tutorial 11 Chin
In section 11.9, we were able to find power series representations for a certain restricted class of functions. Here, we investigate more general problems.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
8.4 Mathematical Induction
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.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
(CSC 102) Lecture 23 Discrete Structures. Previous Lecture Summery  Sequences  Alternating Sequence  Summation Notation  Product Notation  Properties.
Inductive Proofs and Inductive Definitions Jim Skon.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015.
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Mathematical Induction
Discrete Mathematics Lecture # 22 Recursion.  First of all instead of giving the definition of Recursion we give you an example, you already know the.
Copyright © Cengage Learning. All rights reserved. Sequences and Series.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach a particular.
9/29/2011Lecture Strong Induction1 Lecture 3.2: Strong Induction CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Mathematical Induction I Lecture 19 Section 4.2 Mon, Feb 14, 2005.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Advanced Algorithms Analysis and Design
EECS 203: Discrete Mathematics
Chapter 3 The Real Numbers.
Induction and recursion
CSE 311: Foundations of Computing
Copyright © Cengage Learning. All rights reserved.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
Notes 9.5 – Mathematical Induction
Induction and recursion
Follow me for a walk through...
CSE 373 Data Structures and Algorithms
Mathematical Induction I
Follow me for a walk through...
Induction Chapter
Advanced Analysis of Algorithms
Copyright © Cengage Learning. All rights reserved.
Mathematical Induction
Mathematical Induction
Follow me for a walk through...
Induction: One Step At A Time
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

RMIT University; Taylor's College1 Lecture 6  To apply the Principle of Mathematical Induction  To solve the Towers of Hanoi puzzle  To define a recurrence relation

RMIT University; Taylor's College2 Mathematical Induction  Suppose we have a mathematical proposition, P(n), about some integers n.  We want to know if P(n) is true for every integer n, from a starting point onwards.

RMIT University; Taylor's College3 Mathematical Induction Example: Prove that n! > 2 n is true for all in positive integer n Is this sometimes true, never true, always true after a certain point, or what? Check some values: n!2n2n n = 011 n = 112 n = 224 n = 368 n = n = At this stage, n! seems to be streaking ahead of 2 n at a great rate. How could we prove n! > 2 n ? The idea is to use Proof by Induction.

RMIT University; Taylor's College4 Proof by Induction: 3 Steps 1.Base step: With a starting point n 0, Verify that P(n 0 ) is true. 2.Inductive step: Assume that P(k) is true, prove that P(k + 1) is also true. 3.Conclusion: Declare that P(n) is true for every integer n ≥ n 0

RMIT University; Taylor's College5 Example: Prove by induction that n! > 2 n for all n ≥ 4.

6 Conclusion: n! > 2 n for all n ≥ 4.

7

8

RMIT University; Taylor's College9

10 The Towers of Hanoi  We need to move all n discs to Pole 3. But we can only move 1 disc at a time, and a disc must never be placed on a smaller disc.  Theorem: This can be solved for all n ≥ 1 Proof: We can use proof by induction

RMIT University; Taylor's College11 The Towers of Hanoi: Proof  Base step Suppose we have 1 disc. Pick it up and put it on Pole 3  Inductive step Suppose we can move (k – 1) discs (*) We want to show we can move k discs. Given k discs, leave the big one at the bottom. Move the other (k – 1) to Pole 2 instead of Pole 3. (We know this can be done, by the inductive hypothesis (*)) Move the big disc to Pole 3. Move the other stack from Pole 2 to Pole 3 (Again, we know this can be done, by (*).) We’ve moved the stack of k discs!  Conclusion For all n, the problem can be solved.

RMIT University; Taylor's College12 The Towers of Hanoi  How many moves (1 disc at a time) are needed to get the stack of n discs from Pole 1 to Pole 3? Let this number be f n.  So f 1 = 1. (That is, if we only have 1 disc then a single move takes it to Pole 3.)  Let’s look at the inductive proof that the puzzle can always be solved. When n = k, f k moves are needed.  So what happens when n = k + 1? The number of moves needed is f k+1, but this can be expressed in terms of f k.  It takes f k moves to get the top k discs to Pole 2, then 1 move to get the bottom disc to Pole 3, and then f k moves to get the stack of k discs from Pole 2 and put it on top of the biggest disc which is now on Pole 3.

RMIT University; Taylor's College13 The Towers of Hanoi  So f k+1 = f k f k, i.e. f k + 1 = 2f k + 1  This equation is an example of a recurrence relation, where each value of a function can be determined from previous values (assuming that we know some initial values).  Using n instead of k, we have f n+1 = 2f n + 1 with initial condition f 1 = 1.

RMIT University; Taylor's College14 The Towers of Hanoi We can then construct the following partial table. nfnfn f 2 = 2f = =3 f 3 = 2f = = 7

RMIT University; Taylor's College15 The Towers of Hanoi  But suppose we want to know how many moves are needed to shift 100 discs. We would need to compute all the values from f 7 up to f 99, and then use f 100 = 2f to get the value of f 100.  Clearly it would be better if we had a formula for f n which only depended on n, rather than on earlier values of the function. Such a formula is called a solution to the recurrence relation.  We won’t give a general method for solving recurrence relations, but rather we’ll look at how to obtain a solution for this particular example.

RMIT University; Taylor's College16 The Towers of Hanoi  Do the values in the second column of the table look familiar?  If not, let’s add 1 to every value and also put in some more rows fnfn f n n Now it should be clear that the new last column consists of all the powers of 2 with positive exponent. Specifically, f n + 1 = 2 n. Subtracting 1 from both sides gives f n = 2 n – 1. It can be formally proved that this formula gives the correct answer. (We omit the details.)

RMIT University; Taylor's College17 The Towers of Hanoi  Our reasoning here is an example of inductive reasoning, where we study enough examples to be able to hypothesize a general result.  Note that f 100 = – 1, which is a rather big number!  2 64 – 1 = 18, 446, 744, 073, 709, 551, 615 moves!