Induction: One Step At A Time

Slides:



Advertisements
Similar presentations
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Advertisements

1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Induction and recursion
Induction: One Step At A Time Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 4Jan 22, 2004Carnegie Mellon University.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
Great Theoretical Ideas in Computer Science.
Induction and recursion
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science for Some.
Induction and recursion
Discrete Mathematics, 1st Edition Kevin Ferland
Introduction to Proofs
B ASIC P ROOF M ETHODS HWW Math Club Meeting #3 (October 18, 2010) Presentation by Julian Salazar.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Great Theoretical Ideas in Computer Science.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Fibonacci Numbers, Vector Programs and a new kind of science.
Discrete Structures & Algorithms More on Methods of Proof / Mathematical Induction EECE 320 — UBC.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
COMPSCI 102 Discrete Mathematics for Computer Science.
Inductive Reasoning Great Theoretical Ideas In Computer Science Victor AdamchikCS Spring 2010 Lecture 2Jan 14, 2010Carnegie Mellon University.
Chapter 1: Introduction
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Great Theoretical Ideas in Computer Science.
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
Induction II: Inductive Pictures Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 2Jan 13, 2005Carnegie Mellon University.
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.
Mathematical Induction
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.
COMPSCI 102 Introduction to Discrete Mathematics.
Mathematical Induction
6/12/2016 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(2) Mathematical Induction & Recursion Dr.Saad Alabbad Department of.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Chapter 1 Logic and Proof.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
The Foundations: Logic and Proofs
CSE15 Discrete Mathematics 03/22/17
Advanced Algorithms Analysis and Design
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Induction and recursion
Predicate Calculus Validity
CSE 311: Foundations of Computing
Great Theoretical Ideas in Computer Science
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Chapter 5 Induction and Recursion
Great Theoretical Ideas in Computer Science
Explorations in Artificial Intelligence
Copyright © Cengage Learning. All rights reserved.
Great Theoretical Ideas in Computer Science
The Foundations: Logic and Proofs
Induction II: Inductive Pictures
Discrete Mathematics and its Applications
Induction and recursion
Induction: One Step At A Time
Induction: One Step At A Time
Great Theoretical Ideas in Computer Science
MA/CSSE 474 More Math Review Theory of Computation
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Discrete Mathematics for Computer Science
Advanced Analysis of Algorithms
Induction II: Inductive Pictures
Mathematical Induction
Induction: One Step At A Time
Induction and recursion
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Presentation transcript:

Induction: One Step At A Time Great Theoretical Ideas In Computer Science Steven Rudich CS 15-251 Spring 2003 Lecture 3 Jan 21, 2003 Carnegie Mellon University Induction: One Step At A Time

Last time we talked about different ways to represent numbers: unary, binary, decimal, base b, plus/minus binary, Egyptian binary . . .

Different representations had different advantages and disadvantages.

Today we will talk about INDUCTION

Induction is the primary way we: Prove theorems Construct and define objects

Representing a problem or object inductively is one of the most fundamental abstract representations.

Let’s start with dominoes

Domino Principle: Line up any number of dominos in a row; knock the first one over and they will all fall.

n dominoes numbered 1 to n Fk ´ The kth domino will fall If we set them all up in a row then we know that each one is set up to knock over the next one: For all 1· k < n: Fk ) Fk+1

n dominoes numbered 1 to n Fk ´ The kth domino will fall For all 1· k < n: Fk ) Fk+1 F1 ) F2 ) F3 ) … F1 ) All Dominoes Fall

n dominoes numbered 0 to n-1 Fk ´ The kth domino will fall For all 0· k < n-1: Fk ) Fk+1 F0 ) F1 ) F2 ) … F0 ) All Dominoes Fall

The Natural Numbers  = { 0, 1, 2, 3, . . .}

Plato: The Domino Principle works for an infinite row of dominoes Aristotle: An “infinite” row? What do you mean? Can there be such a thing?

The Infinite Domino Principle Fk ´ The kth domino will fall Assume we know that for every natural number k, Fk ) Fk+1 F0 ) F1 ) F2 ) … F0 ) All Dominoes Fall

