You are on page 1of 7

The Fibonacci Sequence and Recursion

(Handout April 16, 2012)


The Fibonacci sequence
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, . . .
is defined recursively by
Fn =

1,
Fn1 + Fn2 ,

for n {0, 1};


for n 2.

Note that the first two terms in the sequence are defined explicitly; thereafter, each term
is the sum of the previous two terms. This is an example of a recursive definition. In order
to evaluate F100 using this definition, we would first have to evaluate the previous hundred
terms in the sequence. We will soon find a closed form expression for Fn which does not
require evaluation of all the previous terms in the sequence in order to find a given term.
Both recursion and induction may be described as chain reactions; the difference is
that mathematical induction is used to prove an infinite sequence of statements, whereas
recursion is used to define an infinite sequence of quantities. The connection is a close one;
and in order to prove facts about recursively defined sequences, it is natural to try to use
induction. The following is an example of a fact about Fibonacci numbers, which we prove
by induction.
Theorem. For every n 1, we have Fn2 = Fn+1 Fn1 + (1)n .
Proof. The result holds for n = 1 since F12 = 11 = 1 = 21 1 = F2 F0 + (1)1 . Now
assume that the result holds for n = k, i.e. Fk2 = Fk+1 Fk1 + (1)k where k is some
positive integer. Then
2
Fk+1
= (Fk + Fk1 )Fk+1

(using the recursive formula for Fn )

= Fk+1 Fk + Fk+1 Fk1


= Fk+1 Fk + Fk2 (1)k

(by the inductive hypothesis)

= (Fk+1 + Fk )Fk + (1)k+1

= Fk+2 Fk + (1)k+1

(again using the recursive formula for Fn )


1

so that the result holds for n = k + 1 whenever it holds for n = k. By induction, the
identity holds for all n 1 as required.

We now derive a closed formula for Fn , i.e. an explicit formula not requiring recursion.
The entire sequence is embodied in the series
f(x) =

n=0

Fn xn = 1 + x + 2x2 + 3x3 + 5x4 + 8x5 + 13x6 + 21x7 + .

The idea is to find a simple way of evaluating f(x), from which we can identify all coefficients in the series for f(x). In order to make use of the recursion formula for Fn , we
write

X
f(x) = 1 + x +
Fn+2xn+2
n=0

=1+x+

(Fn+1 + Fn )xn+2

Fn+1xn+2 +

n=0

=1+x+

n=0

=1+x+x

Fn xn+2

n=0
n+1

Fn+1 x

+x

n=0

Fn xn

n=0

= 1 + x + x f(x) 1 + x f(x)
which can be solved for f(x):
f(x) =

1
.
1 x x2

Thus f(x) is a rational function in x, i.e. a quotient of two polynomials in x. If we can


compute the coefficients in the Taylor series of this function, then we will have a formula
for Fn . However, it is not necessary to know anything about Taylor series to solve this
problem; all we need is a little algebra skill, and one very basic series, the geometric series
1
= 1 + x + x2 + x3 + x4 + .
1x
Even if you havent seen (or dont remember) this series, you can quickly verify it by
cross-multiplying:
(1 x)(1 + x + x2 + x3 + ) = 1 x + x x2 + x2 x3 + x3 + = 1.
2

This suggests possibly writing


f(x) =

1
1 (x + x2 )

= 1 + (x+x2 ) + (x+x2 )2 + (x+x2 )3 + (x+x2 )4 +


= 1 + (x+x2 ) + (x2 +2x3 +x4 ) + (x3 +3x4 +3x5 +x6 ) + (x4 + ) +
= 1 + x + 2x2 + 3x3 + 5x4 +
which is encouraging since we see the Fibonacci numbers appearing as coefficients; however,
this doesnt seem to lead to an explicit formula for the Fibonacci numbers. A better idea
is to find a partial fraction decomposition of f(x). We first factor the denominator as
1 x x2 = (1 x)(1 x)
where

1 5
1+ 5
1.618033988, =
0.618033988 .
=
2
2
We may describe and as the reciprocal roots of the quadratic, rather than the roots
themselves; the reason why they are easier to use will soon become apparent. We try to
find constants A and B such that
1
1
A
B
=
=
+
.
2
1xx
(1 x)(1 x)
1 x 1 x
You may have seen this technique used in Calculus II; if not, keep in mind the basic idea,
which is as follows. The right hand side of the latter expression can be combined using a
common denominator to obtain a rational function whose denominator is (1 x)(1 x).
Instead what we want is the reverse process: to split up the rational function into two
terms, each having a single linear factor in the denominator. Multiplying both sides by
(1 x)(1 x) in order to clear denominators, we obtain the identity
1 = (1 x)A + (1 x)B.
This is a polynomial identity! so equality must hold if x is replaced by any constant. In
particular we evaluate at x = 1 since this causes the B term to vanish, thereby allowing
us to solve for A:




1= 1
A=
A=
A, so A = .

5
Similarly, evaluating at x =

causes the A term to vanish, allowing us to solve for B:

5
1= 1
B=
B=
B,

so B = .
5

This gives us the desired partial fraction decomposition of f(x):


