Showing posts with label fibonacci. Show all posts
Showing posts with label fibonacci. Show all posts

Saturday, March 3, 2012

Fibonacci from golden ratio using power series



While reading about Fibonacci series, I came across the formula which gives the Fibonacci number using golden ratios. I was curious about how did such an equation was derived and how could it give the answer so correctly. This problem introduced me to the world of generating function. I will start with a few definitions.

A formal power series is an expression of the form
a+ a1x + a2x+ …
where a is a coefficient.

A generating function is a formal power series whose coefficients give the sequence { a0, a1, a2, … }. A general idea is as follows. In counting problems we are often interested in counting the number of objects of size , which we represent represent as a. By varying n, we get different values of an. In this way, we get a sequence of real numbers a0, a1, a2, … 
from which we can define a power series
G(x) = a+ a1x + a2x+ …

The above G(x) is the generating function for the sequence a0, a1, a2, … 

Let us find an explicit formula for finding nth element of the fibonacci series
First, we will define some useful results.
1 and -ϕ2 be roots of the equation (x+ x – 1)
ϕ= (1 + √5)/2 and ϕ2 = (1  √5)/2
Therefore, ϕ ϕ√5  .......(1)
and ϕ1.ϕ1 .........(2)
We know that for a fibonacci number Fn,
Fn = Fn-1 + Fn-2
or Fn  Fn-1 – Fn-2  = 0
F0 = 0, F1 = 1.
Let the generating function for Fn be  
F(x) = F0 + F1x + F2x2 + F3x+ ...
Now, multiplying F(x) with 1, -x and -xand, adding them
                   F(x) = F1x + F2x+ F3x+ ...
                –xF(x) =       – F1x2 – F2x–  F3x4 ...
               –x2F(x) =                  – F1x3– F2x– F3x5 ...
_____________________________________________
(1 – x  – x2).F(x) = x    + 0       + 0     + 0 ....
or F(x) = –x/(x+ x – 1)

Using partial fractions, we decompose 
F(x) = A/(x + ϕ1) + B/(x + ϕ2)
or –x/(x+ x – 1) = A/(x + ϕ1) + B/(x + ϕ2)
or -x = A(x + ϕ2) + B(x + ϕ1)
Putting x = -ϕ2, we have ϕ= B(-ϕ2 + ϕ1),
or B = ϕ2/√5
Putting x = -ϕ1, we have ϕ1 = A(-ϕ1 + ϕ2),
or A= -ϕ1/√5


Therefore,
F(x) = (-ϕ1/√5)/(x + ϕ1) + (ϕ2/√5)/(x + ϕ2)
       = -(1/√5)/(1 + x/ϕ1) + (1/√5)/(1 + x/ϕ2)
       = -(1/√5)/(1 - xϕ2) + (1/√5)/(1 - xϕ1)             [From 2]
       = -(1/√5)Σ(xϕ2)+ (1/√5)Σ(xϕ1)n                 [From the equation for summation of G.P series] 
       = (1/√5)Σ(ϕ1n - ϕ2n)xn


Therefore, the coefficient of xwill give Fn


Finally, we have
Fn = (1/√5)(ϕ1ϕ2n)

To learn more about generating functions check this out.