Plato’s Dominoes One for each natural number An infinite row, 0, 1, 2, … of dominoes, one domino for each natural number. Knock the first domino over and they all will fall. Proof: Suppose they don’t all fall. Let k>0 be the lowest numbered domino that remains standing. Domino k-1¸0 did fall, but k-1 will knock over domino k. Thus, domino k must fall and remain standing. Contradiction.

The Infinite Domino Principle Fk ´ The kth domino will fall Assume we know that for every natural number k, Fk ) Fk+1 F0 ) F1 ) F2 ) … F0 ) All Dominoes Fall

Mathematical Induction: statements proved instead of dominoes fallen Infinite sequence of dominoes. Fk ´ domino k fell Infinite sequence of statements: S0, S1, … Fk ´ Sk proved Establish 1) F0 2) For all k, Fk ) Fk+1 Conclude that Fk is true for all k

Inductive Proof / Reasoning To Prove k, Sk Establish “Base Case”: S0 Establish that k, Sk ) Sk+1 Assume hypothetically that Sk for any particular k; Conclude that Sk+1 k, Sk ) Sk+1

Inductive Proof / Reasoning To Prove k, Sk Establish “Base Case”: S0 Establish that k, Sk ) Sk+1 Assume “Inductive Hypothesis”: Sk Prove that Sk+1 follows from Sk

Inductive Proof / Reasoning To Prove k¸b, Sk Establish “Base Case”: Sb Establish that k¸b, Sk ) Sk+1 Assume k¸ b Assume “Inductive Hypothesis”: Sk Prove that Sk+1 follows

We already know that n, n= 1 + 2 + 3 + . . . + n-1 + n = n(n+1)/2. Let’s prove it by induction: Let Sn ´ “n =n(n+1)/2”

Sn ´ “n =n(n+1)/2” Use induction to prove k¸0, Sk Establish “Base Case”: S0. 0=The sum of the first 0 numbers = 0. Setting n=0 the formula gives 0(0+1)/2 = 0. Establish that k¸0, Sk ) Sk+1 “Inductive Hypothesis” Sk: k =k(k+1)/2 k+1 = k + (k+1) = k(k+1)/2 + (k+1) [Using I.H.] = (k+1)(k+2)/2 [which proves Sk+1]

Aristotle’s Contrapositive Let S be a sentence of the form “A ) B”. The Contrapositive of S is the sentence “B ) A”. The two sentences are logically equivalent. That is, one is true in exactly the same situations where the other is true. Hence, one can just as well prove the Contrapositive of S to establish S.

Contrapositive Dominos Suppose there is a least domino k that does not fall. If k did not fall, then k-1 did not fall. k-1 would be a smaller, standing domino, contradicting our assumption.

Contrapositive or Least Counter-Example Induction: to Prove k, Sk Establish “Base Case”: S0 Establish that k, Sk ) Sk+1 Let k>0 be the least number such that Sk is false. Prove that Sk ) Sk-1 [Contradiction of k being the least counter-example]

“Strong” Induction To Prove k, Sk Establish “Base Case”: S0 Establish that k, Sk ) Sk+1 Let k be any natural number. Assume j<k, Sj Prove Sk

Strong, Contrapositive Induction: Assume there is a least counter-example. Derive the existence of a smaller counter-example. Conclude there is no counter-example.

Euclid’s theorem on the unique factorization of a number into primes. Assume there is a least counter-example. Derive the existence of a smaller counter-example.

Theorem: Each natural has a unique factorization into primes written in non-decreasing order. Definition: A number > 1 is prime if it has no other factors, besides 1 and itself. Primes: 2, 3, 5, 7, 11, 13, 17, …. Factorizations: 42 = 2 * 3 * 7 84 = 2 * 2 * 3 * 7 = 13

Theorem: Each natural has a unique factorization into primes written in non-decreasing order. Let n be the least counter-example. n has at least two ways of being written as a product of primes: n = p1 p2 .. pk = q1 q2 … qt The p’s must be totally different primes than the q’s or else we could divide both sides by one of a common prime and get a smaller counter-example. Without loss of generality, assume q1 < p1 .

