Sunday, April 24, 2005

Nth Term of the Fibonacci Sequence

I can't remember how I first found this proof .. I think it might have been a homework assignment. Regardless, it's been one of my favorite proofs ever since, so I figured I should probably include it here. The object is to come up with a closed form solution for the nth term of the Fibonacci sequence f={0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...} (I start with zero for the zeroth fibonacci number, and one for the first, but you'll see that this method allows you to easily compute a Fibonacci-like sequence with any two initial values)

Now lets write an iterative formula for the nth and (n+1)th term, and then we'll solve for a closed form solution.

fibonacci01

So you can see, by multiplying this matrix repeatedly, it yields the nth and (n+1)th term

fibonacci02

Now to simplify that nasty nth power of A, we'll use a trick known as diagonalization. If we can write A as a product of 3 matrices P, D and P inverse, where D is a diagonal matrix, it gives us an easy way to write the nth power of A

fibonacci03

Now, I won't get into proving that this method of diagonalization works. If you want that much detail you can go here. Now, the next step is to find the eigenvectors and eigenvalues of A. So first we'll solve the characteristic equation of A.

fibonacci04

So, now we find the eigenvectors for the two eigenvalues. For the eigenvalue

fibonacci05

we find

fibonacci06

So our first eigenvalue-eigenvector pair is

fibonacci07

Now, for the second eigenvalue

fibonacci08

we find

fibonacci09

So our second eigenvalue-eigenvector pair is

fibonacci10

Now we can construct our matrices

fibonacci11

And to calculate P inverse, we'll need the determinant of P (the invese of P is the transpose of the cofactor matrix times one over the determinant)

fibonacci12

and so

fibonacci13

And now we plug it all in to find a formula for the nth power of A

fibonacci14

And so we can see (from our second equation) that the formula for the nth number in the Fibonacci sequence is the lower left entry in this matrix

fibonacci15

Using this result, you can easily find a formula for the nth term of any Fibonacci-like sequence (same rules for generating the sequence, but with different starting numbers) just by changing the vector that you multiply with the nth power of A.

12 comments:

  1. Awesome proof! This helped me complete a Maths Assignment based around the Fibonacci sequence, thank you so much :D

    ReplyDelete
  2. I just learned diagonalization in my first year linear algebra course, and we did this exact proof as an example... I thought it was pretty awesome, since I've known the Fibonacci sequence for as long as I can remember, and I always wondered if it was possible to find an expression for the nth term.

    ReplyDelete
  3. this is a splendid work

    ReplyDelete
  4. I was looking for closed form expression of nth term of Fibonacci series for solving a puzzle. Find it in your blog. its an elegant solution.

    ReplyDelete
  5. Thanks for posting this! I'm working through Gilbert Strangs Linear Algebra course on MIT OpenCourseWare, and he touches this proof at the end of lecture 22, but left me scratching my head a little bit. This really cleared it up, thank you!

    ReplyDelete
  6. Wow this is super interesting. I remember sitting in my calc II class when my professor said there was no way of finding a closed form of the Fibonacci sequence. At that point I really wanted to find one but didn't even realize I had no chance without linear algebra. Then, once I learned linear algebra I was no longer searching for it. Anyway, I guess she was wrong on that one haha. I might have to just go back and show her this.

    ReplyDelete
  7. Awesome, Thanks :)

    ReplyDelete
  8. That is absolutely the most amazing thing ever!!!

    ReplyDelete
  9. how would you find the nth term of this sequence, 1,1,3,5,11,21,43,85 etc.
    I know that the after each term you have to do 2n-1 then for the next one 2n+1 and it keeps on alternatng. But I can't find the actual formula.

    ReplyDelete
  10. just want to ask if for example i have fibonacci like sequence 2,4,6,10... how will i find the 20th term using your formula....

    ReplyDelete
  11. errr, well i'm no mathematician (aged twelve) but i found this very useful for my homework. perhaps you could publish a simpler version for people, who like me, are not particularly blessed in the maths department. thank you

    ReplyDelete
  12. Thank you for this proof - it beats the pants off the one shown in Kolman's Introductory Linear Algebra (which, to be fair, had limited space to print it although, on the other hand, there is also either a typo or simply an incomprehensible line in it "we write un-1 = un-1" with the n-1 being subscripts. Huh?)

    ReplyDelete