Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding the n'th term of fibonacci like sequence

  1. Sep 30, 2013 #1
    The fibonacci sequence can be defined as $${F_n} = {F_{n - 1}} + {F_{n - 2}}$$ and specifying the initial conditions as $$\eqalign{
    & {F_1} = 1 \cr
    & {F_2} = 1 \cr} $$

    Also there exists a general formula for the fibonacci which is given by $${F_n} = {{{\varphi ^n} + {\psi ^n}} \over {\sqrt 5 }}$$

    Where $$\varphi = {{1 + \sqrt 5 } \over 2}$$ and $$\psi = {{1 - \sqrt 5 } \over 2}$$ .
    Ι understand that the derivation of the formula was obtained using generating functions.
    My question is that supposing we have a new sequence defined to be $${G_n} = {G_{n - 1}} + {G_{n - 3}}$$ and the initial conditions being:
    $$\eqalign{
    & {G_1} = 1 \cr
    & {G_2} = 1 \cr
    & {G_3} = 1 \cr} $$

    What’s the formula for the n’th term in the sequence. The generating function for the function is going to be


    $$A(x) = {x \over {1 - x - {x^3}}}$$


    . But due to the imaginary roots that are present, I am not able to use the method of partial fractions.
    Can this method still be used or is there any other method that we can use to get the n’th number of this sequence?
    Please help. Thank you
     
  2. jcsd
  3. Sep 30, 2013 #2

    jfizzix

    User Avatar
    Science Advisor
    Gold Member

    This kind of problem can also be solved with linear algebra. I'll demonstrate with the Fibonnacci problem.

    Let [itex]F_{n}[/itex] be the nth term in the Fibonnacci series so that
    [itex]F_{n}=F_{n-1}+F_{n-2}[/itex].

    Using the identity
    [itex]F_{n-1}=F_{n-1}[/itex],
    we can express the iteration from one term to the next as a matrix multiplication

    [itex]\pmatrix{
    F_{n} \cr
    F_{n-1} \cr}
    =\pmatrix{
    1 & 1 \cr
    1 & 0 \cr}\pmatrix{
    F_{n-1} \cr
    F_{n-2} \cr}=\pmatrix{
    1 & 1 \cr
    1 & 0 \cr}^{2}\pmatrix{
    F_{n-2} \cr
    F_{n-3} \cr}=\pmatrix{
    1 & 1 \cr
    1 & 0 \cr}^{n-2}\pmatrix{
    F_{2} \cr
    F_{1} \cr}=\pmatrix{
    1 & 1 \cr
    1 & 0 \cr}^{n-2}\pmatrix{
    1 \cr
    1 \cr}[/itex]

    Solving for [itex]F_{n}[/itex] then boils down to figuring out a formula for the nth power of a 2x2 matrix.


    Let [itex]A=\pmatrix{
    1 & 1 \cr
    1 & 0 \cr}[/itex]


    The eigenvalues of [itex]A[/itex] are [itex]\eqalign{
    & {\lambda_1} = \frac{1+\sqrt{5}}{2} \cr
    & {\lambda_2} = \frac{1-\sqrt{5}}{2} \cr}[/itex]

    We can diagonalize [itex]A[/itex] , so that it has the form
    [itex]A= U \Lambda U^{-1}[/itex]
    where [itex]\Lambda=\pmatrix{
    \lambda_{1} & 0 \cr
    0 & \lambda_{2} \cr}[/itex] is a diagonal matrix,

    [itex]\Lambda^{n}=\pmatrix{
    \lambda_{1}^{n} & 0 \cr
    0 & \lambda_{2}^{n} \cr}[/itex].

    Since [itex]U U^{-1} = U^{-1} U = I[/itex],
    we have that
    [itex]A^{n}= U \Lambda^{n} U^{-1}[/itex]

    Knowing that you get [itex]U[/itex] from the diagonalization, you have all the information you need to complete the matrix multiplication to find [itex]F_{n}[/itex].

    I believe you will find this procedure to work nicely for your problem, though it's a little more challenging to diagonalize a 3x3 matrix.
     
  4. Sep 30, 2013 #3

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Another method that has a less challenging end step to do by hand is the following (again for the Fibonnaci sequence). Suppose that Hn = xn for some x, and Hn = Hn-1 + Hn-2. Then
    [tex] x^n = x^{n-1} + x^{n-2} [/tex]
    for all n. Divide both sides by xn-2 and we get
    [tex] x^2 = x+1 [/tex]
    [tex] x^2 - x -1 = 0 [/tex]
    which of course has roots [itex] (1\pm \sqrt{5})/2[/itex]. The relation Hn = Hn-1 + Hn-2 is linear, i.e. if Xn and Yn satisfy it, and a and b are numbers, aXn+bYn satisfies it as well. So Hn can be anything of the form
    [tex] H_n = a \left(\frac{1+\sqrt{5}}{2}\right)^n + b\left(\frac{1-\sqrt{5}}{2} \right)^n [/tex]
    where a and b are any numbers. If we want Hn to be the Fibonacci sequence, then H1 = H2 = 1 - these give you two equations and two unknowns (a and b) which allow you to solve for a and b, and gives you that formula for Fn (actually I think your formula is missing a minus sign).

    You can do the same procedure for your Gn - you'll get three roots because you will be left with a cubic equation, so you'll have three unknowns which makes sense because the first three values of Gn will have to be specified. Unless you have a closed form expression for your roots though you will have some floating point issues if you try to use this to evaluate Gn for really large values of n.
     
  5. Oct 1, 2013 #4

    jfizzix

    User Avatar
    Science Advisor
    Gold Member

    Maybe diagonalizing a 3x3 matrix in this case wouldn't be so bad.

    For this problem we diagonalize the matrix
    [itex]B=\pmatrix{
    1 & 0 & 1 \cr
    1 & 0 & 0 \cr
    0 & 1 & 0 \cr}[/itex]

    Which comes into play as:

    [itex]\pmatrix{
    G_{n} \cr
    G_{n-1} \cr
    G_{n-2} \cr} = \pmatrix{
    1 & 0 & 1 \cr
    1 & 0 & 0 \cr
    0 & 1 & 0 \cr}\pmatrix{
    G_{n-1} \cr
    G_{n-2} \cr
    G_{n-3} \cr} =\pmatrix{
    1 & 0 & 1 \cr
    1 & 0 & 0 \cr
    0 & 1 & 0 \cr}^{n-3}\pmatrix{
    G_{3} \cr
    G_{2} \cr
    G_{1} \cr}=\pmatrix{
    1 & 0 & 1 \cr
    1 & 0 & 0 \cr
    0 & 1 & 0 \cr}^{n-3}\pmatrix{
    1 \cr
    1 \cr
    1 \cr}[/itex]

    but then, you'd still have to solve a cubic equation
    [itex]\lambda^{3}-\lambda^{2}-1=0[/itex]
    to find the eigenvalues. There are no rational roots to this equation, so solving it on paper without a copy of the cubic formula would be a challenge. A fun challenge.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Finding the n'th term of fibonacci like sequence
  1. Fibonacci Sequences (Replies: 2)

  2. Fibonacci sequence (Replies: 4)

  3. Fibonacci nth term (Replies: 9)

Loading...