Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.

Slides:



Advertisements
Similar presentations
22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
Advertisements

22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Recursive Definitions and Structural Induction
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
UCI ICS/Math 6A, Summer Recursion -1 after Strong Induction “Normal” Induction “Normal” Induction: If we prove.
Induction and recursion
UCI ICS/Math 6D5-Recursion -1 Strong Induction “Normal” Induction “Normal” Induction: If we prove that 1) P(n 0 ) 2) For any k≥n 0, if P(k) then P(k+1)
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Induction Sections 41. and 4.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Discussion #131/18 Discussion #13 Induction (the process of deriving generalities from particulars) Mathematical Induction (deductive reasoning over the.
Induction Sections 4.1 and 4.2 of Rosen Fall 2010
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Chapter Mathematical Induction
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank. Modified By Mingwu Chen Induction.
Mathematical Induction
Induction and recursion
Induction and recursion
Recursive Definitions and Structural Induction
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Inductive Proof (the process of deriving generalities from particulars) Mathematical Induction (reasoning over the natural numbers)
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!
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 4 Induction and Recursion 歐亞書局.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
Chapter 4: Induction and Recursion
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Induction and recursion
Chapter 5 With Question/Answer Animations. Section 5.1.
Mathematical Induction
4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object.
Chapter Mathematical Induction 4.2 Strong Induction and Well-Ordering 4.3 Recursive Definitions and Structural Induction 4.4 Recursive Algorithms.
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.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Mathematical Preliminaries
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
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.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
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,
Chapter 5 Kenneth Rosen, Discrete Mathematics and its Applications, 7th edition, McGraw Hill Instructor: Longin Jan Latecki, Copyright.
Mathematical Induction
6/12/2016 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(2) Mathematical Induction & Recursion Dr.Saad Alabbad Department of.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Mathematical Induction What it is? Why is it a legitimate proof method? How to use it?
3.3 Mathematical Induction 1 Follow me for a walk through...
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
1 Mathematical Induction An inductive proof has three parts: –Basis case –Inductive hypothesis –Inductive step Related to recursive programming.
Chapter 4: Induction and Recursion
Induction and recursion
Induction and Recursion Chapter 5
CS2210:0001Discrete Structures Induction and Recursion
Chapter 3 The Real Numbers.
Induction and recursion
Induction and Recursion
Mathematical Induction Recursion
Discrete Structures for Computer Science
Chapter 5 Induction and Recursion
CSI Mathematical Induction
MA/CSSE 474 More Math Review Theory of Computation
CSE 321 Discrete Structures
Induction and recursion
Presentation transcript:

Induction Proof

Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element. Examples:  N is well ordered (under the  relation).  Any coutably infinite set can be well ordered. The least element in a subset is determined by a bijection (list) which exists from N to the countably infinite set.  Z can be well ordered but it is not well ordered under the  relation. Z has no smallest element.  The set of finite strings over an alphabet using lexicographic ordering is well ordered.

Mathematical Induction Let P(x) be a predicate over a well ordered set S. In the case that S = N, the natural numbers, the principle has the following form. P(0) P(n)  P(n +1)  x P(x) The hypotheses are H 1 : P(0) (Basis Step) H 2 : P(n)  P(n +1) for n arbitrary. (Induction Step)

How It Works  First, prove that the predicate is true for the smallest element of the set S (0 if S = N).  Then, show if it is true for an element (n if S=N) implies it is true for the “next” element in the set (n + 1 if S=N). Meaning  Knowing it is true for the first element means it must be true for the element following the first or the second element  Knowing it is true for the second element implies it is true for the third and so forth.  Therefore, induction is equivalent to modus ponens applied an countable number of times!!

Outline of Induction Proof  State what P(n) is.  Basis: Prove that P(0) is true.  Induction hypothesis: Assume that P(n) is true, for an arbitrary n.  Induction step: Prove that P(n+1) is true, using P(n). (Usually, direct proof)

Example Prove:  n i = n(n +1)/2 i=0 In logical notation we wish to show  n [  n i = n(n +1)/2 ] i=0 Hence, P(n) is [  n i] = n(n +1)/2 i=0 Basis: Prove H1: P(0): 0=0(0 +1)/2 Induction Hypotheses: Assume P(n) is true for n arbitrary. Now use this and anything else you know to establish that P(n+1) must be true.

