Generating functions ( recurrence relations ) Find $a_n$ using Generating Functions : $a_n = -a_{n-1} + 2a_{n−2}$, $n\ge2$ and $a_0 = 1$, $a_1 = 2$.
Approach : So I will form a characteristic equation $ r^2 + r - 2 = 0$ whose roots are $r_1 = -2$, $r_2 = 1$.
So my general solution is $a_n = α_1r_1^n + α_2r_2^n$.
$a_n = α_1(-2)^n + α_2(1)^n$
When $a_0 = 1$, then $1 =  α_1(-2)^0 + α_2(1)^0$, then $α_2 = 1 - α_1 $.
When $a_1 = 2$, then $2 =  α_1(-2)^1 + α_2(1)^1$, then $-2α_1 + 1 - α_1 = 2$.
$α_1 = -1/3$  and $α_2 = 4/3 $
So $a_n = -1/3r_1^n + 4/3r_2^n$.
Can anyone tell me if it is correct or not and any help will be appreciated :) .
Also, if I have $a_{n+2}=a_{n+1}+2a_n$. Can someone tell me if its char. equation should be like $r^2-r-2 = 0$? Just asking because of the addition symbol rather than subtraction.

Define the generating function:
$\begin{equation*}
   A(z)
     = \sum_{k \ge 0} a_k z^k
\end{equation*}$
Write the recurrence with no subtraction in indices, multiply by $z^n$, sum over $n \ge 0$:
$\begin{equation*}
  \sum_{n \ge 0} a_{n + 2} z^n
    = - \sum_{n \ge 0} a_{n + 1} z^n
          + 2 \sum_{n \ge 0} a_n z^n
\end{equation*}$
Recognize the sums at hand:
$\begin{align*}
   \sum_{n \ge 0} a_{n + 1} z^n
     &= \frac{A(z) - a_0}{z} \\
   \sum_{n \ge 0} a_{n + 2} z^n
     &= \frac{A(z) - a_0 - a_1 z}{z^2}
\end{align*}$
Using the initial values given:
$\begin{equation*}
   \frac{A(z) - 1 - 2 z}{z^2}
     = - \frac{A(z) - 1}{z} + 2 A(z)
\end{equation*}$
A bit of algebra gives, as partial fractions:
$\begin{align*}
  A(z)
    &= \frac{1 + 3 z}{1 - z - 2 z^2} \\
    &= \frac{5}{3} \cdot \frac{1}{1- 2 z}
          - \frac{2}{3} \cdot \frac{1}{1 + z}
\end{align*}$
The terms are geometric series, can read off the coefficients:
$\begin{equation*}
   a_n
     = \frac{5}{3} \cdot 2^n - \frac{2}{3} \cdot (-1)^n
\end{equation*}$
