17
Induction & recursion CS 330 : Discrete structures

Induction - Illinois Institute of Technology

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Induction - Illinois Institute of Technology

Induction & recursionCS 330 :Discrete structures

Page 2: Induction - Illinois Institute of Technology

Many conjectures have the form : An EMP

Mathematical induction is a technique for proving conjecturesof this form based on the rule of inference :

assuming

fPG) ( basis ] a

amber tknh.fi#gajlmaiaimaep3&IIka7eismfFtwsis.s,prone Plntl) must

arbitrary Pcd , it Pln) be true

depending ondomain of proof

Page 3: Induction - Illinois Institute of Technology

Whit

.info?eyf7anuthahw-?e.canreaehanyrunga and

"

II¥E:q; %5a.tn?:mgIE:*( I

Page 4: Induction - Illinois Institute of Technology

e.

g. provethat Hn (20+2't . . .tt =3"- I)

Pln) : 272't . .- tz"-_zhttl

basis : Plo) : 20=2" '- I

surprisingly!isn't""

uh

whatmene

tryingto

1 = 2 - I = I ✓prove?

(''a'radar

masonryinductive step : show that Pcu)→ Platt)--1272't . .

.tt = It'- I [ inductive hypothesis]

add It ' to both sides

20+2't . . -+It2*1=2*11+2^+1 "

quod wat

=2(It'

) - I denronstrandnm"

=L"- I aE¥orI )

Page 5: Induction - Illinois Institute of Technology

e.

g. provethat Fn Z 5

,2" > n'

Pcn) : 2"7h2

basis : PCs) : 25 > 5232 > 25 ✓

inductive sleep : show Pln)→ pcut 1)

assume Pln) : I > n' [inductive hypothesis]

2*1 = 2 . I

> zu- ( by/]

= ft U2

Z nZ t5h [ since UZ 5 ]> X t2h t I = (ut 1)

2

QED .

Page 6: Induction - Illinois Institute of Technology

e.g.Fibonacci sequence

: F,= I

,E = I

,Fn = Fn - it Fn-z for n >2

I , I , 2 , 3 ,5,8,13

,21,

.--

phone that F, tfz tFst

. . .

t Fac- I= Fak for nZ l

basis : Pci) : F, = I = E V

inductive step : assume Fi tFs t . .. Fac - I

= Fzk

add Fact , to each side

Fi tFs t. . .tfk- I tFzkt I

=Fzkt Fact I

= Fzkt2

=

Fzfkti) QED

Page 7: Induction - Illinois Institute of Technology

e.g. , what is the maximum# of pieces into which we candivide a circularpizza usingen straight arts ?

cats additional total

(n) pieces pieces①

3 311

4 4

⑤5

5 16

③ pieces(n)= It ltzt . .

.tn

= I t(n⇒n= It n-thlinen can intersect z

③ atmost n- I other lines , = n2tnt2④

creating n new piecesI

Page 8: Induction - Illinois Institute of Technology

e-g., pronethat the maximum# of pieces into which we can divide

n't n t 2a circular pizza using n straight

arts is-Z

basis : O cuts = 0tOt2 = I piece VZ

inductive step : assume for u cuts = n2tnzt2 piecesfor ntl outs =n22 t nt l

Z

= n't 3h t4 =n't2ht l tht 3--Z Z

=(nH)Zt (htt)tz-

Z

QED .

Page 9: Induction - Illinois Institute of Technology

e-g. , phonethat all cats are the same size (aka cats are liquid)

Pla) : for any sort of u cats ,all the catsarethe samesin

.

basis : PH V

Tinductive sleep : assume Pcn)

② , Cz , . . . ,Cn are the same size

this worksof ④ ,Cs,. .

.

,cut, are the same sin

PG) → PG) ,--

PG)→P(4) , ..

.

n cats

butwhat aboutwe kno Ice) QE)

pay →plz) ? - takecare tofish outall requiredbase cases !

Page 10: Induction - Illinois Institute of Technology

strong induction is a variant of mathematical widvduinwhere we prone conjectures of the same form (fnE IN PCn) ),but up a different hypothesis in the widedine sleep :

PG) (basis ]

(tKE n P(K)) → Plnti) [inductive dep ]-

tn Pln) ( proof goal ]

Page 11: Induction - Illinois Institute of Technology

Intuition : to provethat we can reach

any rungonand

infinitely tall ladder . .

,-a:*:

:c; ÷:÷:÷s÷;

Page 12: Induction - Illinois Institute of Technology

e.g . every integer n > I is either prime or a product of primes .Pln) = n is eitherprime or a product of primesbasis : PG) - z is prime V

inductive shop : assume Pfk) is true for zs k sn ( inductive

show Rnti) must holdhypothesis]

case l : ntl is prime

case2 : UH is not prime- this means there are two integers a, bwhere n H = ab and 2 E a

,b En

- a,b are prime or product of primes (dueto I.H

.

) so nH is prime or productofprimes .

QED

Page 13: Induction - Illinois Institute of Technology

e.g. , prove that anyamount of n28 can be made with

denominations of 3 and 5

6,°s6, EE

f = 3+5 9 = 3+3+3 10=5+5 11 = 3+3 t5 12 = 3+3+3+3

basis : pls) V

inductive sleep : show that Pcn)→Kuti)

(weak assume Pln) ; to satisfy Parti)induction) case 1 : amount n uses at least one

5

- remove 5 , replace M two 3s

case 2: amount n uses no5s QED .

- remove three 3s (must exist , sincen Z 8) replace M two 5s

Page 14: Induction - Illinois Institute of Technology

e.g. , prove that anyamount of n28 can be made with

denominations of 3 and 5

6,°s6, EE EE

f = 3+5 9 = 3+3+3 10=575 11=3+3 t5 12=3+3+3+3

i.it .basis : PCs)

,Pla)

,Pho)

,PUD , Paz) f

inductive sleep : assume Pcu) istrue for 8 En Ek , where k> 12

(strong induction) to make the amount ktl,we can simply

add 5 to K-4,where PCK-4) is true

due to the t.tt .

QED .

Page 15: Induction - Illinois Institute of Technology

the approach used in a proof by mathematical induction canalso be used to define functions with domain IN .

e.g . flo) = I [ base can] } factorialfunctionf(nti) = (nti) . f(u) ( recursive definition] fun ,

n!

such recursively defined functions are well -defined forall values of the domain .

- induction is a great fit for proving properties offunctions defined in this way !

Page 16: Induction - Illinois Institute of Technology

list the first six terms in the range off :iN→N , where

flo) -- O

f-(NH) -- 2. flu) th

f-6) = o f- (3) = 2 . I t 2=4

fll) = 2 - o to = O f(4) = 2.4 +3 = II

fly = 2 - o t I = I f- (5) = z - Ift 4=26

Page 17: Induction - Illinois Institute of Technology

prone that this function evaluates to I - n - l for all n E IN

flo) = 0

f-(nti) -- 2. flu) t n

basis : flo) = 20- o - I = 0

inductive sleep : flu) = 2"- n - I [ inductive hypothesis]

flat D= 2. (2" - n - 1) tu= zntl - zu - z tu= zn

H- u -Z

= It'- (n+ i) - I QED .