Let a,b,c be real numbers. Find the explicit formula for $f_n=af_{n-1}+b$ for $n \ge 1$ and $f_0 = c$
So I rewrote it as $f_n-af_{n-1}-b=0$ which gives the characteristic equation as $x^2-ax-b=0$. The quadratic formula gives roots $x= \frac{a+\sqrt{a^2+4b}}{-2}, \frac{a-\sqrt{a^2+4b}}{-2}$
Then $f_n=P_1(\frac{a+\sqrt{a^2+4b}}{-2})^n+P_2(\frac{a-\sqrt{a^2+4b}}{-2})^n$ and using the initial condition $t_0=c$ gives $C=P_1+P_2 \Rightarrow P_1=C-P_2$
So $(C-P_2)(\frac{a+\sqrt{a^2+4b}}{-2})^n+P_2(\frac{a-\sqrt{a^2+4b}}{-2})^n$ what next? I tried expanding but that didn't help. I know the answer is something like $cd^n-\frac{b}{a-1}+\frac{bd^n}{a-1}$
If $a=1$, then $f_n=f_0+nb$, otherwise since $f_n=af_{n-1}+b$ we can subtract $\frac{b}{1-a}$ from both sides to get $$ f_n-\frac{b}{1-a}=a\left(f_{n-1}-\frac{b}{1-a}\right) $$ therefore, $$ \begin{align} f_n &=\frac{b}{1-a}+a^n\left(f_0-\frac{b}{1-a}\right)\\ &=a^nf_0+b\frac{1-a^n}{1-a} \end{align} $$