The Fibonacci Numbers

In this lesson, we will learn about a flagship application of recursion, the Fibonacci numbers.

What are the Fibonacci numbers?

Fibonacci numbers are a series of numbers given by the following set of formulas:

Fib(0)=0Fib(0) = 0

Fib(1)=1Fib(1) = 1

Fib(n)=Fib(n1)+Fib(n2)Fib(n) = Fib(n-1) + Fib(n-2)

This is a classic example of recursion. The first two equations give us the base cases, while the third equation is the recursive step. Verbally, we can define nth^{th} Fibonacci number as sum of (n-1)th^{th} and (n-2)th^{th} Fibonacci numbers.

Are Fibonacci numbers more than just a formula?

Well, yes! Look at the visualization in Figure 1.

Get hands-on with 1400+ tech skills courses.