From a Recurrence to a Matrix
The Fibonacci sequence is generated by a rule that uses the two preceding terms. A matrix can encode that rule in a single multiplication, so repeated multiplication produces successive pairs of terms. Diagonalizing the matrix then turns those repeated multiplications into powers of its eigenvalues. This gives an explicit formula for the \(n\)th term rather than a step-by-step recurrence.
We use the indexing \(F_0=0\), \(F_1=1\), and \(F_{n+2}=F_{n+1}+F_n\) for every integer \(n\geq 0\). All scalars and matrices in this tutorial are real. The order of the two entries in the state vector matters: define \(\mathbf{x}_n\) to list the later term first.
Using the recurrence, the next state is \(\mathbf{x}_{n+1}=\begin{bmatrix}F_{n+2}\\F_{n+1}\end{bmatrix}=\begin{bmatrix}F_{n+1}+F_n\\F_{n+1}\end{bmatrix}\). The coefficients in these two entries give the companion matrix \(\mathbf{C}\):
In particular, \(\mathbf{x}_n=\mathbf{C}^n\mathbf{x}_0\). This follows by applying the one-step rule repeatedly; the exponent \(n\) counts the number of updates from \(\mathbf{x}_0\). The first entry of \(\mathbf{x}_n\) is \(F_{n+1}\), while the second is \(F_n\).
Proof. At \(n=0\), \(\mathbf{C}^0\mathbf{x}_0=\mathbf{I}_2\mathbf{x}_0=\mathbf{x}_0=\begin{bmatrix}F_1\\F_0\end{bmatrix}\), as required. Suppose for some \(n\geq0\) that \(\mathbf{x}_n=\begin{bmatrix}F_{n+1}\\F_n\end{bmatrix}\). Then \(\mathbf{C}\mathbf{x}_n=\begin{bmatrix}F_{n+1}+F_n\\F_{n+1}\end{bmatrix}=\begin{bmatrix}F_{n+2}\\F_{n+1}\end{bmatrix}=\mathbf{x}_{n+1}\). Thus, if \(\mathbf{x}_n=\mathbf{C}^n\mathbf{x}_0\), then \(\mathbf{x}_{n+1}=\mathbf{C}^{n+1}\mathbf{x}_0\). Induction proves the formula for all \(n\geq0\). \(\square\)
Eigenvalues and Eigenvectors of the Companion Matrix
To diagonalize \(\mathbf{C}\), first solve the eigenvector equation \(\mathbf{C}\mathbf{v}=\lambda\mathbf{v}\) for a nonzero vector \(\mathbf{v}\). For a vector of the form \(\begin{bmatrix}\lambda\\1\end{bmatrix}\), direct multiplication gives \(\mathbf{C}\begin{bmatrix}\lambda\\1\end{bmatrix}=\begin{bmatrix}\lambda+1\\\lambda\end{bmatrix}\). This equals \(\lambda\begin{bmatrix}\lambda\\1\end{bmatrix}\) precisely when \(\lambda+1=\lambda^2\). The resulting equation \(\lambda^2-\lambda-1=0\) has two distinct real roots.
Both roots satisfy \(\lambda^2=\lambda+1\), so each produces an eigenvector. Put these eigenvectors into the columns of \(\mathbf{P}\). The two columns are independent because the determinant of \(\mathbf{P}\) is \(\phi-\psi=\sqrt{5}\ne0\); hence \(\mathbf{P}\) is invertible. The computations below give a diagonalization without requiring a general diagonalizability criterion.
Since \(\mathbf{P}\) is invertible, multiplying the last identity on the right by \(\mathbf{P}^{-1}\) gives \(\mathbf{C}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\). Repeating this factorization yields \(\mathbf{C}^n=\mathbf{P}\mathbf{D}^n\mathbf{P}^{-1}\) for every \(n\geq0\). For \(n=0\), both sides equal \(\mathbf{I}_2\); for positive \(n\), adjacent factors \(\mathbf{P}^{-1}\mathbf{P}\) cancel, leaving \(\mathbf{P}\mathbf{D}^n\mathbf{P}^{-1}\).
Deriving the Closed Formula
The inverse of \(\mathbf{P}\) is particularly simple because its determinant is \(\sqrt{5}\):
Applying this inverse to the initial state, and then multiplying by the diagonal powers and by \(\mathbf{P}\), gives the full state in terms of \(\phi\) and \(\psi\).
The second coordinate of \(\mathbf{x}_n\) is \(F_n\), so the expression for that coordinate is the closed formula. It is valid starting at \(n=0\), not just for positive indices.
Proof. The diagonalization above gives \(\mathbf{x}_n=\dfrac{1}{\sqrt{5}}\left(\phi^n\begin{bmatrix}\phi\\1\end{bmatrix}-\psi^n\begin{bmatrix}\psi\\1\end{bmatrix}\right)\) for each \(n\geq0\). By definition, the second coordinate of \(\mathbf{x}_n\) is \(F_n\). Taking the second coordinate of the displayed vector therefore gives \(F_n=(\phi^n-\psi^n)/\sqrt{5}\), as claimed. The argument includes \(n=0\): the formula gives \((1-1)/\sqrt{5}=0=F_0\). \(\square\)
Worked Checks: Recurrence, Matrix, and Formula
Worked Example: Iterating the Matrix to Find \(F_4\)
Compute the first four matrix updates and use the state to identify \(F_4\). Starting from \(\mathbf{x}_0=\begin{bmatrix}1\\0\end{bmatrix}\), direct multiplication gives
Squaring is not needed to continue: multiply each current state by \(\mathbf{C}\). The powers through the fourth update are
Thus \(F_4=3\). Check: the recurrence gives \(F_2=1+0=1\), \(F_3=1+1=2\), and \(F_4=2+1=3\), so the second coordinate of \(\mathbf{x}_4\) agrees with the recurrence. Also, multiplying the displayed matrix by the initial state selects its first column, \(\begin{bmatrix}5\\3\end{bmatrix}\), as stated.
Worked Example: Evaluating the Closed Formula at \(n=6\)
Use the closed formula to compute \(F_6\). The roots satisfy \(\phi^2=\phi+1\) and \(\psi^2=\psi+1\). Repeated use of these identities gives \(\phi^3=2+\sqrt{5}\) and \(\psi^3=2-\sqrt{5}\); squaring each expression gives \(\phi^6=9+4\sqrt{5}\) and \(\psi^6=9-4\sqrt{5}\). Therefore
Check: starting with \(F_0=0\) and \(F_1=1\), the recurrence gives \(F_2=1\), \(F_3=2\), \(F_4=3\), \(F_5=5\), and \(F_6=5+3=8\). The value from the formula agrees with the recurrence.
Worked Example: Checking \(F_9\) by Both Methods
Compute \(F_9\) by matrix iteration and compare with the closed formula. First, squaring \(\mathbf{C}^4\) from the previous example gives
One more multiplication gives \(\mathbf{C}^9=\mathbf{C}^8\mathbf{C}=\begin{bmatrix}55&34\\34&21\end{bmatrix}\). Thus \(\mathbf{x}_9=\mathbf{C}^9\mathbf{x}_0=\begin{bmatrix}55\\34\end{bmatrix}\), so matrix iteration gives \(F_9=34\).
For the formula, using \(\phi^2=\phi+1\) repeatedly gives \(\phi^9=38+17\sqrt{5}\); because \(\psi=(1-\sqrt{5})/2\), the corresponding odd power is \(\psi^9=38-17\sqrt{5}\). Hence
Check: the recurrence gives \(F_7=13\), \(F_8=21\), and \(F_9=21+13=34\). This matches both the matrix calculation and the closed formula.
Common Pitfall: Keep the State Order Consistent
The companion matrix depends on how the state entries are ordered. With our convention, the state is \(\begin{bmatrix}F_{n+1}\\F_n\end{bmatrix}\), and the update matrix is \(\begin{bmatrix}1&1\\1&0\end{bmatrix}\). A wrong calculation is to use that same matrix with the reversed initial state \(\begin{bmatrix}F_0\\F_1\end{bmatrix}=\begin{bmatrix}0\\1\end{bmatrix}\):
This result is not the next reversed-order state, which should be \(\begin{bmatrix}F_1\\F_2\end{bmatrix}=\begin{bmatrix}1\\1\end{bmatrix}\). The correction is to use the matching matrix for that order: if \(\mathbf{y}_n=\begin{bmatrix}F_n\\F_{n+1}\end{bmatrix}\), then \(\mathbf{y}_{n+1}=\begin{bmatrix}0&1\\1&1\end{bmatrix}\mathbf{y}_n\). Indeed, multiplying \(\begin{bmatrix}0&1\\1&1\end{bmatrix}\begin{bmatrix}0\\1\end{bmatrix}\) gives \(\begin{bmatrix}1\\1\end{bmatrix}\), as required. Either convention works, but the state, update matrix, and initial vector must all agree.
A second potential error is to assume that \(\begin{bmatrix}1\\\lambda\end{bmatrix}\) is an eigenvector of \(\mathbf{C}\) for an eigenvalue \(\lambda\). In fact, \(\mathbf{C}\begin{bmatrix}1\\\lambda\end{bmatrix}=\begin{bmatrix}1+\lambda\\1\end{bmatrix}\), which is generally not \(\lambda\begin{bmatrix}1\\\lambda\end{bmatrix}\). For the chosen matrix, the correct eigenvector is \(\begin{bmatrix}\lambda\\1\end{bmatrix}\); its eigenvector equation works because the root satisfies \(\lambda^2=\lambda+1\).
Why the Diagonalization Helps
The recurrence is an efficient way to generate terms one at a time, but it requires retaining earlier values. The matrix form organizes those values as a state, and diagonalization explains how the state changes after many updates: each eigenvector component is multiplied by a power of its eigenvalue. In this example the initial state contributes to both eigenvectors, and the second coordinate of their combined powers yields the Fibonacci formula. The formula is useful for understanding the sequence and for checking exact values; the recurrence remains convenient for computing a short list of consecutive terms.
Check Your Understanding
Use the state convention and calculations in the tutorial to answer the following questions.
- Write the state vector \(\mathbf{x}_2\) and verify it by multiplying \(\mathbf{C}^2\mathbf{x}_0\).
- Show directly that \(\begin{bmatrix}\phi\\1\end{bmatrix}\) is an eigenvector of \(\mathbf{C}\) with eigenvalue \(\phi\).
- Use the closed formula to calculate \(F_5\), keeping the radical arithmetic exact.
- Explain why \(\mathbf{P}\) is invertible by computing its determinant.
- If the state is instead \(\mathbf{y}_n=\begin{bmatrix}F_n\\F_{n+1}\end{bmatrix}\), write its initial vector and its matching update matrix.