2082 7

BIT152 ยท 2082 ยท 5 marks

Solve the recurrence relation an = an-1 + an-2 with initial conditions a0 = 0 and a1 = 1.

Solve the recurrence relation $a_n = a_{n-1} + a_{n-2}$ with initial conditions $a_0 = 0$ and $a_1 = 1$. [5]

Discrete StructureChapter 5: Recurrence Relations and RecursionSolving recurrence relations with initial conditionsNumerical: solving recurrence relation

Solving the Recurrence Relation $a_n = a_{n-1} + a_{n-2}$

Given Data

  • Recurrence: $a_n = a_{n-1} + a_{n-2}$
  • Initial conditions: $a_0 = 0$, $a_1 = 1$

Step 1: Characteristic Equation

This is a linear homogeneous recurrence with constant coefficients. Assume $a_n = r^n$:

$$r^n = r^{n-1} + r^{n-2}$$

Divide by $r^{n-2}$:

$$r^2 = r + 1 \implies r^2 - r - 1 = 0$$


Step 2: Solve for the Roots

$$r = \frac{1 \pm \sqrt{1 + 4}}{2} = \frac{1 \pm \sqrt{5}}{2}$$

$$r_1 = \frac{1 + \sqrt{5}}{2}, \qquad r_2 = \frac{1 - \sqrt{5}}{2}$$

Since the roots are distinct and real.


Step 3: General Solution

$$a_n = A\left(\frac{1+\sqrt{5}}{2}\right)^n + B\left(\frac{1-\sqrt{5}}{2}\right)^n$$


Step 4: Apply Initial Conditions

$a_0 = 0$: $$A + B = 0 \implies B = -A$$

$a_1 = 1$: $$A\left(\frac{1+\sqrt{5}}{2}\right) + B\left(\frac{1-\sqrt{5}}{2}\right) = 1$$

Substitute $B = -A$:

$$A\cdot\frac{(1+\sqrt5)-(1-\sqrt5)}{2} = 1 \implies A\cdot\frac{2\sqrt5}{2}=1 \implies A\sqrt5 = 1$$

$$A = \frac{1}{\sqrt5}, \qquad B = -\frac{1}{\sqrt5}$$


Step 5: Closed-Form Solution

$$\boxed{a_n = \frac{1}{\sqrt{5}}\left(\frac{1+\sqrt{5}}{2}\right)^n - \frac{1}{\sqrt{5}}\left(\frac{1-\sqrt{5}}{2}\right)^n}$$

This is Binet's Formula for the Fibonacci numbers.


Verification

$n$Formula valueRecurrence value
000 โœ“
111 โœ“
211 โœ“
322 โœ“
433 โœ“

The sequence produced is the Fibonacci sequence $0, 1, 1, 2, 3, 5, 8, \ldots$

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.