Fibonacci Numbers and Recursion - psholtz/MIT-SICP GitHub Wiki

Exercise 1.13

Prove that Fib(n) is the closest integer to

Phi 1

where

Phi 2

Solution

It is worth noting that the linear operator defining the Fibonacci sequence is given by:

Fibonacci Linear Form

Fibonacci Linear Form

and that the eigenvalues of this operator are given by:

Phi 2

Phi 3

It is worth noting further that phi so defined is the famous golden ratio or golden mean.

First, let's show that:

Phi

which, even on its own, is a pretty cool formula (see also Fibonacci Numbers and Linear Operators).

We proceed by induction.

Beginning with Fib(n) as defined by the procedure:

(define (fib n)
  (cond ((= n 0) 0)
         ((= n 1) 1)
         (else (+ (fib (- n 1)) (fib (- n 2)))))

it is easily verified that:

Phi

and that

Phi

To prove the formula for higher n, we evaluate the expression for Fib(n) + Fib(n-1) and see whether it reduces to the expression we expect for Fin(n+1):

Fib

But by the definition of Fibonacci numbers, we must also have:

Phi

and so we conclude that:

Phi

In other words, if the expression holds true for Fib(n-1) and it holds true for Fib(n), it must hold true for Fib(n+1) as well, and the proof is established by induction.

Next, consider the expression:

Fib

Clearly, 0 = Fib(0) is the closest integer to this value.

Similarly, for n=1, we have:

Fib

and 1 = Fib(1) is the closest integer to this value.

For arbitrary n > 1, we have:

Fib

where

Fib

and so for n > 1, we must have:

Fib

which was to be proved.

Home