Second order recurrence relation with $\delta$ function
Solution 1:
The difference equation given is
$2y_n - y_{n-1} - 2 y_{n-2} = \delta(n - 2) $
Shift the index by $+2$, you get
$2y_{n+2}- y_{n+1} - 2 y_{n} = \delta(n) $
which is a difference equation of second order. The characteristic polynomial is
$ 2 x^2 - x - 2 = 0 $
Its roots are
$ x_1 = \dfrac{1}{4} ( 1 - \sqrt{17} ) $
$ x_2 = \dfrac{1}{4} ( 1 + \sqrt{17} ) $
A particular solution is $y_n = -\dfrac{1}{2} \delta(n) $
Thus the overall solution is
$ y_n = A (x_1)^n + B (x_2)^n - \dfrac{1}{2} \delta(n) $
Now imposing the initial conditions,
$y_0 = A + B - \dfrac{1}{2} $
$y_1 = A x_1 + B x_2 $
Solving for $A$ and $B$ we obtain,
$A = \dfrac{ x_2 (y_0 + \frac{1}{2}) - y_1 }{x_2 - x_1} $
$B = \dfrac{ -x_1 ( y_0 + \frac{1}{2}) + y_1 } { x_2 - x_1 } $