CSC165 ยท 2081 ยท 5 marks
Solve the recurrence relation an = an-1 + 2an-2 with initial conditions a0 = 2 and a1 = 7.
Solve the recurrence relation $a_n = a_{n-1} + 2a_{n-2}$ with initial conditions $a_0 = 2$ and $a_1 = 7$. [5]
Solving the Recurrence Relation $a_n = a_{n-1} + 2a_{n-2}$
Given Data
- Recurrence: $a_n = a_{n-1} + 2a_{n-2}$
- Initial conditions: $a_0 = 2$, $a_1 = 7$
Step 1: Characteristic Equation
This is a linear homogeneous recurrence with constant coefficients. Assume $a_n = r^n$:
$$r^n = r^{n-1} + 2r^{n-2}$$
Divide by $r^{n-2}$:
$$r^2 = r + 2 \implies r^2 - r - 2 = 0$$
Step 2: Solve for Roots
$$r^2 - r - 2 = (r-2)(r+1) = 0$$
$$r_1 = 2, \quad r_2 = -1$$
Distinct roots, so the general solution is:
$$a_n = \alpha_1 (2)^n + \alpha_2 (-1)^n$$
Step 3: Apply Initial Conditions
From $a_0 = 2$: $$\alpha_1 + \alpha_2 = 2 \quad (i)$$
From $a_1 = 7$: $$2\alpha_1 - \alpha_2 = 7 \quad (ii)$$
Adding $(i)$ and $(ii)$: $$3\alpha_1 = 9 \implies \alpha_1 = 3$$
From $(i)$: $$\alpha_2 = 2 - 3 = -1$$
Step 4: Final Solution
$$\boxed{a_n = 3 \cdot 2^n - (-1)^n}$$
Verification
| $n$ | Formula | Expected |
|---|---|---|
| $0$ | $3(1) - 1 = 2$ | $2$ โ |
| $1$ | $3(2) - (-1) = 7$ | $7$ โ |
| $2$ | $3(4) - 1 = 11$ | $7 + 2(2) = 11$ โ |
The solution is confirmed correct.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.