|
Another math-y option is to note that the Fibonacci series satisfies the linear recurrence F[n+2] = F[n+1] + F[n] and can therefore be represented in matrix form. Here's a (trimmed down) Maxima session that gives the details: $ maxima
(%i3) load(eigen)$
(%i4) A: matrix([1, 1], [1, 0])$
(%i5) b: columnvector([1, 0])$
(%i6) fib(n) := (''A^^n . ''b)[2][1];
<n>
[ 1 1 ] [ 1 ]
(%o6) fib(n) := (([ ] . [ ]) )
[ 1 0 ] [ 0 ]
2
1
(%i7) makelist(fib(n), n, 10);
(%o7) [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
Since the transition matrix A is symmetric, it can be diagonalized using its eigenvector matrix: (%i8) similaritytransform(A)$
(%i9) Adiag: expand(leftmatrix . A . rightmatrix)$
And the n-th power of a diagonal matrix is the same as raising the values on its diagonal to the n-th power: (%i10) AdiagN(n) := matrix([''(Adiag[1][1])^n, 0], [0, ''(Adiag[2][2])^n]);
And thus raising A to the n-th power is the same as raising its diagonal counterpart Adiag to that power and then reversing the diagonalization transform (since leftmatrix and rightmatrix are inverses and cancel out for the interior multiplications): (%i11) fibdiag(n) := expand(rightmatrix . AdiagN(n) . leftmatrix . b)[2][1]$
Finally, this leads to a closed-form representation for the n-th Fibonacci number: (%i12) fibdiag(n);
sqrt(5) 1 n 1 sqrt(5) n
(------- + -) (- - -------)
2 2 2 2
(%o12) -------------- - --------------
sqrt(5) sqrt(5)
|