Everybody knows the Fibonacci series. It begins with a 0 and a 1 and the next element is generated by summing the previous two. You can find the first few elements of the sequence easily, even by hand. They go 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on. But what if you wanted the 100th element? Easy, write a computer program to do it for you. But then what of the thousandth element? Or the ten thousandth element? Using this basic recursive definition, computing elements of the series way down the line becomes impossibly computationally intensive, even for computers. There must be a better way of finding elements to this, and other similar series.
Consider the following matrix
Not a very interesting matrix, on its own, but let’s pretend we have a column matrix, , composed of two consecutive members of the Fibonacci sequence, and then compute .
Interesting. Apparently, multiplying x by the matrix A discards the earlier Fibonacci number and adds a new one. It’s like being presented with an infinite tape of Fibonacci numbers, but only having a small window through which you can see only two numbers at a time. Multiplying by A shifts the tape over one place. You could multiply by A as many times as you wish to shift it over to any position you desire. You know what would be great? A simple formula for the k-th power of A, that is, the matrix that does the same thing as multiplying by A k times. Luckily, we can do this if we remember that if A is a diagonalizable, P is the diagonalizing matrix and D is the corresponding diagonal matrix, then:
If we want a formula for all we need to do is diagonalize it. So, let’s solve the characteristic polynomial.
The solutions two the characteristic equation are . The positive root I shall denote , because it happens to be the golden ratio, and I shall denote the negative root because I like using Greek letters.
When you solve for corresponding eigenvectors, you’ll see that is an eigenvector for and is an eigenvector for . So, if we let then we know that
Now, let’s go back to the equation from before. We know that . So if represents the first two elements (the 0-th and the 1-th) of the Fibonacci sequence then we can shift run through our infinite tape to find the k-th and (k+1)-th element by computing which equals
After finding and simplifying the expression, you’ll find that
You can confirm this formula works on a calculator yourself. Now, it’s not hard to see that this expression is a bit superfluous. We don’t need to calculate two Fibonacci numbers at once; we only need one. Note that if we pay attention to only the bottom element of the matrix, we’ll have an expression for the k-th element of the Fibonacci series. So we really only need that part and we have a simple, easy to calculate expression for Fibonacci numbers. Computers do exponentiation with ease so someone could easily compute nearly any Fibonacci number he wanted.
But now, one is left to ask, what if it’s not Fibonacci numbers you want, but a different sequence? Is there a way to generalize this result? Well of course. This wouldn’t be nearly as fun if there wasn’t.
Consider a series defined like so:
The resulting series obviously depends on what the initial values from 0 to k – 1 are set to. Let be the column matrix composed of these values and we lets make a matrix A such that:
That is, make it so A has a top row of all the coefficients, in order, used to calculate the next element of the series, has an (m-1) x (m – 1) identity matrix in the bottom left and whose other elements are all 0. If you multiply by this matrix the result will have the next element of the sequence on the top and all other elements will be shifted down and the very bottom element will be discarded. Just like before, we are running through an infinite tape containing the elements of the series. Only this time, the window allows us to see not only 2 elements at a time but m elements at once.
Now, we have to diagonalize this general matrix. The characteristic equation for A is:
Although I won’t prove it here, the proof is easy can be done with induction. Now we need to do is find the corresponding eigenvectors to the eigenvalues. Let’s take an eigenvalue of A, and make a column matrix ,
It is easy to see that
which means that is an eigenvector corresponding to . Using this fact, if represents an eigenvalue, we can create a diagonalizing matrix P,
And the the diagonalized matrix D becomes
Alright, we’re almost done. We just look back on the equation . Now, as before, this expression is superfluous. We only need the bottom row of the resulting matrix. But the bottom row of is the same as the bottom row of times the result of . And to find the bottom row of we just multiply the bottom row of with which evaluates to
which I’ll call . Finally if I then the k-th element of the series S can be found with
And that’s it. Simply compute from the initial values and the matrix P, and you’ll have an easy expression for the k-th element of the series.
One more thing
I’m sure some of you have been wondering, “What happens if A isn’t diagonalizeable?” Well, then you’re pretty much screwed. Really, I’m not sure what to do when your matrix isn’t diagonalizeable. If anyone thinks of anything, let me know.