Fast Fibonacci Transform Results

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

{xn+1=a1xn+b1yn,yn+1=a2xn+b2yn,\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 xn=fn+1 x_n = f_{n+1} and yn=fn y_n = f_n, and you get the system of equations

{xn+1=1xn+1ynyn+1=1xn+0yn \begin{cases} x_{n+1} = 1x_n + 1y_n \\ y_{n+1} = 1x_n + 0 y_n \\ \end{cases}

Hence, (xnyn)=(1110)n(11) \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
f2n+1=fn+12+fn2. f_{2n+1} = f_{n+1} ^2 + f_n ^2.
Hint: A2n=An×An A^{2n} = A^n \times A^n .
3. Find a similar formula for f2n f_{2n} .
4. Express f3n f_{3n} in terms of fn,fn+1 f_{n}, f_{n+1}.

Note by Calvin Lin
5 years ago

No vote yet
1 vote

</code>...<code></code> ... <code>.">   Easy Math Editor

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in </span>...<span></span> ... <span> or </span>...<span></span> ... <span> to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}

Comments

Sort by:

Top Newest

This 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 - 5 years ago

Log in to reply

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

Calvin Lin Staff - 5 years ago

Log in to reply

Let ρ=1+52 \rho =\frac{1+\sqrt{5}}2 and ρ=152 {\overline \rho} = \frac{1-\sqrt{5}}2 . Let D=(ρ00ρ) D = \begin{pmatrix} \rho&0 \\ 0&{\overline \rho} \end{pmatrix} . Let A=(ρρ11) A = \begin{pmatrix} \rho&{\overline \rho} \\ 1&1 \end{pmatrix} . Then (1110)=ADA1 \begin{pmatrix} 1&1\\1&0 \end{pmatrix} = ADA^{-1} .

Patrick Corn - 5 years ago

Log in to reply

(1) So (fn+1fn)=(ADA1)n(10)=ADnA1(10) \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 (fn+1fn)=15(ρn+1ρn+1ρnρn) \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.

Patrick Corn - 5 years ago

Log in to reply

(2) and (3): let M=(1110)=ADA1 M = \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} = ADA^{-1} . Then Mn(10)=(fn+1fn) M^n \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} f_{n+1} \\ f_n \end{pmatrix} , and Mn(01)=Mn1(10)=(fnfn1) M^n \begin{pmatrix} 0 \\ 1 \end{pmatrix} = M^{n-1} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} f_n \\ f_{n-1} \end{pmatrix} . So Mn=(fn+1fnfnfn1) M^n = \begin{pmatrix} f_{n+1} & f_n \\ f_n & f_{n-1} \end{pmatrix} .

Now then, (f2n+1f2n)=M2n(10)=Mn(fn+1fn)=(fn+1fnfnfn1)(fn+1fn) \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 (f2n+1f2n)=(fn+12+fn2fn+1fn+fnfn1) \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 - 5 years ago

Log in to reply

@Patrick Corn (4) Similar computations give f3n=fn(3fn+123fnfn+1+2fn2) 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 fn1=fn+1fn f_{n-1} = f_{n+1}-f_n in some places.)

Patrick Corn - 5 years ago

Log in to reply

I wish I saw this earlier

Agnishom Chattopadhyay Staff - 4 years, 2 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 - 4 years, 2 months ago

Log in to reply

Okay! Will go through this

Agnishom Chattopadhyay Staff - 4 years, 2 months ago

Log in to reply

For Fast Fibonacci Transform, here's a python code for calculating fibonacci numbers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# (Public) Returns F(n).
def fibonacci(n):
    if n < 0:
        raise ValueError("Negative arguments not implemented")
    return _fib(n)[0]


# (Private) Returns the tuple (F(n), F(n+1)).
def _fib(n):
    if n == 0:
        return (0, 1)
    else:
        a, b = _fib(n // 2)
        c = a * (b * 2 - a)
        d = a * a + b * b
        if n % 2 == 0:
            return (c, d)
        else:
            return (d, c + d)

Pranjal Jain - 4 years, 2 months ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...