# Fibonacci number

(Redirected from Fibonacci sequence)

In mathematics, the Fibonacci numbers form a sequence defined recursively by:

[itex]
 F(n)=
\left\{
\begin{matrix}
F(n-1)+F(n-2)&&\mbox{if }n>1.
\end{matrix}
\right.
[itex]


In words: you start with 0 and 1, and then produce the next Fibonacci number by adding the two previous Fibonacci numbers. The first Fibonacci numbers (sequence A000045 in OEIS) for n = 0, 1,  are

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, A tiling with Fibonacci
number sized squares

 Contents

## Origins

The earliest reference to Fibonacci numbers is contained in 500 BC Indian mathematician Pingala's book on meters called Chhandah-shastra. As documented by Donald Knuth in The Art of Computer Programming, this sequence was described by the Indian mathematicians Gopala and Hemachandra in 1150, who were investigating the possible ways of exactly bin packing items of length 1 and 2. In the West, it was first studied by Leonardo of Pisa, who was also known as Fibonacci (c. 1200), to describe the growth of an idealized rabbit population. The numbers describe the number of pairs in the rabbit population after n months if it is assumed that

• in the first month there is just one new-born pair,
• new-born pairs become fertile from their second month on
• each month every fertile pair begets a new pair, and
• the rabbits never die

Suppose that in month n we have a pairs of fertile and newly born rabbits and in month n + 1 we have b pairs. In month n + 2 we will necessarily have a + b pairs, because all a pairs of rabbits from month n will be fertile and produce a pairs of offspring, while the newly born rabbits in b will not be fertile and will not produce offspring.

The term Fibonacci sequence is also applied more generally to any function g where g(n + 2) = g(n) + g(n + 1). These functions are precisely those of the form g(n) = aF(n) + bF(n + 1) for some numbers a and b, so the Fibonacci sequences form a vector space with the functions F(n) and F(n + 1) as a basis.

In particular, the Fibonacci sequence L with L(1) = 1 and L(2) = 3 is referred to as the Lucas numbers. This sequence was described by Leonhard Euler in 1748, in the Introductio in Analysin Infinitorum. The significance in the Lucas numbers L(n) lies in the fact that raising the Golden ratio to the nth power yields:

[itex]\left( \frac 1 2 \left( 1 + \sqrt{5} \right) \right)^n = \frac 1 2 \left( L(n) + F(n) \sqrt{5} \right) [itex]

Lucas numbers are related to Fibonacci numbers by the relation:

[itex]L(n) = F(n-1) + F(n+1)[itex]

## Binet's formula

As was pointed out by Johannes Kepler, the ratio of adjacent Fibonacci numbers, i.e.

[itex]F(n+1)/F(n)[itex],

converges to the golden mean φ. In modern form:

[itex]x=\lim_{n\to\infty}\frac{F(n+1)}{F(n)}[itex]
[itex]

=\lim_{n\to\infty}\frac{F(n)+F(n-1)}{F(n)}[itex]

[itex]

=1+\lim_{n\to\infty}\frac{F(n-1)}{F(n)}[itex]

[itex]

=1+\frac1{\lim_{n\to\infty}\frac{F(n)}{F(n-1)}}[itex]

[itex]

=1+\frac1x[itex] or

[itex]x^2=x+1[itex],

[itex]\phi, 1-\phi[itex]

as solutions. If we multiply both sides by [itex]x^n[itex], we get

[itex]x^{n+2}=x^{n+1}+x^n[itex].

Thus the two functions

[itex]n\mapsto\phi^n[itex]

and

[itex]n\mapsto(1-\phi)^n[itex]

— as well as all linear combinations

[itex]n\mapsto a\phi^n+b(1-\phi)^n[itex]

— satisfy the Fibonacci recurrence.

By selecting the coefficients a and b to get the proper initial values F(0) = 0 and F(1) = 1, we obtain

[itex]F\left(n\right) = {\phi^n \over \sqrt{5}} - {(1-\phi)^n \over \sqrt{5}}[itex]

This generates the closed-form solution for the Fibonacci numbers as

[itex]F\left(n\right) = { (1+\sqrt{5})^n-(1-\sqrt{5})^n \over \sqrt{5}\cdot2^n }[itex]

- a formula that has become known as Binet's formula. Or simply,

[itex]f(n) = {{\phi^n-(1-\phi)^n} \over {\sqrt 5}}[itex]

where [itex]\phi[itex] is the golden ratio number.

This result can also be derived using the technique of generating functions, or the technique of solving linear recurrence relations.

As n goes to infinity, the second term converges to zero, so the Fibonacci numbers approach the exponential φn/√5, hence their convergent ratios. In fact the second term starts out small enough that the Fibonacci numbers can be obtained from the first term alone, by rounding to the nearest integer.

A 2-dimensional system of linear difference equations that describes the Fibonacci sequence is

[itex]{f_{k+2} \choose f_{k+1}} = \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} {f_{k+1} \choose f_{k}}[itex]

