# general solution of $y(n+2)+2y(n+1)-3y(n) = -2n$

I would like to find the general solution of $y(n+2)+2y(n+1)-3y(n) = -2n$.

I've found the general solution of $\tilde{y}(n+2)+2\tilde{y}(n+1)-3\tilde{y}(n) = 0$ to be $\tilde{y}(n) = c_1(-3)^n+c_2$.

I also found that for $b(n) = -2n$ and $L_b(y):= y(n+2)-2y(n+1)+y(n)$ is a difference equation where $L_b(b(n))=0$.

Then by the annihalator method I find that the general solution of $y(n+2)+2y(n+1)-3y(n) = -2n$ must be of the form $y(n) = c_1(-3)^n+c_2 + c_3 + nc_4$.

To find the values of $c_3$ and $c_4$ , I fill in $y(n) = c_1(-3)^n+c_2 + c_3 + nc_4$ into the original difference equation where $c_1 = 0$ and $c_2 = 0$.

This gives me $c_3 + c_4(n+2) + 2c_3 + c_4(n+1) - 3c_3 -3c_4n = -2n \Rightarrow 3c_4 +nc_4 = -2n$.

This equation has no solution, so my question is, how should I solve this?

• Adding $c_3+nc_4$ leads to a deadend since none is a particular solution of the recursion. – Did Jan 25 '15 at 16:47
• I'm pretty sure there is an answer though, since it is an exercise of last year's exam of the course I'm following. – reinout-g Jan 25 '15 at 18:59
• Of course "there is an answer"! Only, it does not pass by the particular solution you wrote. – Did Jan 25 '15 at 21:04

We first define two linear difference operators: \begin{align} Ly &:= (\tau +3)(\tau - 1) y(n) \\ L_Ay &:= (\tau - 1)^2y(n) \end{align} Then we have the inhomogeneous difference equation $$Ly = -b$$ with $b=2n$. Furthermore, we have that $$L_Ab = 0$$ i.e., $L_A$ annihilates $b$. Then $Ly=-b$ implies $$L_ALy = -L_Ab = 0$$ Now define $L'= L_AL$, then we have a linear homogeneous difference equation of order $4$: $$L'y = (\tau+3)(\tau - 1)^3y(n)=0$$ Which has general solution $$y(n) = c_1 + c_2n + c_3 n^2 +c_4(-3)^n$$ with $c_1,c_4 \in \mathbb{C}$ and $c_2,c_3$ have to be determined. Substitution yields the following system of equations for $c_2$ and $c_3$: $$\begin{bmatrix} 4 & 6 \\ 0 & 8\end{bmatrix}\begin{bmatrix} c_2 \\ c_3 \end{bmatrix} = \begin{bmatrix} 0 \\ -2 \end{bmatrix}$$ which yields $c_2 = \dfrac{3}{8}$ and $c_3 = - \dfrac{1}{4}$. Hence the general solution is given by $$y(n) = c_1 + \dfrac{3}{8}n - \dfrac{1}{4}n^2 + c_4 (-3)^n, \quad n \geq 0, \quad c_1,c_4 \in \mathbb{C}$$
When we have given an linear recurrence equation of a sequence such as your case : $$y(n+2)+2y(n+1)-3y(n) = -2n$$
The first point is to find the general solution of the associated homogeneous equation $$\tilde{y}(n+2)+2\tilde{y}(n+1)-3\tilde{y}(n) = 0$$ which you did $\tilde{y}(n) = c_1(-3)^n+c_2$. (the general method consist to solve the associated polynomial equation, in this case $r^2+2r-3=0$ which gives us $r_1=-3$ and $r_2=1$ hence $\tilde{y}(n) = c_1r_1^n+c_2r_2^n$)
The second point here is to find a particular solution, and because the constant term $-n$ is polynomial of degree $1$ the particular solution will be polynomial of degree 2,and to find it we consider $y_0(n)=an^2+bn+c$ and we replace it in the equation to obtain : $$y_0(n)=-\frac{2n^2-3n}{8}+c$$
And finally the set of solutions is $\{y=y_0+\tilde{y} /c_1,c_2 \in \mathbb{R}\}$
finding $c_1$ and $c_2$ requires $y(0)$ and $y(1)$ or any other two values.