Induction and Recursion by: Mohsin tahir (GL) Numan-ul-haq Waqas akram Rao arslan Ali asghar.

Slides:



Advertisements
Similar presentations
Mathematical Induction
Advertisements

1.1The Principle of Mathematical Induction 1.2Divisibility Chapter Summary Case Study Mathematical Induction 1.
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.
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
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Copyright © Cengage Learning. All rights reserved.
1 Section 3.4 Recursive Definitions. 2 Recursion Recursion is the process of defining an object in terms of itself Technique can be used to define sequences,
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
CSE115/ENGR160 Discrete Mathematics 03/29/11 Ming-Hsuan Yang UC Merced 1.
Induction and recursion
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Chapter 6 Mathematical Induction
Discrete Mathematics, 1st Edition Kevin Ferland
Analysis of Algorithms
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Chapter 4: Induction and Recursion
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
INDUCTION AND RECURSION. PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all positive integers n, where P(n) is a propositional function,
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
Chapter 5 With Question/Answer Animations. Section 5.1.
Lecture 4,5 Mathematical Induction and Fibonacci Sequences.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
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.
Mathematical Induction
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
CS104:Discrete Structures Chapter 2: Proof Techniques.
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.
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.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
6/12/2016 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(2) Mathematical Induction & Recursion Dr.Saad Alabbad Department of.
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.
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
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.
Chapter 4: Induction and Recursion
CSE15 Discrete Mathematics 03/22/17
Advanced Algorithms Analysis and Design
CS2210:0001Discrete Structures Induction and Recursion
Induction and recursion
Induction and Recursion
Mathematical Induction Recursion
Chapter 5 Induction and Recursion
Notes 9.5 – Mathematical Induction
Induction and recursion
Applied Discrete Mathematics Week 9: Integer Properties
Mathematical Induction
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...
Copyright © Cengage Learning. All rights reserved.
11.4 Mathematical Induction
Recursion.
Presentation transcript:

Induction and Recursion by: Mohsin tahir (GL) Numan-ul-haq Waqas akram Rao arslan Ali asghar

Contents  Mathematical Inductions  Strong Induction  Recursion

Mathematical Induction

Suppose we have an infinite ladder: We can reach the first rung of the ladder. If we can reach a particular rung of the ladder, then we can reach the next rung. From (1), we can reach the first rung. Then by applying (2), we can reach the second rung. Applying (2) again, the third rung. And so on. We can apply (2) any number of times to reach any particular rung, no matter how high up. This example motivates proof by mathematical induction. Climbing an Infinite Ladder Ladder

Mathematical Induction Mathematical induction is an extremely important proof technique. It is extremely important to note that mathematical induction can be used only to prove results obtained. It is not a tool for discovering formulae or theorems.

Let P(n) be a propositional (formula),satisfies that following condition, Step#1: for n=1 p(1) is true. “Case 1 is satisfied” Step#2: The result (formula) is true for n=k (where k is integer +ive) p(k) is true. “case 2 is satisfied” Step#3: now we have to show that, the result is true for n=k+1, if p(k+1) is true then proposition p(n) is true for all positive integer value of n. Definition:-

PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all positive integers n, where P(n) is a propositional function, we complete two steps: BASIS STEP: The proposition P(1) is true. INDUCTIVE STEP: The proposition p(k) is true for n=k also p(k+1) is show to be true for n=k+1, hence both P(k) → P(k + 1) is true for all positive integers k. To complete the inductive step, assuming the inductive hypothesis that P(k) holds for an arbitrary integer k, show that must P(k + 1) be true.

Climbing an Infinite Ladder Example: Basis Step: By (1), we can reach rung 1. Inductive Step: Assume the inductive hypothesis that we can reach rung k. Then by (2), we can reach rung k + 1. Hence, P(k) → P(k + 1) is true for all positive integers k. We can reach every rung on the ladder.

Examples:-

Q#1 Show that if n is a positive integer, then · · ·+n = n(n + 1)/2 We prove this formula by mathematical induction Basic step:- Let p(n) : · · ·+n = n(n + 1)/2 L.H.S for n=1 R.H.S p(1)=n(n+1)/2 p(1)=1 =1(1+1)/2 =2/2 =1 L.H.S=R.H.S  (case 1 is satisfied) it is true. Inductive step:- Now assume that p(k) it is true for n=k (where k is +ive integer) p(k) : · · ·+k = k(k + 1)/2  eq # 1 (case 2 is satisfied)

