In mathematics, the Fibonacci sequence is a sequence in which each element is the sum of the two elements that precede it. Numbers that are part of the Fibonacci sequence are known as Fibonacci numbers, commonly denoted Fn . Many writers begin the sequence with 0 and 1, although some authors start it from 1 and 1[1][2] and some (as did Fibonacci) from 1 and 2. Starting from 0 and 1, the sequence begins
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... (sequence A000045 in the [OEIS](https://en.wikipedia.org/wiki/On-Line_Encyclopedia_of_Integer_Sequences “On-Line Encyclop…
In mathematics, the Fibonacci sequence is a sequence in which each element is the sum of the two elements that precede it. Numbers that are part of the Fibonacci sequence are known as Fibonacci numbers, commonly denoted Fn . Many writers begin the sequence with 0 and 1, although some authors start it from 1 and 1[1][2] and some (as did Fibonacci) from 1 and 2. Starting from 0 and 1, the sequence begins
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... (sequence A000045 in the OEIS)
A tiling with squares whose side lengths are successive Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13 and 21
The Fibonacci numbers were first described in Indian mathematics as early as 200 BC in work by Pingala on enumerating possible patterns of Sanskrit poetry formed from syllables of two lengths.[3][4][5] They are named after the Italian mathematician Leonardo of Pisa, also known as Fibonacci, who introduced the sequence to Western European mathematics in his 1202 book Liber Abaci.[6]
Fibonacci numbers appear unexpectedly often in mathematics, so much so that there is an entire journal dedicated to their study, the Fibonacci Quarterly. Applications of Fibonacci numbers include computer algorithms such as the Fibonacci search technique and the Fibonacci heap data structure, and graphs called Fibonacci cubes used for interconnecting parallel and distributed systems. They also appear in biological settings, such as branching in trees, the arrangement of leaves on a stem, the fruit sprouts of a pineapple, the flowering of an artichoke, and the arrangement of a pine cone’s bracts, though they do not occur in all species.
Fibonacci numbers are also strongly related to the golden ratio: Binet’s formula expresses the n-th Fibonacci number in terms of n and the golden ratio, and implies that the ratio of two consecutive Fibonacci numbers tends to the golden ratio as n increases. Fibonacci numbers are also closely related to Lucas numbers, which obey the same recurrence relation and with the Fibonacci numbers form a complementary pair of Lucas sequences.
The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling (see preceding image)
The Fibonacci numbers may be defined by the recurrence relation[7]  and 
 for n > 1.
Under some older definitions, the value  is omitted, so that the sequence starts with 
 and the recurrence 
 is valid for n > 2.[8][9]
The first 20 Fibonacci numbers Fn are:
| F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | 89 | 144 | 233 | 377 | 610 | 987 | 1597 | 2584 | 4181 | 
The Fibonacci sequence can be extended to negative integer indices by following the same recurrence relation in the negative direction (sequence A039834 in the OEIS): , 
, and 
 for n < 0 . Nearly all properties of Fibonacci numbers do not depend upon whether the indices are positive or negative. The values for positive and negative indices obey the relation:[10] 
Thirteen (F7) ways of arranging long and short syllables in a cadence of length six. Eight (F6) end with a short syllable and five (F5) end with a long syllable.
The Fibonacci sequence appears in Indian mathematics, in connection with Sanskrit prosody.[4][11][12] In the Sanskrit poetic tradition, there was interest in enumerating all patterns of long (L) syllables of 2 units duration, juxtaposed with short (S) syllables of 1 unit duration. Counting the different patterns of successive L and S with a given total duration results in the Fibonacci numbers: the number of patterns of duration m units is F**m+1.[5]
Knowledge of the Fibonacci sequence was expressed as early as Pingala (c. 450 BC–200 BC). Singh cites Pingala’s cryptic formula misrau cha (“the two are mixed”) and scholars who interpret it in context as saying that the number of patterns for m beats (F**m+1) is obtained by adding one [S] to the F**m cases and one [L] to the F**m−1 cases.[13] Bharata Muni also expresses knowledge of the sequence in the Natya Shastra (c. 100 BC–c. 350 AD).[3][4] However, the clearest exposition of the sequence arises in the work of Virahanka (c. 700 AD), whose own work is lost, but is available in a quotation by Gopala (c. 1135):[12]
Variations of two earlier meters [is the variation] ... For example, for [a meter of length] four, variations of meters of two [and] three being mixed, five happens. [works out examples 8, 13, 21] ... In this way, the process should be followed in all mātrā-vṛttas [prosodic combinations].[a]
Hemachandra (c. 1150) is credited with knowledge of the sequence as well,[3] writing that “the sum of the last and the one before the last is the number ... of the next mātrā-vṛtta.”[15][16]
A page of Fibonacci’s Liber Abaci from the Biblioteca Nazionale di Firenze showing (in box on right) 13 entries of the Fibonacci sequence: the indices from present to XII (months) as Latin ordinals and Roman numerals and the numbers (of rabbit pairs) as Hindu-Arabic numerals starting with 1, 2, 3, 5 and ending with 377.
The Fibonacci sequence first appears in the book Liber Abaci (The Book of Calculation, 1202) by Fibonacci,[17][18] where it is used to calculate the growth of rabbit populations.[19] Fibonacci considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that: a newly born breeding pair of rabbits are put in a field; each breeding pair mates at the age of one month, and at the end of their second month they always produce another pair of rabbits; and rabbits never die, but continue breeding forever. Fibonacci posed the rabbit math problem: how many pairs will there be in one year?
- At the end of the first month, they mate, but there is still only 1 pair.
 - At the end of the second month they produce a new pair, so there are 2 pairs in the field.
 - At the end of the third month, the original pair produce a second pair, but the second pair only mate to gestate for a month, so there are 3 pairs in all.
 - At the end of the fourth month, the original pair has produced yet another new pair, and the pair born two months ago also produces their first pair, making 5 pairs.
 
At the end of the n-th month, the number of pairs of rabbits is equal to the number of mature pairs (that is, the number of pairs in month n – 2) plus the number of pairs alive last month (month n – 1). The number in the n-th month is the n-th Fibonacci number.[20]
The name “Fibonacci sequence” was first used by the 19th-century number theorist Édouard Lucas.[21]
Solution to Fibonacci rabbit problem: In a growing idealized population, the number of rabbit pairs form the Fibonacci sequence. At the end of the nth month, the number of pairs is equal to Fn.
Relation to the golden ratio
[edit]
Closed-form expression
[edit]
Like every sequence defined by a homogeneous linear recurrence with constant coefficients, the Fibonacci numbers have a closed-form expression.[22] It has become known as Binet’s formula, named after French mathematician Jacques Philippe Marie Binet, though it was already known by Abraham de Moivre and Daniel Bernoulli:[23]
where  is the golden ratio and 
 is its conjugate,[24]
 The numbers 
 and 
 are the two solutions of the quadratic equation 
, that is, 
, and thus they satisfy the identities 
 and 
.
Since , Binet’s formula can also be written as
To see the relation between the sequence and these constants,[25] note that  and 
 are and thus 
 so the powers of 
 and 
 satisfy the Fibonacci recurrence. In other words,
It follows that for any values a and b, the sequence defined by
satisfies the same recurrence,
If a and b are chosen so that U0 = 0 and U1 = 1 then the resulting sequence U**n must be the Fibonacci sequence. This is the same as requiring a and b satisfy the system of equations:
which has solution
producing the required formula.
Taking the starting values U0 and U1 to be arbitrary constants, a more general solution is  where 
 In particular, choosing a = 1 makes the n-th element of the sequence closely approximate the n-th power of 
 for large enough values of n. This arises when U0 = 2 and U1 = 1, which produces the sequence of Lucas numbers.
Computation by rounding
[edit]
Since  for all n ≥ 0, the number F**n is the closest integer to 
. Therefore, it can be found by rounding, using the nearest integer function: 
In fact, the rounding error quickly becomes very small as n grows, being less than 0.1 for n ≥ 4, and less than 0.01 for n ≥ 8. This formula is easily inverted to find an index of a Fibonacci number F: 
Instead using the floor function gives the largest index of a Fibonacci number that is not greater than F:  where 
, 
,[26] and 
.[27]
Since Fn is asymptotic to , the number of digits in F**n is asymptotic to 
. As a consequence, for every integer d > 1 there are either 4 or 5 Fibonacci numbers with d decimal digits.
More generally, in the base b representation, the number of digits in F**n is asymptotic to 
Limit of consecutive quotients
[edit]
Johannes Kepler observed that the ratio of consecutive Fibonacci numbers converges. He wrote that “as 5 is to 8 so is 8 to 13, practically, and as 8 is to 13, so is 13 to 21 almost”, and concluded that these ratios approach the golden ratio :[28][29] 
This convergence holds regardless of the starting values  and 
, unless 
. This can be verified using Binet’s formula. For example, the initial values 3 and 2 generate the sequence 3, 2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343, 555, ... . The ratio of consecutive elements in this sequence shows the same convergence towards the golden ratio.
In general, , because the ratios between consecutive Fibonacci numbers approaches 
.
Successive tilings of the plane and a graph of approximations to the golden ratio calculated by dividing each Fibonacci number by the previous
Decomposition of powers
[edit]
Since the golden ratio satisfies the equation 
this expression can be used to decompose higher powers  as a linear function of lower powers, which in turn can be decomposed all the way down to a linear combination of 
 and 1. The resulting recurrence relationships yield Fibonacci numbers as the linear coefficients: 
 This equation can be proved by induction on n ≥ 1: 
 For 
, it is also the case that 
 and it is also the case that 
These expressions are also true for n < 1 if the Fibonacci sequence Fn is extended to negative integers using the Fibonacci rule 
Binet’s formula provides a proof that a positive integer x is a Fibonacci number if and only if at least one of  or 
 is a perfect square.[30] This is because Binet’s formula, which can be written as 
, can be multiplied by 
 and solved as a quadratic equation in 
 via the quadratic formula:
Comparing this to , it follows that
In particular, the left-hand side is a perfect square.
A 2-dimensional system of linear difference equations that describes the Fibonacci sequence is
 alternatively denoted 
which yields . The eigenvalues of the matrix A are 
 and 
 corresponding to the respective eigenvectors 
As the initial value is  it follows that the nth element is 
From this, the nth element in the Fibonacci series may be read off directly as a closed-form expression: 
Equivalently, the same computation may be performed by diagonalization of A through use of its eigendecomposition:  where 
 The closed-form expression for the nth element in the Fibonacci series is therefore given by 
 which again yields 
The matrix A has a determinant of −1, and thus it is a 2 × 2 unimodular matrix.
This property can be understood in terms of the continued fraction representation for the golden ratio φ:  The convergents of the continued fraction for φ are ratios of successive Fibonacci numbers: φ**n = F**n+1 / F**n is the n-th convergent, and the (n + 1)-st convergent can be found from the recurrence relation φ**n+1 = 1 + 1 / φ**n.[31] The matrix formed from successive convergents of any continued fraction has a determinant of +1 or −1. The matrix representation gives the following closed-form expression for the Fibonacci numbers: 
 For a given n, this matrix can be computed in O(log n) arithmetic operations,[b] using the exponentiation by squaring method.
Taking the determinant of both sides of this equation yields Cassini’s identity, 
Moreover, since AnAm = An+m for any square matrix A, the following identities can be derived (they are obtained from two different coefficients of the matrix product, and one may easily deduce the second one from the first one by changing n into n + 1), 
In particular, with m = n, 
These last two identities provide a way to compute Fibonacci numbers recursively in O(log n) arithmetic operations. This matches the time for computing the n-th Fibonacci number from the closed-form matrix formula, but with fewer redundant steps if one avoids recomputing an already computed Fibonacci number (recursion with memoization).[32]
Combinatorial identities
[edit]
Combinatorial proofs
[edit]
Most identities involving Fibonacci numbers can be proved using combinatorial arguments using the fact that  can be interpreted as the number of (possibly empty) sequences of 1s and 2s whose sum is 
. This can be taken as the definition of 
 with the conventions 
, meaning no such sequence exists whose sum is −1, and 
, meaning the empty sequence “adds up” to 0. In the following, 
 is the cardinality of a set:
 
 
 
 
 
In this manner the recurrence relation  may be understood by dividing the 
 sequences into two non-overlapping sets where all sequences either begin with 1 or 2: 
 Excluding the first element, the remaining terms in each sequence sum to 
 or 
 and the cardinality of each set is 
 or 
 giving a total of 
 sequences, showing this is equal to 
.
In a similar manner it may be shown that the sum of the first Fibonacci numbers up to the n-th is equal to the (n + 2)-th Fibonacci number minus 1.[33] In symbols: 
This may be seen by dividing all sequences summing to  based on the location of the first 2. Specifically, each set consists of those sequences that start 
 until the last two sets 
 each with cardinality 1.
Following the same logic as before, by summing the cardinality of each set we see that
... where the last two terms have the value . From this it follows that 
.
A similar argument, grouping the sums by the position of the first 1 rather than the first 2 gives two more identities:  and 
 In words, the sum of the first Fibonacci numbers with odd index up to 
 is the (2n)-th Fibonacci number, and the sum of the first Fibonacci numbers with even index up to 
 is the (2n + 1)-th Fibonacci number minus 1.[34]
A different trick may be used to prove  or in words, the sum of the squares of the first Fibonacci numbers up to 
 is the product of the n-th and (n + 1)-th Fibonacci numbers. To see this, begin with a Fibonacci rectangle of size 
 and decompose it into squares of size 
; from this the identity follows by comparing areas:
Fibonacci identities often can be easily proved using mathematical induction.
For example, reconsider  Adding 
 to both sides gives
and so we have the formula for  
Similarly, add  to both sides of 
 to give 
 
Binet formula proofs
[edit]
The Binet formula is  This can be used to prove Fibonacci identities.
For example, to prove that  note that the left hand side multiplied by 
 becomes 
 as required, using the facts 
 and 
 to simplify the equations.
Numerous other identities can be derived using various methods. Here are some of them:[35]
Cassini’s and Catalan’s identities
[edit]
Cassini’s identity states that  Catalan’s identity is a generalization: 
d’Ocagne’s identity
[edit]
 
 where L**n is the n-th Lucas number. The last is an identity for doubling n; other identities of this type are 
 by Cassini’s identity.
 ![{\displaystyle