In general I solve an recursive equation like $a_n=3a_{n-1}-2a_{n-2}$ by expressing them as matrices, diagonalize them and then calculate it (very shortened, because I'm confident with that method already).
However now I found another approach and wanted to ask if it is a correct approach and how/why exactly it works:
The characteristic polynomial is $$x^2-3x+2=(x-1)(x-2)$$
Now we can observe that $a_n$ has to be of the form $a_n=a\cdot2^k+b\cdot 1^k$ With the two starting conditions (for example $a_0=-1, a_1=1$) we get the equation system:
$$-1=a+b$$ $$1=2a+b$$
We can easily see $b=-3, a=2$ and therefore the closed form results in:
$$a_n=2\cdot2^k-3\cdot1^k=2^{k+1}-3$$
I know that the solution is right and it seems that the approach is correct. However I don't understand it and (especially the step from $(x-1)(x-2)$ to $a_n=a\cdot2^k+b\cdot1^k$. I would appreciate, if somebody could explain it to me.
The equation is linear, hence if you find particular solutions, any linear combination of those solutions is also a solution. And as the equation is of the second order, it suffices to find two independent solutions to get the most general solution.
Now, by educated guess, you try the Ansatz $a_n=a^n$ for some unknown constant $a$. Plugging in the recurrence,
$$a^n=3a^{n-1}-2a^{n-2}$$ or after simplification,
$$\color{green}{a^2=3a-2}.$$
This is how the characteristic equation appears. Of course we have the solutions $a=1$ and $a=2$, and the general solution of the recurrence is
$$c_11^n+c_22^n.$$
($1^n=1$ and $2^n$ are indeed linearly independent.)
More generally, the solution will be a linear combination of the powers of the roots of the characteristic equation (real or complex).
The method falls short in case of multiple roots, because you won't get enough independent solutions. This is solved by using extra Ansatz, of the form $n^ka^n.$
E.g.
$$a_{n+2}-2a_{n+1}+a_n=0$$ yields a double root $a=1$, so that $1^n$ is a solution. Then the Ansatz $n^11^n=n$ gives
$$n+2-2(n+1)+n=0$$ which is indeed true, and the general solution is
$$c_1+c_2n.$$