Fibonacci Explorer

Explore the Fibonacci sequence, golden ratio convergence, Binet's formula, and mathematical identities

Fibonacci Explorer

The Fibonacci sequence starts with 0, 1 and each subsequent number is the sum of the two before it:

F(n)=F(n−1)+F(n−2),F(0)=0,  F(1)=1F(n) = F(n-1) + F(n-2), \quad F(0)=0,\; F(1)=1

Sequence Generation

Choose an index: nn = 10

At position nn: F(0)F({\cmv{computed}{n}}) = 55. The previous term F(0)F({\cmv{computed}{nMinus1}}) = 34.

Fibonacci sequence growth

F(n-1)F(n)F(n+1)025507589

Golden Ratio Convergence

Consecutive Fibonacci numbers form a ratio that converges to the golden ratio φ\varphi:

φ=1+52≈1.618034\varphi = \frac{1 + \sqrt{5}}{2} \approx 1.618034

Current ratio: F(0)/F(0)F({\cmv{computed}{n}})/F({\cmv{computed}{nMinus1}}) = 1.6176470588 -- error from φ\varphi: 0.0003869299

Ratio vs Golden Ratio

F(n)/F(n-1)φ = 1.618...00.450.91.351.618

Drag 10 upward and watch the error shrink. By n=10n = 10 the ratio is already within 0.001 of φ\varphi.

Binet's Formula

A closed-form expression computes F(n)F(n) without recursion:

F(n)=φn−ψn5F(n) = \frac{\varphi^n - \psi^n}{\sqrt{5}}

where ψ=1−52≈−0.618\psi = \frac{1-\sqrt{5}}{2} \approx -0.618.

For nn = 10: φn\varphi^n = 122.99, ψn\psi^n = 0.01, giving 55 -- an integer despite the irrational ingredients.

Cassini's Identity

A striking identity links three consecutive Fibonacci numbers:

F(n−1) F(n+1)−F(n)2=(−1)nF(n-1)\,F(n+1) - F(n)^2 = (-1)^n

With nn = 10: F(0)×F(0)−F(0)2F({\cmv{computed}{nMinus1}}) \times F({\cmv{computed}{nPlus1}}) - F({\cmv{computed}{n}})^2 = 1, and (−1)n(-1)^n = -1. The identity holds.

Sweep 10 from even to odd and watch the sign flip between −1-1 and +1+1.

Try it in Code

# Fibonacci Explorer
import math
n = 10
phi = (1 + math.sqrt(5)) / 2
psi = (1 - math.sqrt(5)) / 2

def fib(k):
    return round((phi**k - psi**k) / math.sqrt(5))

fn = fib(n); fn1 = fib(n-1); fn2 = fib(n+1)
print(f"F({n}) = {fn}")
print(f"F({n})/F({n-1}) = {fn/fn1:.10f}")
print(f"Golden ratio = {phi:.10f}")
print(f"Cassini: F({n-1})*F({n+1}) - F({n})^2 = {fn1*fn2 - fn**2}")

What to explore next

You might also like