Solve the recurrence relation
$$f(n) = 2f(n - 1) + f(n - 2)$$
with initial conditions $f(0) = a, f(1) = b$. (here a and b are fixed, arbitrary integers).
I'm confused on how to approach this, a and b are fixed, arbitrary integers.
Solve the recurrence relation
$$f(n) = 2f(n - 1) + f(n - 2)$$
with initial conditions $f(0) = a, f(1) = b$. (here a and b are fixed, arbitrary integers).
I'm confused on how to approach this, a and b are fixed, arbitrary integers.
We solve first the characteristic equation of the difference equation, which is: $$ r^2 = 2r + 1 $$ resulting in solutions: $$ r_1 = 1+\sqrt{2} \qquad r_2= 1-\sqrt{2} $$ The general solution to the difference equation is then: $$ f(n)= c_1 (1+\sqrt{2})^n + c_2 (1-\sqrt{2})^n $$ Solving for the two coefficients, we use the initial conditions: \begin{align*} f(0) &= a & f(1) &= b \\ c_1+c_2 &= a & (1+\sqrt{2})c_1 + (1-\sqrt{2})c_2 &= b \end{align*} $$ c_1 = \frac{(2-\sqrt{2})a + \sqrt{2} \, b}{4} \qquad c_2 = \frac{(2+\sqrt{2})a - \sqrt{2} \, b}{4} $$ So the difference equation with initial conditions: $$ f(n) = 2 f(n-1) + f(n-2) \quad\qquad f(0)=a, f(1) = b $$ has solution: $$ f(n) = \left( \frac{(2-\sqrt{2})a + \sqrt{2} \, b}{4} \right) (1+\sqrt{2})^n + \left( \frac{(2+\sqrt{2})a - \sqrt{2} \, b}{4} \right) (1-\sqrt{2})^n $$