Now we have to show that, under the assumption the result is true for p(k+1) for n=k · · ·+k + (k + 1) = (k + 1)[(k + 1) + 1]/2 = (k + 1)(k + 2)/2  eq # 2 When we add (k + 1) to both sides of the equation in P(k), we obtain · · ·+k + (k + 1)= k(k + 1)/2+ (k + 1) = k(k + 1) + 2(k + 1)/2 = (k + 1)(k + 2)/2 Which is same as eq 2. This last equation shows that P(k + 1) is true under the assumption that P(k) is true. This completes the inductive step. Hence,therefore it is true for all +ive integer n.

Q#2 Conjecture a formula for the sum of the first n positive odd integers. Then prove your conjecture using mathematical induction. The sums of the first n positive odd integers n = 1,3,5,7,9, And so on. Positive odd numbersSum of odd numbers 1 (1) 2 =1 3 (2) 2 =4 5 (3) 2 =9 7 (4) 2 =16 9 (5) 2 =

From these values it is reasonable to conjecture that the sum of the first n positive odd integers is n · · ·+(2n − 1) = n 2 SOLUTION: Basic step :- Let P(n) : · · ·+(2n − 1) = n 2 L.H.S R.H.S for n=1 P(1)=(2(1)-1) p(1)=(1) 2 =(2-1) =1 =1 SoL.H.S=R.H.S  (case 1 is satisfied) it is true. Inductive step:- Now assume that p(k) it is true for n=k (where k is +ive integer) p(k) : · · ·+(2k − 1) = k 2  eq # 1

Now we have to show that, under the assumption the result is true for p(k+1) for n=k · · ·+(2k-1) + (2(k+1)− 1) = (k+1) 2 = (k+1) 2  eq # 2 When we add (2k + 1) to both sides of the equation in P(k), we obtain · · ·+(2k − 1)+ (2k+1) = k 2 + (2k+1) =k 2 + 2k+1 =k 2 +k + k+1 = (k+1)(k+1)= (k+1) 2 Which is same as eq 2. Since the result is true for n=K+1, therefore it is true for all +ive integer n.

Note:- some time we need to show that p(n) is true for n=k, n=k+1….. Where k is an integer other than 1. We can use mathematical induction to accomplish this as long as we change the basis step. This proves that the formula is valid for all non negative integers. So that we need to prove that p(n) is true for n=0, 1, 2, 3, ………..

Q# · · ·+ 2 n = 2 n+1 − 1 for all nonnegative integers n. We prove this formula by mathematical induction Basic step:- Let p(n) : · · ·+ 2 n = 2 n+1 − 1 L.H.S for n=0 R.H.S p(0)= 2 n+1 − 1 p(0)=2 0 = − 1 =1 = 2 − 1 =1 L.H.S=R.H.S  (case 1 is satisfied) it is true. Inductive step:- Now assume that p(k) it is true for n=k (where k is +ive integer) p(k) : · · ·+ 2 k = 2 k+1 − 1  eq # 1 (case 2 is satisfied)

Now we have to show that, under the assumption the result is true for p(k+1) for n=k · · ·+ 2 k + 2 k+1 = 2 (k+1)+1 − 1 = 2 (k+2) − 1  eq # 2 When we add 2 k+1 to both sides of the equation in P(k), we obtain · · ·+ 2 k + 2 k+1 = 2 k+1 − k+1 =2. 2 k+1 − 1 = 2 (k+2) − 1 Which is same as eq 2. Since the result is true for n=K+1, therefore it is true for all non negative integer n.

Summation Formula by Mathematical Induction

Q#1 Show that if n is a positive integer, then We prove this formula by mathematical induction Basic step:- Let p(n) : L.H.S for n=1 R.H.S p(1)=n(n+1)/2 =1(1+1)/2 =2/2 =1 L.H.S=R.H.S  (case 1 is satisfied) it is true. Inductive step:- Now assume that p(k) it is true for n=k (where k is +ive integer) p(k) :  eq # 1 (case 2 is satisfied)

Now we have to show that, under the assumption the result is true for p(k+1) for n=k+1. = (k + 1)[(k + 1) + 1]/2 = (k + 1)(k + 2)/2  eq # 2 When we add (k + 1) to both sides of the equation in P(k), we obtain =k(k + 1)/2+ (k + 1) = k(k + 1) + 2(k + 1)/2 = (k + 1)(k + 2)/2 Which is same as eq 2. This last equation shows that P(k + 1) is true under the assumption that P(k) is true. This completes the inductive step. Since the result is true for n=K+1, therefore it is true for all +ive integer n.

PROVING INEQUALITIES

Q#1 Use mathematical induction to prove the inequality n < 2 n for all positive integers n. Solution:- Basic step:- Let p(n) : n < 2 n for n=1 1< 2 1 1<2 (case 1 is satisfied) it is true Inductive step:- Now we assume that it is true for n=k (k is integer +ive) k< 2 k (case 2 is satisfied) it is true Now we have to show that, under the assumption the result is true for p(k+1) for n=k+1. (k+1) < 2 k+1  eq # 2

