Find a closed form $x_n$ for the following recurrence relation: $$ x_{n+2} = x_{n+1} + 2x_n + 2 \\ x_1 = x_2 = 1,\;\;n\in \mathbb N $$
I'm trying to understand why I get different results for different guesses of a solution for particular part of the recurrence relation.
I've started by splitting the solution into two parts: homogenous and particular ones. It's known that $$x_n = x_n^{(h)} + x_n^{(p)}$$
Having the above in mind lets solve for homogenous. I've done this with the help of characteristic polynomial:
$$ \lambda^2 - \lambda - 2 = (\lambda + 1)(\lambda - 2) = 0 $$
By this we obtain the form of the homogenous solution:
$$ x_n^{(h)} = C_1\cdot(-1)^n + C_2 \cdot2^n $$
Here is where things get vague for me. Let's try to guess the form of the non-homogenous solution. I've started with $B\cdot n$, then
$$ B\cdot(n+2) = B\cdot(n+1) + 2Bn + 2 \\ B = \frac{2}{1-2n} $$
Therefore:
$$ x_n = C_1 \cdot (-1)^n + C_2\cdot2^n + \frac{2}{1-2n} $$
Using the initial conditions one may find $C_1 = -{13 \over 9}$ and $C_2 = {7\over 9}$. Obtain the final form:
$$ x_n = -{13 \over 9} \cdot (-1)^n + {7 \over 9} \cdot 2^n + \frac{2}{1-2n} $$
And that result doesn't match the answer in the book. However if I assume that the solution for non-homogenous part is in the form $B$, then $C_1 = -{2\over 3}$ and $C_2 = {2 \over 3}$, which by the steps above results in:
$$ x_n = {1\over 3} \cdot (2^{n+1} - 2\cdot(-1)^n) - 1 $$
being a match with the answer from the book.
I'm trying to understand where it got wrong and why the answers are different. I could have assumed non-homogenous solution to be in various forms which I believe would still lead to some form of solution. Have I made a mistake in my first assumption?