Power iteration showed that repeatedly applying a matrix M to a vector drives it toward the eigenvector of M's largest eigenvalue, because Mn=VDnV−1 and the dominant eigenvalue swamps the rest. This chapter cashes that idea out on a sequence every programmer knows.
If you write code, you have almost certainly met the Fibonacci numbers, and probably written a function to compute the n-th one by iteration or recursion. Here we look at them through a linear-algebra lens, which reveals a closed-form formula and connects them to the broader family of linear recurrence relations.
18.1 Fibonacci numbers
The Fibonacci numbers are a sequence Fi,i=0,1,2,… defined by F0=0, F1=1, and
Fi+2=Fi+1+Fifor i≥0
The textbook recursive implementation follows the definition directly:
18.2 Two consecutive Fibonacci numbers as a vector
Now pack two consecutive Fibonacci numbers into a 2D vector:
vn=[FnFn+1]
This gives v0=[01], v1=[11], v2=[12], and so on.
18.2.1 What is the direction of this vector?
The direction of vn is the angle tan−1(FnFn+1). As n grows, does this ratio of consecutive Fibonacci numbers converge? If it does, then the direction of vn settles down too, and (just like power iteration) that limiting direction is the eigenvector of the largest eigenvalue of some matrix. Let's watch it happen before we find the matrix.
So M=[0111]. Since v1=Mv0, v2=Mv1=M2v0, and in general vn=Mnv0, the vector vn points toward M's dominant eigenvector for large n, exactly the convergence we just saw. Let's find its eigenvalues and eigenvectors.
If λ is an eigenvalue of M, then [−λ111−λ] is singular, so its columns are parallel and its determinant vanishes:
−λ(1−λ)−1=0⟹λ2=λ+1
This is precisely the equation that defines the golden ratio.
The eigenvalues are ϕ=21+5≈1.618 and ψ=21−5≈−0.618.
The corresponding eigenvectors are [1ϕ] and [1ψ].
Since ϕ is the larger absolute eigenvalue, for large n the vector vn=[FnFn+1] points in the direction [1ϕ]. In other words, for large n the ratio FnFn+1→ϕ=21+5.
Reading off the first entry gives Binet's formula for the n-th Fibonacci number:
Fn=5ϕn−ψn=51ϕn(21+5)n−ψn(21−5)n
18.4 Generalizing to any linear sum of the last two values
This chain of reasoning is not special to Fibonacci: it works for any sequence where each term is a linear combination of the previous two. A slightly more general version is
with v0=[ab]. The remaining steps are identical: find the eigenvalues and eigenvectors of this matrix, then use its eigendecomposition to write the n-th value in closed form.
18.5 Linear recurrence relations
The most general version of this idea is a linear recurrence relation:
at=c1at−1+c2at−2+⋯+cnat−n+k
where the ci and k are constants. The approach is unchanged in spirit: stack the last n terms into a vector
vn=at−nat−n+1⋮at−1
and find a matrix M (plus a constant vector w to absorb the k term) so that vn+1=Mvn+w. Once again the powers of M, through its eigendecomposition, carry all the information about how the sequence grows.
Another place higher powers of a matrix show up is Markov chains, where repeatedly applying a transition matrix drives a probability distribution toward a steady state. We look at them next.