If $$a_{n+1}=2a_n −n^2+n$$
Define a sequence $a_n$ that satisfy the recurrence relation as described above, with $a_1 = 3$
Find the value of $$\dfrac{ |a_{20} - a_{15} | }{18133} $$
Attempt
First evaluate $a_{0}$
$$a_{1} = 2a_{0} \Rightarrow a_{0}= \frac{3}{2}$$
Then, use Z-transform: $$a_{n+1} - 2a_{n} + n^2 - n = 0$$ $$z(\mathbf{A}(z)-a_{0}) - 2\mathbf{A}(z) + \dfrac{z(z+1)}{(z-1)^3} - \dfrac{z}{(z-1)^2} = 0$$
$$\Rightarrow \mathbf{A}(z) = \dfrac{z(3z^3 -9z^2 + 9z - 7)}{2(z-2)(z-1)^3}$$
$$\Rightarrow \mathbf{A}(z) = \dfrac{2z}{z-1} + \dfrac{z}{(z-1)^2} + \dfrac{z(z+1)}{(z-1)^3} - \dfrac{z}{2(z-2)}$$
The inverse of the Z-transform will be: $$\boxed{a_{n} = 2 + n + n^2 - 2^{n-1}}$$
Now: $$a_{20} = 422-2^{19}$$ $$a_{15} = 242-2^{14}$$
Is it Correct??
Any other precise solution will be highly appreciated
As an alternative, you can use more elementary methods for linear difference equations. In fact, the general solution will be of the form $$ a_n = a_n^h + a_n^* $$
where $a_n^h$ is the general solution of the homogeneous equation, i.e. $a_n^h = c 2^n$, and $a_n^*$ is a particular solution of the full equation. If you try a particular solution "similar" to $-n^2+2n$, namely $a_n^* = k_1 n^2+ k_2n + k_3$, you'll see that $$ a_n = c 2^n +n^2+n+2 $$
The constant $c$ can be computed from the condition $a_1=3$, yielding the solution you have obtained using the Z-Transform.