prev

next

out of 34

View

217Download

0

Embed Size (px)

7/31/2019 09 Mathematical Induction

1/34

1

Mathematical Induction

CS 202

Epp, chapter 4Aaron Bloomfield

7/31/2019 09 Mathematical Induction

2/34

2

How do you climb infinite stairs?

Not a rhetorical question!

First, you get to the base platform of thestaircase

Then repeat:

From your current position, move one step up

7/31/2019 09 Mathematical Induction

3/34

3

Lets use that as a proof method

First, show P(x) is true for x=0 This is the base of the stairs

Then, show that if its true for some value n, then it istrue for n+1 Show: P(n) P(n+1)

This is climbing the stairs Let n=0. Since its true for P(0) (base case), its true for n=1 Let n=1. Since its true for P(1) (previous bullet), its true for n=2 Let n=2. Since its true for P(2) (previous bullet), its true for n=3 Let n=3

And onwards to infinity

Thus, we have shown it to be true for allnon-negativenumbers

7/31/2019 09 Mathematical Induction

4/34

4

What is induction?

A method of proof It does not generate answers:

it only can prove them

Three parts: Base case(s): show it is true

for one element (get to the stairs base platform)

Inductive hypothesis: assumeit is true for any given element

(assume you are on a stair) Must be clearly labeled!!!

Show that if it true for the nexthighest element

(show you can move to the nextstair)

7/31/2019 09 Mathematical Induction

5/34

5

Show that the sum of the first n oddintegers is n2

Example: If n= 5, 1+3+5+7+9 = 25 = 52

Formally, show:

Base case: Show that P(1) is true

Induction example

n

i

ni

1

212

11

