Fibonacci sequence

Fibonacci identities, negative indices, the Golden ratio, and formulas for generating, indexing, and recognizing terms.

The Fibonacci sequence in mathematics is the following sequence of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 …

Representation

By definition, the first two terms are 0 and 1, and each of the terms following them are the sum of two previous terms. So, if we say Fn is the nth term in the Fibonacci sequence, then we can express the sequence recursively as:

Fn = Fn-1 + Fn-2

seeded with F0 = 0 and F1 = 1.

Negative Indices

The sequence can also be extended to negative indices. Rearranging the terms in the equation above, we have

Fn-2 = Fn – Fn-1

Substituting values of n as 1, 0, -1, -2, -3, … we get:

F-1 = F1 – F0 = 1 – 0 = 1

F-2 = F0 – F-1 = 0 – 1 = -1

F-3 = F-1 – F-2 = 1 – (-1) = 2

F-4 = F-2 – F-3 = -1 – 2 = -3

F-5 = F-3 – F-4 = 2 – (-3) = 5

and so on. Looking at the terms of negative indices, we can get the formula

F-n = (-1)n+1 Fn

The sequence now looks like:

… 13, -8, 5, -3, 2, -1, 1, 0, 1, 1, 2, 3, 5, 8, 13, …

Relation to Golden Ratio

The relation of Fibonacci terms with the Golden Ratio is already discussed in this post. In brief, the nth term of the Fibonacci sequence is given by Binet’s Formula,

F sub n equals phi to the power n minus psi to the power n, divided by the square root of five.

where

Phi equals one plus the square root of five divided by two, approximately 1.6180339887.

is the Golden Ratio, and

Psi equals one minus the square root of five divided by two, which also equals one minus phi and negative one over phi.

Finding the nth Fibonacci term

Since

The absolute value of psi to the power n divided by the square root of five is less than one half.

for all n ≥ 0, the number F**n is the closest integer to

Phi to the power n divided by the square root of five.

Therefore it can be found by rounding off the term above. In terms of the floor function:

F sub n equals the floor of phi to the power n divided by the square root of five plus one half, for n greater than or equal to zero.

For negative n, use ψ instead of φ in the equation above.

Finding index of a given Fibonacci term

If we already know that the number F > 1 is a Fibonacci number, we can determine its index within the sequence by

The index of F equals the floor of the logarithm base phi of F times the square root of five plus one half.

Recognizing Fibonacci Terms

In 1972, Gessel gave a surprisingly simple test:

N is a Fibonacci number if and only if 5N2 + 4or 5N2 – 4 is a square number.

For instance,

  • 3 is a Fibonacci term since 5×32+4 is 49 which is 72
  • 5 is a Fibonacci term since 5×52–4 is 121 which is 112
  • 4 is not a Fibonacci term since neither 5×42+4 = 84 nor 5×42–4 = 76 are perfect squares.

Suppose we are given a Fibonacci term N and we have to find its index. Using approximation of Binet’s Formula and taking logarithms on both sides, we have

log N = n log(φ) – log(5)/2

which gives

n = ( log N + log(5)/2 ) / log(φ)**

So if we take N as 5, then n will evaluate to 6, when ceiled.