Hello, yakin!
[tex]a_n \:=\:2a_{n-1} + a_{n-2} - 2a_{n-2}[/tex]
. . [tex]a_0 = 0,\;a_1 = 1,\;a_2 = 2[/tex]
You found the characteristic equation and its roots: .[tex]2,\,1,\,\text{-}1[/tex]
Good work!
The closed form will contain powers of these roots:
. . [tex]2^n,\;1^n,\; (\text{-}1)^n[/tex]
The closed form is a
linear combination of these powers.
. . [tex]f(n) \;=\;a(2^n) + b(1^n) + c(\text{-}1)^n[/tex]
and we must determine [tex]a,b,c.[/tex]We know the first three terms of the sequence.
. . [tex]\begin{array}{cccccccc}f(0) = 0\!: & a + b + c &=& 0 & [1] \\ f(1) = 1\!: & 2a + b - c &=& 1 & [2] \\ f(2) = 2\!: & 4a + b + c &=& 2 & [3] \end{array}[/tex]
Solve the system: .[tex]a = \tfrac{2}{3},\;b = \text{-}\tfrac{1}{2},\;c = \text{-}\tfrac{1}{6}[/tex]Therefore: .[tex]f(n) \;=\;\tfrac{2}{3}(2^n) - \tfrac{1}{2}(1^n) - \tfrac{1}{6}(\text{-}1)^n[/tex]
. . . . . . . . [tex]f(n) \;=\;\tfrac{1}{6}\left[4\!\cdot\!2^n - 3 - (\text{-}1)^n\right][/tex]
. . . . . . . . [tex]f(n) \;=\;\tfrac{1}{6}\left[2^{n+2} - 3 + (\text{-}1)^{n+1}\right][/tex]