Theorem: Each natural has a unique factorization into primes written in non-decreasing order. Let n be the least counter-example. n = p1 p2 .. pk = q1 q2 … qt [ q1 < p1 ] n ¸ (p1)2 > p1 q1 + 1 m = n – p1q1 < n Both p1 and q1 divide n, and hence divide m (so m>1) By unique factorization of m, p1q1 divides m = p1q1z m = n – p1q1 = p1(p2 .. pk - q1 ) = p1q1z (p2 .. pk - q1 ) = q1z p2 .. pk = q1z + q1 = q1(z+1) so q1 divides p2…pk And hence, by unique factorization of p2…pk, q1 must be one of the primes p2,…,pk. Contradiction of q1<p1.

Inductive Reasoning is the high level idea: “Standard” Induction “Contrapositive” Induction “Strong” Induction are just different packaging.

“Strong” Induction Can Be Repackaged As Standard Induction Define Ti = j· i, Sj Establish “Base Case”: T0 Establish that k, Tk ) Tk+1 Let k be any natural number. Assume Tk-1 Prove Tk Establish “Base Case”: S0 Establish that k, Sk ) Sk+1 Let k be any natural number. Assume j<k, Sj Prove Sk

Yet another way of packaging inductive reasoning is to define an “invariant”. Not varying; constant. Mathematics. Unaffected by a designated operation, as a transformation of coordinates.

Yet another way of packaging inductive reasoning is to define an “invariant”. Invariant: 3. programming A rule, such as the ordering an ordered list or heap, that applies throughout the life of a data structure or procedure. Each change to the data structure must maintain the correctness of the invariant.

Invariant Induction Suppose we have a time varying world state: W0, W1, W2, … Each state change is assumed to come from a list of permissible operations. We seek to prove that statement S is true of all future worlds. Argue that S is true of the initial world. Show that if S is true of some world – then S remains true after one permissible operation is performed.

Invariant Induction Suppose we have a time varying world state: W0, W1, W2, … Each state change is assumed to come from a list of permissible operations. Let S be a statement true of W0. Let W be any possible future world state. Assume S is true of W. Show that S is true of any world W’ obtained by applying a permissible operation to W.

Odd/Even Handshaking Theorem: At any party at any point in time define a person’s parity as ODD/EVEN according to the number of hands they have shaken. Statement: The number of people of odd parity must be even. Zero hands have been shaken at the start of a party, so zero people have odd parity. If 2 people of different parities shake, then they both swap parities and the odd parity count is unchanged. If 2 people of the same parity shake, they both change and hence the odd parity count changes by 2 – and remains even.

Inductive Reasoning is the high level idea: “Standard” Induction “Contrapositive” Induction “Strong” Induction and Invariants are just different packaging.

Induction is also how we can define and construct our world.

So many things, from buildings to computers, are built up stage by stage, module by module, each depending on the previous stages.

Well, almost always

Inductive Definition Of Functions Stage 0, Initial Condition, or Base Case: Declare the value of the function on some subset of the domain. Inductive Rules Define new values of the function in terms of previously defined values of the function F(x) is defined if and only if it is implied by finite iteration of the rules.

Inductive Definition Recurrence Relation for F(X) Initial Condition, or Base Case: F(0) = 1 Inductive Rule For n>0, F(n) = F(n-1) + F(n-1) n 1 2 3 4 5 6 7 F(n) 8 16 32 64 128

Inductive Definition Recurrence Relation for F(X) = 2X Initial Condition, or Base Case: F(0) = 1 Inductive Rule For n>0, F(n) = F(n-1) + F(n-1) n 1 2 3 4 5 6 7 F(n) 8 16 32 64 128

Inductive Definition Recurrence Relation Initial Condition, or Base Case: F(1) = 1 Inductive Rule For n>1, F(n) = F(n/2) + F(n/2) n 1 2 3 4 5 6 7 F(n) %

Inductive Definition Recurrence Relation F(X) = X for X a whole power of 2. Initial Condition, or Base Case: F(1) = 1 Inductive Rule For n>1, F(n) = F(n/2) + F(n/2) n 1 2 3 4 5 6 7 F(n) %