or

[itex]\vec f_{k+1} = A \vec f_{k}[itex]

The eigenvalues of the matrix A are [itex]\phi[itex] and [itex](1-\phi)[itex], and the elements of the eigenvectors of A, [itex]{\phi \choose 1}[itex] and [itex]{1 \choose -\phi}[itex], are in the ratios [itex]\phi[itex] and [itex](1-\phi)[itex].

## Computing Fibonacci numbers

Computing Fibonacci numbers by computing powers of the golden mean is not very practical except for small values of n, since rounding errors will accrue and floating point numbers usually don't have enough precision.

The straightforward recursive implementation of the Fibonacci sequence definition is also not advisable, since it would compute many values repeatedly (unless the programming language has a feature which allows the storing of previously computed function values, such as memoization). Therefore, one usually computes the Fibonacci numbers "from the bottom up", starting with the two values 0 and 1, and then repeatedly replacing the first number by the second, and the second number by the sum of the two.

For huge arguments and if a bignum system is being used, a faster way to calculate Fibonacci numbers uses the following matrix equation:

[itex]\begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix}^n =
      \begin{bmatrix} F\left(n+1\right) & F \left(n\right) \\
F\left(n\right)   & F \left(n-1\right) \end{bmatrix}


[itex]

and employs exponentiating by squaring.

Note that this matrix has a determinant of +1 or -1, and thus it is a 2x2 unimodular matrix. This property can be understood in terms of the continued fraction representation for the golden mean: φ = [1; 1, 1, 1, 1, ]. The Fibonacci numbers occur as the ratio of successive convergents of the continued fraction for φ, and the matrix formed from successive convergents of any continued fraction has a determinant of +1 or -1.

## Applications

The Fibonacci numbers are important in the run-time analysis of Euclid's algorithm to determine the greatest common divisor of two integers.

Matiyasevich was able to show that the Fibonacci numbers can be defined by a Diophantine equation, which led to his original solution of Hilbert's tenth problem.

The Fibonacci numbers occur in a formula about the diagonals of Pascal's triangle (see binomial coefficient).

In music Fibonacci numbers are sometimes used to determine tunings, and, as in visual art, to determine the length or size of content or formal elements. Examples include Béla Bartók's Music for Strings, Percussion, and Celesta.

Every positive integer can be written in a unique way as the sum of distinct Fibonacci numbers in such a way that the sum does not include any two consecutive Fibonacci numbers. This is known as Zeckendorf's theorem, and a sum of Fibonacci numbers that satisfies these conditions is called a Zeckendorf representation.

Since the conversion factor 1.609 for miles to kilometers is close to the golden mean φ, the decomposition of distance in miles into a sum of Fibonacci numbers becomes nearly the kilometer sum when the Fibonacci numbers are replaced by their successors. This method amounts to a radix 2 number register in base φ being shifted. To go from kilometers to miles shift the register down the Fibonacci sequence instead.