Example Induction step: Write down the assertion P (n+1) P(n + 1) is the assertion  n+1 i = (n+1)((n +1)+1)/2 i=0  n+1 i =  n i +n+1 i=0 = n(n +1)/2 + n+1 (from induction hypothesis ) = (n(n +1) + 2(n+1) )/ 2 = (n+1)(n+2)/ 2 = (n+1)((n +1)+1)/2 Q.E.D.

More General Rule  Suppose we wish to prove for some specific integer k  x [x  k  P(x)]  Now we merely change the basis step to P(k) and continue.

Example Prove 3n + 5 is in O(n 2 ). Definition: f(n) is in O(g(n)) if there are constants c>0 and k such that f(n)  c  g(n) for n  k. Proof: We must find C and k such that 3n + 5  Cn 2 for n  k (or n > k-1). If we try C = 1, then the assertion is not true until k = 5. Hence we prove by induction that 3n + 5  n 2 for all n  5. The assertion becomes  n[n  5  3n + 5  n 2 ] and the predicate P(n) is 3n + 5  n 2.

Example Basis step: P(5): 3  = 20  (5) 2. Induction hypothesis: Assume P(n): 3n  5  n 2 is true for arbitrary n. Induction step: Prove P(n+1): 3(n  1)  5  (n  1) 2 From 3n  5  n 2, we have (3n  5)  3  n Now we must show that n  (n + 1) 2 = n 2 + 2n + 1 which is true iff 3  2n + 1 which is true iff n  1. But we have already restricted n  5 so n  1 must hold. That is,  n[n  5  3n  5  n 2 ], i.e. 3n + 5 is in O(n 2 ). Q.E.D.

Double Qualifier  In doubly quantified assertions of the form  m  n[P(m,n)]  we often assume m (or n ) is arbitrary to eliminate a quantifier and prove the remaining result using induction.

Strong Induction H1: P(0) H2: P(0)  P(1) ...  P(n)  P(n +1)  xP(x) The two rules are equivalent but sometimes the second is easier to apply.

Example For any integer n>1, n can be written as a product of primes. Proof: Let P(n) be the predicate n can be written as a product of primes. Basis: P(2): 2 can be written as a product of 2, which is a prime. Induction hypothesis: For any integer k  n, k can be written as a product of primes.

Example Induction step: Prove n+1 can be written as a product of primes.  If n+1 is a prime, then it can be written as a product of itself only (by def. of primes).  If n+1 is not a prime, then there exist integers p and q such that p  q=n+1 (by def. of primes) and p and q are less than n+1. Since p and q are less than n+1, p and q can be written as products of primes (by induction hypothesis). Thus, n+1 can be written as a product of primes that make p and q. Q.E.D.