Leonardo Fibonacci In 1202, Fibonacci proposed a problem about the growth of rabbit populations.

Leonardo Fibonacci In 1202, Fibonacci proposed a problem about the growth of rabbit populations.

Leonardo Fibonacci In 1202, Fibonacci proposed a problem about the growth of rabbit populations.

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

The rabbit reproduction model A rabbit lives forever The population starts as a single newborn pair Every month, each productive pair begets a new pair which will become productive after 2 months old Fn= # of rabbit pairs at the beginning of the nth month month 1 2 3 4 5 6 7 rabbits 8 13

Inductive Definition or Recurrence Relation for the Fibonacci Numbers Stage 0, Initial Condition, or Base Case: Fib(1) = 1; Fib (2) = 1 Inductive Rule For n>3, Fib(n) = Fib(n-1) + Fib(n-2) n 1 2 3 4 5 6 7 Fib(n) % 8 13

Inductive Definition or Recurrence Relation for the Fibonacci Numbers Stage 0, Initial Condition, or Base Case: Fib(0) = 0; Fib (1) = 1 Inductive Rule For n>1, Fib(n) = Fib(n-1) + Fib(n-2) n 1 2 3 4 5 6 7 Fib(n) 8 13

An inductive definition/viewpoint on an object is one of many equivalent abstract representations of the object.

Inductive Definition of T(n) T(n) = 4 T(n/2) + n Notice that T(n) is inductively defined for positive powers of 2, and undefined on other values.

Closed Form Definition of G(n) G(n) = 2n2 - n Domain of G are the powers of two.

Two equivalent definitions? G(n) = 2n2 - n Domain of G are the powers of two. T(1) = 1 T(n) = 4 T(n/2) + n

Prove equivalence by induction on n: Assume T(x) = G(x) for x < n Closed Form: G(n) = 2n2 – n Base: G(1) = 1 and T(1) = 1 Assuming T(n/2) = G(n/2) = 2(n/2)2 – n/2 T(n) = 4 T(n/2) + n =4[G(n/2) + n] 4 [2(n/2)2 – n/2] + n = 2n2 – 2n + n = 2n2 – n = G(n)

Solving Recurrences Guess and Verify Guess: G(n) = 2n2 – n Verify: G(1) = 1 and G(n) = 4 G(n/2) + n Similarly:T(1) = 1 and T(n) = 4 T(n/2) + n So T(n) = G(n)

Non-Inductive Definition Let Tilen be the number of different ways to tile a 1 X n strip with squares and dominoes.

Each tiling of the n-strip starts with either a square or a domino: Inductive Insight Let Tilen be the number of different ways to tile a 1 X n strip with squares and dominoes. Each tiling of the n-strip starts with either a square or a domino:

Tilen = Tilen-1 + Tilen-2 Let Tilen be the number of different ways to tile a 1 X n strip with squares and dominoes. Tilen-1 with initial square Tilen-2 with initial domino

Two Equivalent Definitions Non-inductive: Tilen is the number of ways to tile a 1 by n strip with squares and dominoes. Inductive: Tile1 = 1, Tile2 = 2 Tilen = Tilen-1 + Tilen-2 Equivalence is proven by induction on n

Proven by induction on n Tilen = Fib(n+1) Inductive: Fib(1) = 1; Fib(2) = 1; Fib(n) = Fib(n-1) + Fib(n-2) Tile1 = 1, Tile2 = 2 Tilen = Tilen-1 + Tilen-2 Proven by induction on n

Another Ancient Definition Pascal(r,i) Initial Condition, or Base Case: Pascal(anything, negative number) = 0 Pascal(1,0) = 1 Inductive Rule For i>0, Pascal(r,i) = Pascal(r-1,i-1) + Pascal(r,i)

Pascal’s Triangle Al-Karaji, Baghdad 953-1029 Chu Shin-Chieh 1303 The Precious Mirror of the Four Elements . . . Known in Europe by 1529 Blaise Pascal 1654 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1