## Fibonacci numbers in nature

Fibonacci sequences have been noted to appear in biological settings, such as the branching patterns of leaves in grasses and flowers, branching in bushes and trees, the arrangement of tines on a pine cone, seeds on a raspberry and the like. Przemyslaw Prusinkiewicz has advanced the idea that these can be in part understood as the expression of certain algebraic constraints on free groups, specifically as certain Lindenmeyer grammers. Generally one sees Fibonacci numbers arise in the study of the fractal Fuchsian groups and Kleinian groups, and systems that possess such symmetries. For example, the solutions to reaction-diffusion differential equations (such as that seen in the Belousov-Zhabotinsky reaction) can show such a patterning; in biology, genes often express themselves through gene regulatory networks, that is, in terms of several enzymes controlling a reaction, which can be modelled with reaction-diffusion equations. Such systems rarely give the Fibonacci sequence exactly or directly; rather, the relationship occurs deeper in the theory. Similar patterns also occur in non-biological systems, such as in sphere packing models.

## Generalizations

A generalization of the Fibonacci sequence are the Lucas sequences. One kind can be defined thus:

U(0) = 0
U(1) = 1
U(n+2) = PU(n+1) − QU(n)

where the normal Fibonacci sequence is the special case of P = 1 and Q = -1. Another kind of Lucas Sequence begins with V(0) = 2, V(1) = P. Such sequences have applications in number theory and primality proving.

The Fibonacci polynomials are another generalization of Fibonacci numbers.

## Identities

F(n + 1) = F(n) + F(n − 1)
F(0) + F(1) + F(2) + ... + F(n) = F(n + 2) − 1
F(1) + 2 F(2) + 3 F(3) + ... + n F(n) = n F(n + 2) − F(n + 3) + 2

These identities can be proven using many different methods. But, among all, we wish to present an elegant proof for each of them using combinatorial arguments here. In particular, F(n) can be interpreted as the number of ways summing 1's and 2's to n − 1, with the convention that F(0) = 0, meaning no sum will add up to -1, and that F(1) = 1, meaning the empty sum will "add up" to 0. Here the order of the summands matters. For example, 1 + 2 and 2 + 1 are considered two different sums and are counted twice.

Proof of the first identity. Without loss of generality, we may assume n ≥ 1. Then F(n + 1) counts the number of ways summing 1's and 2's to n.

When the first summand is 1, there are F(n) ways to complete the counting for n − 1; and the first summand is 2, there are F(n − 1) ways to complete the counting for n − 2. Thus, in total, there are F(n) + F(n − 1) ways to complete the counting for n. [itex]\Box[itex]

Proof of the second identity. We count the number of ways summing 1's and 2's to n + 1 such that at least one of the summands is 2.

As before, there are F(n + 2) ways summing 1's and 2's to n + 1 when n ≥ 0. Since there is only one sum of n + 1 that does not use any 2, namely 1 + … + 1 (n + 1 terms), we subtract 1 from F(n + 2).

Equivalently, we can consider the first occurrence of 2 as a summand. If, in a sum, the first summand is 2, then there are F(n) ways to the complete the counting for n − 1. If the second summand is 2 but the first is 1, then there are F(n − 1) ways to complete the counting for n − 2. Proceed in this fashion. Eventually we consider the (n + 1)-th summand. If it is 2 but all of the previous n summands are 1's, then there are F(0) ways to complete the counting for 0. If a sum contains 2 as a summand, the first occurrence of such summand must take place in between the first and (n + 1)-th position. Thus F(n) + F(n − 1) + … + F(0) gives the desired counting. [itex]\Box[itex]

Proof of the third identity. This identity can be established in two stages. First, we count the number of ways summing 1's and 2's to -1, 0, …, or n + 1 such that at least one of the summands is 2.

