Recursive Definitions and Induction Proofs Rosen 3.4 More Fibonacci Numbers Prove f n n n n n 1 n 2 , n n 1
Download
Report
Transcript Recursive Definitions and Induction Proofs Rosen 3.4 More Fibonacci Numbers Prove f n n n n n 1 n 2 , n n 1
Recursive Definitions and
Induction Proofs
Rosen 3.4
More Fibonacci Numbers
Prove f n
n
n
n
n 1
n 2
,
n n 1 n 2
for n 2
Basis step, for n=2
1 ( 1)
f2
1
2
2
More Fibonacci Numbers
Inductive Step
Assume f
k
k
k
k
,
k
for 2 k n
Show
f n 1
n 1
n 1
k 1
k 1
k 2
k 2
More Fibonacci Numbers
f n 1 f n f n 1
n 1
n
n
n 1
n n n 1 n 1
n n 1 ( n n 1 )
n 1 n 1
More Fibonacci Numbers
n 1
But we showed before that if
then = (1+5)/2 .
More generally,
= (1+5)/2
= (1-5)/2
and is the golden ratio (often labeled f)!
n
n 2
,
Golden Ratio
b
a
c
b a
,c a b
a c
bc a , b(a b) a
2
2
a ab b 0
2
2
Try this
1 5
a b
b, a 2 ( 1)b 2
2
2
2
2
2
a ab b (a 1)b ab b
0
Thus gives the golden ratio.
Golden Ratio
What is fn+1/ fn as n gets very large?
Recall
fn
n
n
fn+1/ fn approaches
the golden ratio ()
as n gets very large!
= (1+5)/2
= (1-5)/2
What happens to n and n as n gets very large?
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) = f2*1 - 1 = f1 = 1 = f2
Inductive Step
Assume g(k) = f1 + f3 + … + f2k-1 = f2k for k n,
we must show that this implies g(n+1) = f2(n+1)
g(n+1) = f1 + f3 + … + f2n-1 + f2n+1
g(n+1) = g(n) + f2n+1
g(n+1) = f2n + f2n+1 = f2n+2 = f2(n+1)
Find a closed form solution for the recursive
definition: T(n) = T(n/2) + c1, T(1) = c0
where n is 2k for kN.
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
Proof of guess
Proof by Induction.
Basis Step: T(1) = c0 + c1log21 = c0 + c1*0 = 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)
Ackermann’s 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) =
Ackermann’s 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) =
Ackermann’s 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) =
Ackermann’s 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
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
Basis step: When m = 1, A(1,2) = A(0,A(1,1))
= A(0, 2) = 2*2 = 4
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(k+1, 2) = 4.
A(k+1,2) = A(k,A(k+1,1) = A(k,2) = 4
1 1
LetA
1 0
When n is a
positive
integer,
show that
f n 1 f n
A
f
f
n
n1
n
Basis step: n = 1, remember f0 =0, f1 =1, f2 =1
1 1 f 2
A
1
0
f 1
1
f 1 f 11 f 1
f 0
f 1 f 11
1 1
LetA
1 0
When n is a
positive
integer,
show that
f n 1 f n
A
f
f
n
n1
Inductive step:
f n 1
n
Assume that A
f n
We must show that A
n1
n
f n
f n1
f n11 f n 1
f n1 f n 11
A
n1
1 1f n1 f n
AA
1
0
f n f n 1
f n1 f n
f n 1
n
f n f n 1 f n 2
f n
f n1
f n11 f n1
f
f
n1
n 11
f n1
f n
1 n
n 1
j1 j(j 1)
n
Prove that
Proof:
Basis Step: For n = 1 we get 1/(1(1+1)) = 1/2 for both
the sum and the closed form.
Inductive Step:
Assume that n 1 n
n 1
j1 j(j 1)
We must show that
1 n 1
n 2
j1 j(j 1)
n1
1
j1 j(j 1)
n1
1
1
n
1
n 1 (n 1)(n 2)
j1 j(j 1) (n 1)(n 2)
n
2
n
2
n
1
n
2n 1
n 1n 1 n 1
(n 1)(n 2) n 1n 2 n 1n 2 n 2