# This note has been used to help create the Fast Fibonacci Transform wiki

In How Many Transformations, Daniel came to the realization that linear recurrence of the form

\[\left\{\begin{array}{l}x_{n+1}=a_1x_n+b_1y_n,\\ y_{n+1}=a_2x_n+b_2y_n,\end{array}\right.\]

could easily be solved by setting up the matrix interpretation, and then diagonalize the matrix (assuming that's possible) which would allow us quick exponentiation, and hence obtain the Nth term directly.

We've seen this in the context of the Fast Fibonacci Transform. Specifically, set \( x_n = f_{n+1} \) and \( y_n = f_n\), and you get the system of equations

\[ \begin{cases} x_{n+1} = 1x_n + 1y_n \\ y_{n+1} = 1x_n + 0 y_n \\ \end{cases}\]

Hence, \[ \begin{pmatrix} x_n \\ y_n \\ \end{pmatrix} = \begin{pmatrix} 1 & 1 \\ 1 & 0 \\ \end{pmatrix}^n \begin{pmatrix} 1 \\ 1 \\ \end{pmatrix} \]

Using this, show the following:

1. Performing the eigenvalue decomposition, prove Binet's formula.

2. Using only matrix properties, conclude that

\[ f_{2n+1} = f_{n+1} ^2 + f_n ^2. \]

Hint: \( A^{2n} = A^n \times A^n \).

3. Find a similar formula for \( f_{2n} \).

4. Express \( f_{3n} \) in terms of \( f_{n}, f_{n+1}\).

## Comments

Sort by:

TopNewestThis kinda gave away the method one uses to solve my problem (if you don't use eigenvalue decomposition). However, I would still like to see how eigenvalue decomposition works, so it would be nice if a brilliant user could post a solution to the problems suggested in this note. Thanks. – Daniel Liu · 3 years, 1 month ago

Log in to reply

– Calvin Lin Staff · 3 years, 1 month ago

Added a solution. It's pretty basic matrix manipulation, and would have been the approach that I thought you used.Log in to reply

For

Fast Fibonacci Transform, here's a python code for calculating fibonacci numbers:Log in to reply

I wish I saw this earlier – Agnishom Chattopadhyay · 2 years, 3 months ago

Log in to reply

@Trevor B. @Trevor Arashiro @Agnishom Chattopadhyay @Michael Mendrin @Sharky Kesa

Could you guys help fill out the Fast Fibonacci Transform Wiki Page? Thanks! – Calvin Lin Staff · 2 years, 3 months ago

Log in to reply

– Agnishom Chattopadhyay · 2 years, 3 months ago

Okay! Will go through thisLog in to reply

Let \( \rho =\frac{1+\sqrt{5}}2 \) and \( {\overline \rho} = \frac{1-\sqrt{5}}2 \). Let \( D = \begin{pmatrix} \rho&0 \\ 0&{\overline \rho} \end{pmatrix} \). Let \( A = \begin{pmatrix} \rho&{\overline \rho} \\ 1&1 \end{pmatrix} \). Then \( \begin{pmatrix} 1&1\\1&0 \end{pmatrix} = ADA^{-1} \). – Patrick Corn · 3 years, 1 month ago

Log in to reply

– Patrick Corn · 3 years, 1 month ago

(1) So \( \begin{pmatrix} f_{n+1} \\ f_n \end{pmatrix} = (ADA^{-1})^n \begin{pmatrix} 1\\0 \end{pmatrix} = AD^nA^{-1} \begin{pmatrix} 1\\0 \end{pmatrix} \). Some painful computations yield \( \begin{pmatrix} f_{n+1}\\f_n \end{pmatrix} = \frac1{\sqrt{5}} \begin{pmatrix} \rho^{n+1}-{\overline \rho}^{n+1} \\ \rho^n - {\overline \rho}^n \end{pmatrix} \); Binet's formula falls out of this.Log in to reply

Now then, \( \begin{pmatrix} f_{2n+1} \\ f_{2n} \end{pmatrix} = M^{2n} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = M^n \begin{pmatrix} f_{n+1} \\ f_n \end{pmatrix} = \begin{pmatrix} f_{n+1} & f_n \\ f_n & f_{n-1} \end{pmatrix} \begin{pmatrix} f_{n+1} \\ f_n \end{pmatrix} \).

So we get \( \begin{pmatrix} f_{2n+1} \\ f_{2n} \end{pmatrix} = \begin{pmatrix} f_{n+1}^2 + f_n^2 \\ f_{n+1}f_n + f_n f_{n-1} \end{pmatrix} \), and the formulas we want can be read off from there. – Patrick Corn · 3 years, 1 month ago

Log in to reply

– Patrick Corn · 3 years, 1 month ago

(4) Similar computations give \( f_{3n} = f_n(3f_{n+1}^2-3f_nf_{n+1}+2f_n^2) \). (Basically the same process as the previous, but I had to substitute \( f_{n-1} = f_{n+1}-f_n \) in some places.)Log in to reply