You are on page 1of 3

The Fibonacci sequence is defined as Fn+2 = Fn+1 + Fn , with F1 = 1 and F2 = 1.

Calculating the nth Fibonacci number requires applying this formula n times, which can
take a while. This is similar to the concept of matrix multiplication in linear algebra. In
linear algebra, you can speed up repeated matrix multiplication through a process known as
diagonalization.
Our goal will to rewrite the Fibonacci recurrence relation in terms of matrices, diagonalize
the matrix, and then find a formula for the nth Fibonacci number through it.
When solving systems of equations, its common to convert a problem into a matrix
equation through using a coefficient matrix. A quick example is depicted below.
8 = 3x + 4y
2 = 9x + 2y
 
  
3 4
x
8
=
b = Ax
9 2
y
2
|{z} | {z } | {z }
b

Here, I rewrote the equation in terms of a matrix being multiplied by a vector. This both
allows for compact notation (depicted to the right), and for us to use the tools of Linear
Algebra.
So, without further ado, lets find the coefficient matrix for the Fibonacci series. We will
clearly want to incorporate the equation Fn+2 = Fn+1 + Fn . If we wanted to factor this like
above, the right hand side would involve a vector with 2 elements. To make things easy, we
want to be working with a square matrix, so well need a total of 1 more equation somehow.
Currently, we can write:

 


Fn+2
1 1
Fn+1
=
a
b c
Fn
Where a, b and c are unknown as of yet. This encodes the Fibonacci equation in the top
line. For the bottom line, well choose to use the equation Fn+1 = Fn+1 . This might seem
trivially true (well, it is), but its important to allow us to move forward.
With this in mind, we get

 


Fn+2
1 1
Fn+1
=
Fn+1
1 0
Fn
Now, we can begin attempting to diagonalize our matrix. This will involve finding eigenvectors for our matrix. Its hard to explain the significance of eigenvectors to someone without
knowledge of linear algebra, but its probably good enough to say theyre central to the topic
(likely the most important concept).
This part is computational, so I will assume that the reader either can follow along, or can
accept that parts of this are hand wavy, and that the exact process of finding eigenvectors
isnt important to solve this problem.


1t 1
f (t) = det(A tI2 ) = det
= t + t2 1 = t2 t 1
1
t
1

1 4(1)(1)
1 5
t=
=
2(1)
2

1+ 5
1 =
2
1 5
2 =
 2
   
1 1
1
x
0
v1 :
=
= (1 1 )x + y = 0 = y = (1 1)x
1
1
y
0






1
1
x
v1 =
= c 1+ 5 = c 15
(1 1)x
2

  2 
1 2
1
x
0
v2 :
=
= (1 2 )x + y = 0 = y = (2 1)x
1
2
y
0




1
1
v2 = c 1 5 = c 1+5
1


Q=
Q1 =

1 5
1+ 5
2
2
!

1+ 5
1
2
1+ 5
1
2
1

A = P DP
= D = P 1 AP
!



1+ 5
1 0
0
2

D=
=
1 5
0 2
0
2
Now we have most of what we need calculated. So, lets try calculating some Fibonacci
numbers now.
   
F2
1
=
F1
1
 
 
F3
F2
=A
F2
F1

  
F2 + F1
2
=
=
F1
1
 
 
  
 
F4
F3
F2
2 F2
=A
=A A
=A
F3
F2
F1
F1
 
 
  
 
F5
F4
F2
F2
=A
= A A2
= A3
F4
F3
F1
F1
If we continue this pattern, itll just be a question of calculating Ak fast. So, lets try to
do that. By using our equation A = P DP 1 , we find that A2 = P DP 1 P DP 1 = P D2 P 1 ,
and in general:
2

Ak = A A A ... A
= (P DP 1 )(P DP 1 )(P DP 1 )...(P DP 1 )
= P D(P 1 P )D(P 1 P )D(P 1 P )D...P 1 = P DIDIDI...DP 1 = P Dk P 1
So, we can write:
 


Fn+2
k 1 F2
= PD P
F1
Fn+1
Now, we get to the reason why this is such a good idea. In general, calculating Ak is
extremely difficult. Calculating Dk is trivial.
 k

1 0
k
D =
0 k2

You might also like