Recursive or Inductive Definitions  Basis step For sets  State the basic building blocks (BBB's) of the set. For functions  State the values of the function on the BBB’s.  Inductive or recursive step: For sets  Show how to build new things from old with some construction rules. For functions  Show how to compute the value of a function on the new things that can be built knowing the value on the old things.

Recursive or Inductive Definitions  Extremal clause: For sets  If you can't build it with a finite number of applications of steps 1. and 2. then it isn't in the set. For functions  A function defined on a recursively defined set does not require an extremal clause. Often omitted.  To prove something is in the set you must show how to construct it with a finite number of applications of the basis and inductive steps.  To prove something is not in the set is often more difficult.

Example A recursive definition of N:  Basis: 0 is in N (0 is the BBB).  Induction: if n is in N then so is n + 1 (how to build new objects from old: “add one to an old object to get a new one”).  Extremal clause: If you can't construct it with a finite numberof applications of the basis and induction, it is not in N.

Example Given the recursive definition of N, we can give recursive definitions of functions on N:  f(0) =1 The initial condition or the value of the function on the BBB’s.  f(n+1)=(n+1)  f(n) The recurrence equation, how to define f on the new objects based on its value on old objects.  f is the factorial function: f(n) = n!  Note how it follows the recursive definition of N.  Proof of assertions about inductively defined objects usually involves a proof by induction.

Proof guideline  Prove the assertion is true for the BBBs in the basis step.  Prove that if the assertion is true for the old objects it must be true for the new objects you can build from the old objects.  Conclude the assertion must be true for all objects.

Example We define a n inductively where n is in N. Basis: a 0 = 1 Induction: a (n+1) = a n  a Theorem:  m  n [a m a n  a m  n ] Proof: Since the powers of a have been defined inductively, we must use a proof by induction somewhere. Get rid of the first quantifier on m by Universal Instantiation: Assume m is arbitrary. Now prove, by induction, the remaining quantified assertion  n [a m a n  a m  n ]

Example Basis step: Show it holds for n=0. The left side becomes a m a 0  a m (1)  a m. The right side becomes a m+0  a m. Hence, the two sides are equal to the same value. Induction hypothesis: Assume the assertion is true for n: a m a n  a m  n. Induction step: Now show it is true for n+1 (a m a n+1  a m  n+1 ). a m a n+1 =  a m (a n a) (by inductive step in the definition of a n ) a m a n+1 = (a m a n )a (by associativity of multiplication) a m a n+1 = a m  n a (by the induction hypothesis) a m a n+1 = a m  n+1 (by inductive step in the definition of a n )

Rooted Trees The set of rooted trees, where a rooted tree consists of a set of vertices containing a distinguished vertex called the root, and edges connecting these vertices, can be defined recursively as follows: Basis step: A single vertex r is a rooted tree. Recursive step: If T 1, T 2, …, T n are rooted trees with roots r 1, r 2, …, r n, espectively, the graph form by starting with a root r, which is not in any of T 1, T 2, …, T n, and adding an edge from r to r 1, r 2, …, r n is also a rooted tree.

Extended Binary Trees The set of extended binary trees can be defined recursively as follows: Basis step: The empty set is an extended binary tree. Recursive step: If T 1 and T 2 are extended binary trees, there is an extended binary tree, denoted by T 1  T 2, consisting of a root r together with edges connecting the root to the root of the left subtree T 1 and the right subtree T 2, when these trees are not empty.

Full Binary Trees The set of full binary trees can be defined recursively as follows: Basis step: A single vertex r is a full binary tree. Recursive step: If T 1 and T 2 are full binary trees, there is an full binary tree, denoted by T 1  T 2, consisting of a root r together with edges connecting the root to the root of the left subtree T 1 and the right subtree T 2.

Height of Trees The height of a full binary tree T, denoted by h(T), can be defined as follows: Basis step: The height of a full binary tree T consisting of a single vertex r is h(T)=0. Recursive step: If T 1 and T 2 are full binary trees, the height of a full binary tree T = T 1  T 2 is h(T)=1+max(h(T 1 ), h(T 2 ))

Number of Nodes in a Full Binary Tree Theorem: If T is a full binary tree, the number of nodes in T, denoted by n(T), is not more than 2 h(T) Proof: Basis step: For a full binary tree T of height 0, T is consisted of one vertex. Then, n(T)=1, and 2 h(T)+1 -1 = =1. Thus, n(T)  2 h(T) Induction hypothesis: Assume n(T)  2 h(T)+1 -1 for any full binary tree T of the height less than k. Induction step: If T 1 and T 2 are full binary trees of the height less than k, the number of nodes in a full binary tree T = T 1  T 2 is 1+n(T 1 )+n(T 2 ).

Number of Nodes in a Full Binary Tree n(T) = 1+n(T 1 )+n(T 2 )(from the construction of T)  1 + (2 h(T 1 )+1 -1) + (2 h(T 2 )+1 -1) (from induction hypothesis) 1 + (2 h(T 1 )+1 -1) + (2 h(T 2 )+1 -1) = 2 h(T 1 ) h(T 2 )+1 -1  2  max(2 h(T 1 )+1, 2 h(T 2 )+1 ) -1 2  max(2 h(T 1 )+1, 2 h(T 2 )+1 ) -1= 2  (2 max(h(T 1 )+1, h(T 2 ))+1 ) -1 = 2  2 h(T) -1 = 2 h(T)+1 -1 That is, n(T)  2 h(T) Q.E.D.