Recursive Definitions and Induction Proofs - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Recursive Definitions and Induction Proofs

Description:

... a closed form solution for the recursive definition: T(n) = T(n/2) c1, T(1) = c0. ... Basis Step: T(1) = c0 c1log21 = c0 c1*0 = c0 ... – PowerPoint PPT presentation

Number of Views:103
Avg rating:3.0/5.0
Slides: 16
Provided by: Hod69
Category:

less

Transcript and Presenter's Notes

Title: Recursive Definitions and Induction Proofs


1
Recursive Definitions and Induction Proofs
  • Rosen 3.3

2
Prove that the function g(n) f1 f3
f2n-1 (where fi is a Fibonacci number) is equal
to f2n whenever n is a positive integer.
  • Basis Step
  • If n 1, then g(1) f21 - 1 f1 1 f2
  • Inductive Step
  • Assume g(k) f1 f3 f2k-1 f2k for k ?
    n, we must show that this implies g(n1)
    f2(n1)
  • g(n1) f1 f3 f2n-1 f2n1
  • g(n1) f(n) f2n1
  • g(n1) f2n f2n1 f2n2 f2(n1)

3
Find a closed form solution for the recursive
definition T(n) T(n/2) c1, T(1) c0.
  • (Hint look only at ns that are powers of 2.)
  • T(1) c0
  • T(2) T(1) c1 c0 c1
  • T(4) T(2) c1 c0 c1 c1 c0 2c1
  • T(8) T(4) c1 c0 2c1 c1 c0 3c1
  • T(16) T(8) c1 c0 3c1 c1 c0 4c1
  • Guess that T(n) c0 c1log2n

4
Proof of guess
  • Proof by Induction.
  • Basis Step T(1) c0 c1log21 c0 c10 c0
  • Inductive Step Assume that T(n) c0 log2nc1,
    then we must show that T(2n) c0 c1log2(2n) .
  • T(2n) T(n) c1
  • c0 c1log2n c1
  • c0 c1log2n c1log22 c0 c1(log2n log22)
  • c0 c1log2(2n)

5
Ackermanns Function
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • A(1,0) 0
  • A(0,1)
  • A(2,2)
  • A(1,1)

6
Ackermanns Function
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • A(1,0) 0
  • A(0,1) 2
  • A(2,2)
  • A(1,1)

7
Ackermanns Function
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • A(1,0) 0
  • A(0,1) 2
  • A(2,2) A(1,A(2,1)) A(1,2) A(0,A(1,1))
    A(0, 2) 4
  • A(1,1)

8
Ackermanns Function
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • A(1,0) 0
  • A(0,1) 2
  • A(2,2) A(1,A(2,1)) A(1,2) A(0,A(1,1))
    A(0, 2) 4
  • A(1,1) 2

9
Show that A(m,2) 4 whenever m ? 1
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • Basic Case When m 1, A(1,2) A(0,A(1,1)
    A(0, 2) 22 4

10
Show that A(m,2) 4 whenever m ? 1
  • A(m,n) 2n if m 0
  • 0 if m ? 1 and n 0
  • 2 if m ? 1 and n 1
  • A(m-1, A(m,n-1) if m ? 1 and n ? 2
  • Inductive Step
  • Assume that A(j,2) 4 for 1? j ? k. We must
    show that A(k1, 2) 4.
  • A(k1,2) A(k,A(k1,1) A(k,2) 4

11
When n is a positive integer, show that
  • Basic case n 1, remember f0 0, f1 1, f2 1

12
When n is a positive integer, show that
  • Inductive Case
  • Assume that
  • We must show that

13
(No Transcript)
14
Prove that
  • Proof
  • Basic Step For n 1 we get 1/(1(11)) ½ for
    both the sum and the closed form.
  • Inductive Step
  • Assume that
  • We must show that

15
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com