I need to solve the following recurrence relation: $a_{n+2} + 2a_{n+1} + a_n = 1 + n$
My solution:
Associated homogeneous recurrence relation is: $a_{n+2} + 2a_{n+1} + a_n = 0$
Characteristic equation: $r^2 + 2r + 1 = 0$
Solving the characteristic equation, we get: $r = -1$ with multiplicity $m = 2$
Therefore, solution of the homogeneous recurrence relation is: $a_n^{(h)} = (c_1 + c_2n)(-1)^n$
Let the particular solution of the given equation be
$a_n = c_3 + c_4n$
since, $(n + 1)$ is polynomial of degree 1.
Substituting in the given equation, we get:
$c_3 + c_4(n + 2) + 2(c_3 + c_4(n + 1)) + c_3 + c_4n = n + 1$
Comparing the corresponding coefficients, we get: $c_4 = 1/4$ and $c_3 = 0$.
Therefore, $a_n^{(p)} = n / 4$
Hence, the solution, would be:
$a_n = (c_1 + c_2n)(-1)^n + n / 4$
But the solution in textbook is
$a_n = (c_1 + c_2n)(-1)^n + 1/6(2n - 1)$
Please explain me where I am going wrong.
Thanks!