Induction and Recursion CMPS/MATH 2170: Discrete Mathematics - - PowerPoint PPT Presentation

β–Ά
induction and recursion
SMART_READER_LITE
LIVE PREVIEW

Induction and Recursion CMPS/MATH 2170: Discrete Mathematics - - PowerPoint PPT Presentation

Induction and Recursion CMPS/MATH 2170: Discrete Mathematics Outline Mathematical induction (5.1) Strong induction (5.2) Recursive definitions (5.3) Recurrence Relations (8.1) Principle of Mathematical Induction Want to know


slide-1
SLIDE 1

Induction and Recursion

CMPS/MATH 2170: Discrete Mathematics

slide-2
SLIDE 2

Outline

  • Mathematical induction (5.1)
  • Strong induction (5.2)
  • Recursive definitions (5.3)
  • Recurrence Relations (8.1)
slide-3
SLIDE 3

Principle of Mathematical Induction

  • Want to know if we can reach every step on a

infinite ladder

  • Suppose we know two things
  • 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

  • Can we conclude that we can reach every rung?
slide-4
SLIDE 4

Mathematical Induction

  • Want to show: βˆ€π‘œ ∈ β„€%: 𝑄 π‘œ

Proof by induction on π‘œ

  • Base case: verify that 𝑄(1) is true
  • Inductive step: show that 𝑄 𝑙 β†’ 𝑄 𝑙 + 1 for any 𝑙 ∈ β„€%

Inductive hypothesis: Assume 𝑄(𝑙) is true Want to prove 𝑄 𝑙 + 1 is true

slide-5
SLIDE 5

Examples of Mathematical Induction

Ex.1: Sums of Arithmetic Progressions Ex.2: Sums of Geometric Progressions βˆ€π‘œ ∈ β„€%: / 𝑗

1 234

= π‘œ(π‘œ + 1) 2 βˆ€π‘œ ∈ β„•: / 𝑑2

1 239

= 𝑑1%4 βˆ’ 1 𝑑 βˆ’ 1 where 𝑑 β‰  1

slide-6
SLIDE 6

More about Mathematical Induction

  • Why Mathematical Induction is valid?
  • Implied by the Weak Ordering Property:

β€œEvery nonempty subset of β„€% has a least element”

  • Pros
  • Can be used to prove a wide variety of β€œforall” conjectures
  • Easy to follow
  • Cons
  • Cannot be used to find new theorems
  • Lack of insight

𝑄(1) βˆ€π‘™ ∈ β„€%: 𝑄 𝑙 β†’ 𝑄 𝑙 + 1 βˆ€π‘œ ∈ β„€%: 𝑄 π‘œ

∴

slide-7
SLIDE 7

More Examples

  • Ex. 3: Prove π‘œ= < 21 for all integers π‘œ > 4
  • Ex. 4: Prove that a finite set with π‘œ elements has 21 subsets
  • Ex. 5: Prove that every amount of postage of 12 cents or more can be formed

using just 4-cent and 5-cent stamps.

slide-8
SLIDE 8

Mathematical Induction

  • Want to prove 𝑄 π‘œ is true for π‘œ = 𝑐, 𝑐 + 1, 𝑐 + 2, … , where 𝑐 ∈ β„€

Proof by induction on π‘œ:

  • Base case: verify that 𝑄(𝑐) is true
  • Inductive step: show that 𝑄 𝑙 β†’ 𝑄 𝑙 + 1 for any 𝑙 = 𝑐, 𝑐 + 1, 𝑐 + 2, …
slide-9
SLIDE 9

Outline

  • Mathematical induction (5.1)
  • Strong induction (5.2)
  • Recursive definitions (5.3)
  • Recurrence Relations (8.1)
slide-10
SLIDE 10

Strong Induction

  • Want to prove: βˆ€π‘œ ∈ β„€%: 𝑄 π‘œ

Proof by (weak) induction on π‘œ:

  • Base case: verify that 𝑄(1) is true
  • Inductive step: show that 𝑄 𝑙 β†’ 𝑄 𝑙 + 1 for any 𝑙 ∈ β„€%

Proof by strong induction on π‘œ:

  • Base case: verify that 𝑄(1) is true
  • Inductive step: show that [𝑄 1 ∧ 𝑄 2 ∧ … ∧ 𝑄 𝑙 ] β†’ 𝑄 𝑙 + 1 for any 𝑙 ∈ β„€%
slide-11
SLIDE 11

Strong Induction

  • A more general form of strong induction
  • Base step: verify that 𝑄 𝑐 , 𝑄 𝑐 + 1 , … 𝑄(𝑐 + π‘˜) are true
  • Inductive step: Assume [𝑄 𝑐 ∧ 𝑄 𝑐 + 1 ∧ … ∧ 𝑄 𝑙 ] is true, prove 𝑄 𝑙 + 1 is