A
B
1 

1
f(x) =
=
+
=

.
1 x x2
1 x 1 x
5 1 x 1 x
This is just what we need to expand f(x) as a power series: we expand both terms as
geometric series to obtain
i
1 h
f(x) = (1 + x + 2 x2 + 3 x3 + ) (1 + x + 2 x2 + 3 x3 + )
5

1 X n+1
=
(
n+1)xn .
5 n=0
Reading off the coefficient of xn gives
Fn =

n+1 n+1

for all n 0. All of this is demonstrated in the attached Maple worksheet.


Recall that the set of polynomials in x with real coefficients, forms the polynomial
ring R[x]. The set of rational functions in x with real coefficients is the field of rational
functions


f(x)
R(x) =
: f(x), g(x) R[x], g(x) 6= 0 .
g(x)
This is a field, not just a ring: it is closed under division. Here we see yet another analogy
between the ring Z of integers and the ring R[x] of polynomials: both rings can be extended
to fields by formally introducing quotients. We call Q the fraction field of Z; and R(x) is
the fraction field of R[x]. Note that R[x] R(x).
We also consider the set of all power series in x with real coefficients:


R[[x]] = a0 +a1 x+a2 x2 +a3 x3 + : a0 , a1 , a2 , a3 , . . . R .
This is not a field; it is a ring with R[x] R[[x]]. The latter inclusion follows from the fact
that every polynomial may be regarded as a power series where most of the coefficients
(all but finitely many) are zero.
Elements of R[x], or of R(x), or R[[x]], are first and foremost regarded as formal
objects. In some (but not all) cases, they may represent actual functions. You are quite
accustomed to using elements of R[x] and R(x) to represent functions; but we have tried to
also highlight applications where they are used in other ways without serving as functions.
1
An example is f(x) = 1xx
2 R(x) used above to find a closed formula for the Fibonacci
numbers. Never did we evaluate f(a) for any number a R; so the popular term rational
function is misleading.
4

This point is even more important when studying power series. In order to study an
arbitrary sequence a0 , a1 , a2 , a3 , . . ., it is often useful to study instead the associated power
series

X
g(x) =
an xn = a0 + a1 x + a2 x2 + a3 x3 + ,
n=0

popularly known as the generating function of the original sequence. In many cases this
does not represent a function at all; so in general, the name generating function is quite
a misnomer. For example the factorial sequence gives rise to a power series

X
p(x) =
n!xn = 1 + x + 2x2 + 6x3 + 24x4 + 120x5 + .
n=0

The values p(a) are undefined for any nonzero real number a, although the series itself is
a perfectly useful and interesting object. An important part of Calculus II is devoted to
the study of when a given power series converges, and so represents an actual function;
but none of this is relevant to our discussion! In the case of the series for f(x) defined
above, it turns out that the series does converge on a suitable open interval centered at 0;
but we dont care about this. Some sources may refer to power series in our setting as
formal power series to emphasize the role of power series as purely formal objects without
using them to represent functions. However, the term formal is redundant, and used for
emphasis only: a power series is, without any added considerations, a purely formal object.
Some additional examples of infinite sequences and their generating functions appear
below:
The sequence 1, 1, 1, 1, 1, . . . has generating function

X
1
.
xn = 1 + x + x2 + x3 + x4 + =
1x
n=0
The sequence 1, 2, 4, 8, 16, 32, . . . generated recursively by a0 = 1; an+1 = 2an for all
n 0 has generating function

X
1
2n xn = 1 + 2x + 4x2 + 8x3 + 16x4 + =
.
1 2x
n=0
The sequence 1, 2, 3, 4, 5, . . . has generating function

X
(n + 1)xn = 1 + 2x + 3x2 + 4x3 + 5x4 + =
n=0

The sequence 1, 0, 1, 0, 1, 0, . . . has generating function

1
.
(1 x)2

1
.
1 x2
 1


The sequence 1, 3, 6, 10, 15, 21, 28, . . . defined by an = n+2
= 2 n + 1 n + 2 for all
2
n 0 has generating function


X
n+2 n
1
x = 1 + 3x + 6x2 + 10x3 + 15x4 + =
.
2
(1 x)3
n=0
1 + x2 + x4 + x6 + x8 + =

We first demonstrate how to list the Fibonacci numbers through


recursively:
> F:=array(0..100):
> F[0]:=1: F[1]:=1:
> for n from 2 to 100 do F[n]:=F[n-1]+F[n-2]: od:
> seq(F[n],n=0..100);
(1)

Next, we expand

in a power series and observe the appearance of the Fibonacci

numbers as its sequence of coefficients:


> f:=1/(1-x-x^2);
(2)
> series(f,x=0,101);
(3)

Finally, we demonstrate how the formula for the nth Fibonacci number is used to find the 100th
Fibonacci number:
> alpha:=(1+sqrt(5))/2; beta:=(1-sqrt(5))/2;

(4)
> Fib:=n->simplify((alpha^(n+1)-beta^(n+1))/sqrt(5));
(5)
> Fib(100);
573147844013817084101

(6)

You might also like