When we add 1 to both sides of the equation in P(k), we obtain k < 2k, and then note that 1 ≤ 2k. k+1< 2 k + 1 k+1< 2 k + 2 k k+1< 2.2 k k+1< 2 k+1 Which is same as eq 2. This shows that P(k + 1) is true, namely, that k+1< 2 k+1 based on the assumption that P(k) is true. The induction step is complete. Hence the result is true for n=K+1, therefore it is true for all +ive integer n.

Q#1 Use mathematical induction to prove that 2 n < n ! For n≥ 4. (i.e. n=4,5,6………) Solution:- Basic step:- Let p(n) : 2 n < n ! for n=4 2 4 < 4! 16< < 24 (case 1 is satisfied) it is true Inductive step:- Now we assume that it is true for n=k (k is integer +ive) 2 k < k! (case 2 is satisfied) it is true  eq # 1

Now we have to show that, under the assumption the result is true for p(k+1) for n=k+1. 2 k+1 < (k+1)!  eq # 2 From eq # 1 2 k < k! 2.2 k / 2< k! (multiply or divide by 2 on L.H.S) 2 k+1 / 2 < k! (multiply (k+1) on both side) (k+1).2 k+1 /2< (k+1).k! (neglected k+1/2 from L.H.S) 2 k+1 < (k+1)! Which is same as eq 2. This shows that P(k + 1) is true, namely, that 2 k+1 < (k+1)! based on the assumption that P(k) is true. The induction step is complete. Hence it is true for every integer n≥ 4.

Strong Induction

Strong Induction: To prove that P(n) is true for all positive integers n, where P(n) is a propositional function, complete two steps: BASIS STEP: We verify that the proposition P(1) is true. INDUCTIVE STEP: We show that the conditional statement [P(1) ∧ P(2) ∧ · · · ∧ P(k)] → P(k + 1) is true for all positive integers k.

Recursion

Definition Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object in terms of itself. This process is called recursion.  We can use recursion to define sequences, functions, and sets.  the sequence of powers of 2 is given by an = 2 n for n = 0, 1, 2,....  The sequence of powers of 2 can also be defined  by giving the first term of the sequence, namely, a0 = 1, and a rule for finding a term of the sequence from the previous one, namely: a n+1 =2a n for n = 0, 1, 2,....

. For instance, the picture is produced recursively. First, an original picture is given. Then a process of successively superimposing centered smaller pictures on top of the previous pictures is carried out.

Recursively Defined Functions We use two steps to define a function with the set of nonnegative integers as its domain: BASIS STEP: Specify the value of the function at zero. RECURSIVE STEP: Give a rule for finding its value at an integer from its values at smaller integers. Such a definition is called a recursive or inductive definition.

EXAMPLES

Q # 1 Suppose that f is defined recursively by f (0) = 3, f (n + 1) = 2f (n) + 3. Find f (1), f (2), f (3), and f (4). Solution: From the recursive definition it follows that f (n + 1) = 2f (n) + 3 with f (0) = 3 f (1) = 2f (0) + 3 = 2 · = 9, f (2) = 2f (1) + 3 = 2 · = 21, f (3) = 2f (2) + 3 = 2 · = 45, f (4) = 2f (3) + 3 = 2 · = 93.

Q # 2 find the f(1), f(2),f(3) and f(4) if f(n) is defined recursively by f(0)=1 for n=0,1,2,3,4………… f(n+1)=3f(n) Solution: from recursively definition. f(n+1)=3f(n) with f(0)=1 n=0 : f(1)=3f(0)=3(1)=3 n=1 : f(2)=3f(1)=3(3)=9 n=2 : f(3)=3f(2)=3(9)=27 n=3 : f(4)=3f(3)=3(27)=81

Q # 3 Give an inductive (recursive) definition of the factorial function F(n) = n!. solution: initial value : F(0) = 1 recursive form : F(n+1) = (n+1)! = n!  (n+1) = F(n)  (n+1) which is deserved rule

Q # 4 Give a recursive definition of: Solution: The first part of the recursive definition is a k = a 0 + a 1 + a 2 +……… a n (1) For initial value : ( n=0) (2) For finding a rule : (k=n+1) = a 0 + a 1 + a 2 +……… a n + a n+1 ={ a 0 + a 1 + a 2 +……… a n } + a n+1 = + a n+1 which is deserved rule

Q # 5 Give the recursive definition of the sequence { a n }. n= 1,2,3,4,5,6…….. a n = 6n Solution: a n = 6n (i) For initial value : n=1 a 1 = 6(1) a 1 = 6 (ii) For finding value: a n+1 = 6(n+1)  a n+1 = 6n+6for a n = 6n a n+1 = a n + 6 n>=1