11)(21

1

2

i

i

)P(where)P( nnn

)1P(

7/31/2019 09 Mathematical Induction

6/34

6

Inductive hypothesis: assume true for k

Thus, we assume that P(k) is true, or that

Note: we dont yet know if this is true or not!

Inductive step: show true for k+1 We want to show that:

k

i

ki1

212

1

1

2)1(12

k

i

ki

Induction example, continued

7/31/2019 09 Mathematical Induction

7/34

7

12121)1(2

2

1

kkik

k

i

121)1(222

kkkk

Induction example, continued

Recall the inductive hypothesis:

Proof of inductive step:

k

i

ki

1

212

121222

kkkk

21

1

)1(12

ki

k

i

7/31/2019 09 Mathematical Induction

8/34

8

What did we show

Base case: P(1) If P(k) was true, then P(k+1) is true

i.e., P(k) P(k+1)

We know its true for P(1)

Because of P(k) P(k+1), if its true for P(1), then its true for P(2) Because of P(k) P(k+1), if its true for P(2), then its true for P(3) Because of P(k) P(k+1), if its true for P(3), then its true for P(4)

Because of P(k) P(k+1), if its true for P(4), then its true for P(5) And onwards to infinity

Thus, it is true for all possible values of n

In other words, we showed that:

)P()1P()P()1P( nnkkk

7/31/2019 09 Mathematical Induction

9/34

9

The idea behind inductive proofs

Show the base case

Show the inductive hypothesis

Manipulate the inductive step so that youcan substitute in part of the inductivehypothesis

Show the inductive step

7/31/2019 09 Mathematical Induction

10/34

10

Second induction example

Show the sum of the first npositive evenintegers is n2 + n

Rephrased:

The three parts:

Base case

Inductive hypothesis

Inductive step

n

i

nninnn

1

22)P(where)P(

7/31/2019 09 Mathematical Induction

11/34

11

Second induction example,continued

Base case: Show P(1):

Inductive hypothesis: Assume

Inductive step: Show

22

11)(2)1P(1

1

2

i

i

k

i

kkik

1

22)P(

)1()1(2)1P(2

1

1

kkik

k

i

7/31/2019 09 Mathematical Induction

12/34

12

232322

kkkk

1)1()1(222

kkkkk

1)1(2)1(22

1

kkik

k

i

1)1(22

1

1

kki

k

i

Second induction example,continued

Recall our inductivehypothesis:

k

i

kkik

1

22)P(

7/31/2019 09 Mathematical Induction

13/34

13

Notes on proofs by induction

We manipulate the k+1 case to make partof it look like the kcase

We then replace that part with the otherside of the kcase

k

i

kkik

1

22)P(

232322

kkkk

1)1()1(222

kkkkk

1)1(2)1(22

1

kkik

k

i

1)1(22

1

1

kki

k

i

7/31/2019 09 Mathematical Induction

14/34

14

Third induction example

Show

Base case: n= 1

Inductive hypothesis: assume

6

)12)(1(

1

2

nnni

n

i

11

6

61

6)12)(11(1

2

1

1

2

i

i

6

)12)(1(

1

2

kkki

k

i

7/31/2019 09 Mathematical Induction

15/34

15

Third induction example

Inductive step: show6

)1)1(2)(1)1)((1(1

1

2

kkki

k

i

6

)32)(2)(1()1(

1

22

kkkik

k

i

61392613922323

kkkkkk

)32)(2)(1()12)(1()1(62

kkkkkkk

6)32)(2)(1(

6)12)(1()1(

2 kkkkkkk

6

)1)1(2)(1)1)((1(1

1

2

kkki

k

i

6

)12)(1(

1

2

kkk

i

k

i

7/31/2019 09 Mathematical Induction

16/34

16

Third induction again: what if yourinductive hypothesis was wrong?

Show:

Base case: n= 1:

But lets continue anyway

Inductive hypothesis: assume

6

)22)(1(

1

2

nnni

n

i

6

71

6

71

6

)22)(11(1

2

1

1

2

i

i

6

)22)(1(

1

2

kkki

k

i

7/31/2019 09 Mathematical Induction

17/34

17

Third induction again: what if yourinductive hypothesis was wrong?

Inductive step: show6

)2)1(2)(1)1)((1(1

1

2

kkki

k

i

6

)42)(2)(1()1(

1

22

kkkik

k

i

8161026141022323

kkkkkk

)42)(2)(1()22)(1()1(62

kkkkkkk

6)42)(2)(1(

6)22)(1()1(

2 kkkkkkk

6

)2)1(2)(1)1)((1(1

1

2

kkki

k

i

6

)22)(1(

1

2

kkk

i

k

i

7/31/2019 09 Mathematical Induction

18/34

18

Fourth induction example

S that n! < nn for all n> 1

Base case: n= 22! < 22

2 < 4

Inductive hypothesis: assume k! < kk

Inductive step: show that (k+1)! < (k+1)k+1

)!1( k

!)1( kk

kkk)1(

k

kk)1)(1(

1

)1(

kk

7/31/2019 09 Mathematical Induction

19/34

19

Strong induction

Weak mathematical induction assumesP(k) is true, and uses that (and only that!)to show P(k+1) is true

Strong mathematical induction assumesP(1), P(2), , P(k) are all true, and uses

that to show that P(k+1) is true.

)1P()P(...)3P()2P()1P( kk

7/31/2019 09 Mathematical Induction

20/34

20

Strong induction example 1

Show that any number > 1 can be writtenas the product of one or more primes

Base case: P(2) 2 is the product of 2 (remember that 1 is not

prime!)

Inductive hypothesis: assume P(2), P(3),, P(k) are all true

Inductive step: Show that P(k+1) is true

7/31/2019 09 Mathematical Induction

21/34

21

Strong induction example 1

Inductive step: Show that P(k+1) is true

There are two cases:

k+1 is prime

It can then be written as the product of k+1

k+1 is composite

It can be written as the product of two composites,

a and b, where 2 ab< k+1 By the inductive hypothesis, both P(a) and P(b) are

true

7/31/2019 09 Mathematical Induction

22/34

22

Strong induction vs. non-stronginduction

Determine which amounts of postage canbe written with 5 and 6 cent stamps

Prove using both versions of induction

Answer: any postage 20

7/31/2019 09 Mathematical Induction

23/34

23

Answer via mathematical induction

Show base case: P(20):

20 = 5 + 5 + 5 + 5

Inductive hypothesis: Assume P(k) is true

Inductive step: Show that P(k+1) is true If P(k) uses a 5 cent stamp, replace that stamp with a

6 cent stamp

If P(k) does not use a 5 cent stamp, it must use only 6

cent stamps

Since k> 18, there must be four 6 cent stamps

Replace these with five 5 cent stamps to obtain k+1

7/31/2019 09 Mathematical Induction

24/34

24

Answer via strong induction

Show base cases: P(20), P(21), P(22), P(23), and P(24)

20 = 5 + 5 + 5 + 5

21 = 5 + 5 + 5 + 6

22 = 5 + 5 + 6 + 6

23 = 5 + 6 + 6 + 6

24 = 6 + 6 + 6 + 6

Inductive hypothesis: Assume P