For recursive equations of the form $au_{n+2}=bu_{n+1}+cu_n$ I read that the trick is to let $u_n=\lambda^n$ for some $\lambda$ and then find an appropriate $\lambda$ that fits the initial conditions. However, what if the solutions to the resultant quadratic are repeated roots? For example, $u_{n+2}=2u_{n+1}-u_n$ leads to $\lambda^2-2\lambda+1=0$ or $\lambda=1$.
Also, is there are a generalisation of this trick? What if we have, say, $au_{n+2}=bu_{n+1}+cu_n+1$ or $au_{n+2}=bu_{n+1}+cu_n+f(n)$?