+ All Categories
Home > Documents > INDUCTION AND RECURSION. PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all...

INDUCTION AND RECURSION. PRINCIPLE OF MATHEMATICAL INDUCTION To prove that P(n) is true for all...

Date post: 12-Jan-2016
Category:
Upload: ashlee-payne
View: 217 times
Download: 0 times
Share this document with a friend
18
INDUCTION AND RECURSION
Transcript
Page 1: 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,

INDUCTION AND RECURSION

Page 2: 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,

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:

We verify that P(1) is true.

INDUCTIVE STEP:

We show that the conditional statement P(k) P(k + 1 ) is true for all positive integers k.

Expressed as a rule of inference, this proof technique can be stated as

Page 3: 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,

Example

Page 4: 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,

Example

This last equation shows that P (k + 1) is true under the assumption that P(k) is true. This completes the inductive step.We have completed the basis step and the inductive step, so by mathematical induction we know that P (n) is true for all positive integers n. That is, we have proven that 1 + 2 + . . . + n = n(n + 1 )/2 for all positive integers n.

Page 5: 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,

Example

Page 6: 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,
Page 7: 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,
Page 8: 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,

Recursion

Page 9: 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,

Recursively Defined Functions Simplest case: One way to define a

function f:NS (for any set S) or series an=f(n) is to: Define f(0). For n>0, define f(n) in terms of f(0),

…,f(n−1).

Page 10: 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,

Another Example

Suppose we define f(n) for all nN recursively by:

Let f(0)=3For all nN, let f(n+1)=2f(n)+3

What are the values of the following?f(1)= 2f(0)+3=2.3+3=9

f(2)= 2f(1)+3=2.9+3=21 f(3)= 2f(2)+3=2.21+3=45 f(4)= 2f(3)+3=2.45+3=93

Page 11: 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,

Recursive definition of Factorial

Give a recursive definition of the factorial function F(n) : n!

Base case: F(0) : 1Recursive part: F(n) : n F(n-1).

F(1)=1 F(2)=2 F(3)=6

Page 12: 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,

The Fibonacci Series

The Fibonacci series fn0 is a famous series defined by:

f0 : 0, f1 : 1, fn2 : fn−1 + fn−2

0

1 1

2 3

5 8

13

Page 13: 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,

Example

Give a recursive definition of an, where a is a nonzero real number and n is a nonnegative integer.

Page 14: 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,

Example

Page 15: 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,

Recursive algorithm

Factorial Algorithmprocedure factorial( n: nonnegative integer)if n = 0

then factorial(n) : = 1else

factorial(n) := n ·factorial(n - 1 )

Page 16: 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,

Example

Algorithm to calculate an

procedure power(a : nonzero real number, n :

nonnegative integer)if n = 0

then power(a , n) : = 1else

power(a , n) := a · power(a , n - 1)

Page 17: 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,

Example

GCD Algorithmprocedure gcd(a , b: nonnegative integers with a < b)if a = 0

then gcd(a , b) := belse

gcd(a , b) := gcd(b mod a , a)

Page 18: 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,

THANK YOU


Recommended