As I know for solving recurrence relation like this $$a(n) = Aa(n-1)+B a(n-2)$$
we are trying to solve quadratic equation like this $$s^2-A \cdot s-B=0$$
Consider three cases
- Two distinct real roots, $s_1$ and $s_2$,then $$a(n)=a \cdot s_1^n+b \cdot s_2^n$$
- Exactly one real root
$$a(n)=a \cdot s^n+b \cdot n \cdot s^n$$ - In case of complex roots,we use the sine and cosine functions Let us consider this situation $$a(n)=5 \cdot a(n-1)-6 \cdot a(n-2)$$ with $a(0)=1$ and $a(1)=4$
We have $s^2-5 \cdot s+6=0$ so $s_1=3$ and $s_2=2$. If put this information into the equation which considers two real roots and use the initial values, I get $$a(n)=2 \cdot 3^n-2^n$$
Am I correct? I have started solving such equations a few days ago and want to understand it well. Thanks.