By our second identity, there are F(n + 2) − 1 ways summing to n + 1; F(n + 1) − 1 ways summing to n; …; and, eventually, F(2) − 1 way summing to 1. As F(1) − 1 = F(0) = 0, we can add up all n + 1 sums and apply the second identity again to obtain

[F(n + 2) − 1] + [F(n + 1) − 1] + … + [F(2) − 1]
= [F(n + 2) − 1] + [F(n + 1) − 1] + … + [F(2) − 1] + [F(1) − 1] + F(0)
= F(n + 2) + [F(n + 1) + … + F(1) + F(0)] − (n + 2)
= F(n + 2) + F(n + 3) − (n + 2).

On the other hand, we observe from the second identity that there are

• F(0) + F(1) + … + F(n − 1) + F(n) ways summing to n + 1;
• F(0) + F(1) + … + F(n − 1) ways summing to n;

……

• F(0) way summing to -1.

Adding up all n + 1 sums, we see that there are

• (n + 1) F(0) + n F(1) + … + F(n) ways summing to -1, 0, …, or n + 1.

Since the two methods of counting refer to the same number, we have

(n + 1) F(0) + n F(1) + … + F(n) = F(n + 2) + F(n + 3) − (n + 2)

Finally, we complete the proof by subtracting the above identity from n + 1 times the second identity. [itex]\Box[itex]

## Power series

The power series

[itex]s(x)=\sum_{n=1}^\infty F(n) x^n[itex]

has a simple and interesting closed-form solution for x < 1/φ:

[itex]s(x)=\frac{x}{1-x-x^2}.[itex]

In particular, math puzzle-books note the curious value s(1/10)/10=1/89. The sum is easily proved by noting that

[itex]s+\frac{s}{x} = 1 + \sum_{n=1}^\infty (F(n)+F(n+1)) x^n[itex]

and then explictly evaluating the sum.

## Reciprocal sum constant

The sum of the reciprocals of all the Fibonacci numbers converges: [itex] C = \sum_{n=1}^{\infty} F(n)^{-1} = 3.359885 \dots [itex] (OEIS number: A079586)

Convergence is easy to show with the ratio test.

This value has been proven irrational by André-Jeannin, R. No closed form is currently known.

## Tribonacci number

A tribonacci number is like a Fibonacci number, but instead of starting with two predetermined terms, the sequence starts with three predetermined terms and each term afterwards is the sum of the preceding three terms. The first few tribonacci numbers are:

1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, 3136, 5768, 10609, 19513, 35890, 66012,

OEIS number: A000073

## Tetranacci number

A tetranacci number is like a tribonacci number, only that starting with four predetermined terms and each term afterwards being the sum of the preceding four terms. The first few tetranacci numbers are:

1, 1, 2, 4, 8, 15, 29, 56, 108, 208, 401, 773, 1490, 2872, 5536, 10671, 20569, 39648, 76424, 147312, 283953, 547337,

OEIS number: A000078

Pentanacci, hexanacci and heptanacci numbers have been computed, but they have not interested researchers much.

## Repfigits

A repfigit or Keith number is an integer, that when its digits start a Fibonacci sequence with that number of digits, the original number is eventually reached. An example is 47, because the Fibonacci sequence starting with 4 and 7 (4,7,11,18,29,47) reaches 47. A repfigit can be a tribonacci sequence if there are 3 digits in the number, a tetranacci number if the number has four digits, etc. The first few repfigits are:

14, 19, 28, 47, 61, 75, 197, 742, 1104, 1537, 2208, 2580, 3684, 4788, 7385, 7647, 7909,

OEIS number: A007629

## Fiction

The Fibonacci sequence plays a prominent part in the bestselling novel The Da Vinci Code and, with the concepts of the Golden rectangle and Golden spiral, in Darren Aronofsky's indie film π (1998).

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy