I would like to find the closed form of the sequence given by $$ a_{n+2} = 2a_{n+1}-a_n+2^n+2,~~~~n > 0~~~~and~~~a_1 = 1, ~~~~a_2 = 4$$
This task is in the topic of differential and difference equation. I don't know how to start solving this problem and what are we looking for? ($a_n, a_{n+2}$)
I do know how to solve the following form $$ a_{n+2} = 2a_{n+1}-a_n $$ using linear algebra as well. The actual problem I encountered the obstructionist term $\color{red}{2^n+2}$.
Are there some kind of variational constant method for recursive linear sequences,?
I only now this method for linear ODE with constant coefficient.
But I believe that such method could be doable here as well. Can any one provide me with a helpful hint or answer?.
Enforcing $X_n=a_{n+1}-a_n$ yields that $$a_{n+2} = 2a_{n+1}-a_n+2^n+2\implies (a_{n+2}-a_{n+1}) - (a_{n+1}-a_n)= 2^n+2$$ this leads to $$\color{blue}{X_{n+1} - X_n= 2^n+2}$$
By telescopic sum we have $$X_{n+1} -X_1 = \sum_{k=1}^{n}X_{k+1} - X_k =\sum_{k=1}^{n} [2^k+2] =2n+ 2^{n+1}-2 $$ That is $$a_{n+2}-a_{n+1}= a_{2}-a_1+2n+ 2^{n+1}-2 = 2n+ 2^{n+1}+1 $$
By telescopic once more we remain with $$a_{n+2}= a_2+\sum_{k=1}^{n}\left[2k+ 2^{k+1}+1\right] = 4 +n(n+1) +2^{n+2}-4+n = 2^{n+2}+ n(n+2)$$ Finally $$\color{red}{a_n = 2^{n}+ n(n-2)}$$
also see this Solving the recurrence $a_{n+1}-2a_n=2^n; a_0 = 1$