true for every integer 𝑙 β‰₯ 𝑐 + π‘˜

slide-12
SLIDE 12

Examples of Strong Induction

Fibonacci Sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, … 𝑔

9 = 0, 𝑔 4 = 1,

𝑔

1 = 𝑔 1K4 + 𝑔 1K=, π‘œ β‰₯ 2

This is called a recursive definition Ex.1: 𝑔

1 ≀ 21 for all π‘œ β‰₯ 0

  • Ex. 2: 𝑔

1 > 𝛽1K= for any π‘œ β‰₯ 3 where 𝛽 = (1 +

5

  • )/2

wikipedia

Initial conditions Recurrence relation

slide-13
SLIDE 13

Outline

  • Mathematical induction (5.1)
  • Strong induction (5.2)
  • Recursive definitions (5.3)
  • Recurrence Relations (8.1)
slide-14
SLIDE 14

Recursively Defined Sequences

  • Fibonacci Sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, …

𝑔

9 = 0, 𝑔 4 = 1,

𝑔

1 = 𝑔 1K4 + 𝑔 1K=, π‘œ β‰₯ 2

  • A sequence of powers of 2: 1, 2, 4, 8, 16, 32 …

An explicit formula: 𝑏1 = 21, π‘œ β‰₯ 0 A recursive definition: 𝑏9 = 29, 𝑏1 = 2𝑏1K4, π‘œ β‰₯ 1

Recurrence relation Recurrence relation Initial conditions Initial condition

slide-15
SLIDE 15

Recursively Defined Functions

  • A recursive definition of 𝑔: β„• β†’ 𝐡, β„• = {0,1,2, 3 … }
  • Base step: specify 𝑔 0
  • Recursive step: specify 𝑔 π‘œ in terms of 𝑔 0 , 𝑔 1 , … , 𝑔(π‘œ βˆ’ 1), for any π‘œ β‰₯ 1
  • Ex.1: Give a recursive definition of 𝑔 π‘œ = π‘œ!
  • Ex.2: Give a recursive definition of 𝑔 π‘œ = βˆ‘

𝑏2,

1 239

where 𝑏2 2βˆˆβ„• is a given sequence

slide-16
SLIDE 16

Recursively Defined Sets

  • Consider a set 𝑇 βŠ† β„€% recursively defined by
  • Base step: 3 ∈ 𝑇
  • Recursive step: if 𝑦 ∈ 𝑇 and 𝑧 ∈ 𝑇, then 𝑦 + 𝑧 ∈ 𝑇
  • Show that the set 𝑇 is the set of all positive integers divided by 3
  • 𝐡 = π‘œ ∈ β„€%: 3 π‘œ
  • 𝐡 βŠ† 𝑇: prove by mathematical induction
  • 𝑇 βŠ† 𝐡: prove by structural induction
slide-17
SLIDE 17

Structural induction

  • Want to prove a result for a recursively defined set
  • Base step: show that the result holds for all base cases in the recursive

definition

  • Inductive step: show that if the statement is true for each of the elements used

to construct new elements in the recursive step, the result holds for the new elements

slide-18
SLIDE 18

Outline

  • Mathematical induction (5.1)
  • Strong induction (5.2)
  • Recursive definitions (5.3)
  • Recurrence Relations (8.1)
slide-19
SLIDE 19

The Tower of Hanoi

Task: Move the stack of disks from peg 1 to peg 3 subject to the following rules:

  • Move one disk at a time
  • Only the uppermost disk on a stack can be moved
  • No disk can be placed on top of a smaller disk

Question: how many steps are needed?

slide-20
SLIDE 20

The Tower of Hanoi

By AndrΓ© Karwath aka Aka - Own work, CC BY-SA 2.5, https://commons.wikimedia.org/w/index.php?curid=85401

slide-21
SLIDE 21

The Tower of Hanoi

  • 𝐼1 - number of moves needed to solve the

Tower of Hanoi with π‘œ disks

  • Divide & Conquer

𝐼4 = 1 𝐼1 = 2𝐼1K4 + 1, π‘œ β‰₯ 2

  • How to find an explicit formula for 𝐼1?
  • Expand the recurrence iteratively and then make

a conjecture: 𝐼1 = 21 βˆ’ 1

  • 264 βˆ’ 1 seconds β‰ˆ 585 billion years
  • Proof by mathematical induction

π‘œ βˆ’ 1 disks

𝐼1K4 𝐼1K4

1 move

Recurrence relation