Solving difference equation by z transform I have the following difference equation:
$$\ \  y(k+2) - 2y(k+1) +2y(k) = x(k) \,$$
where x(k) is an input of the form $\ x(k) = cos(\pi k)\ $, we also have the initial value conditions
$$\ y(0) = 1\,$$
$$\ y(1) = 1\,$$
I got to the following equation by applying the properties of time shifting:
$$\ Z^2Y[Z] - Z^2y(0) - Zy(1) - 2ZY[Z] + 2Zy(0) + 2Y[Z] = X[Z]\,$$
My goal was to get to a transfer function in order to analyze how the system behaves, but it doesn't seem like it's possible since the initial conditions are not zero. Are there other approaches to this problem? (P.S. It needs to be solved by Z transform)
 A: For the difference equation:
$$y(k+2) - 2y(k+1) +2y(k) = x(k)$$
We have:
$$
\begin{align}
x(k)&= \cos(\pi k) & y(0)&=1 & y(1)&=1\
\end{align}
$$
Z-transforming both sides of the equation:
$$
\begin{align}
\mathcal{Z}\left[y(k+2) - 2y(k+1) +2y(k)\right]&=\mathcal{Z}\left[x(k)\right]\\
z^2Y(z) - z^2y(0) - zy(1) - 2zY(z) + 2zy(0) + 2Y(z) &= X(z)\\
Y(z)(z^2-2z+2)-z^2+z&=X(z)\\
\frac{Y(z)}{X(z)}(z^2-2z+2)-\frac{(z^2-z)}{X(z)}&=1\\
\frac{Y(z)}{X(z)}&=\frac{1}{(z^2-2z+2)}+\frac{(z^2-z)}{X(z)(z^2-2z+2)}
\end{align}
$$
Using a Z-transform table, we know that:
$$\mathcal{Z}[\cos(ak)]=\frac{z(z-\cos(a))}{z^2-2z\cos(a)+1}$$
Then:
$$X(z)=\mathcal{Z}[\cos(\pi k)]=\frac{(z^2+z)}{z^2+2z+1}$$
Substituting it back on the equation, we have:
$$
\begin{align}
\frac{Y(z)}{X(z)}&=\frac{1}{(z^2-2z+2)}+\frac{z(z-1)(z^2+2z+1)}{z(z+1)(z^2-2z+2)}\\
&=\frac{(z+1)(z^2-2z+2)+(z-1)(z^2+2z+1)(z^2-2z+2)}{(z+1)(z^2-2z+2)^2}\\
&=\frac{(z+1)+(z-1)(z^2+2z+1)}{(z+1)(z^2-2z+2)}\\
&=\frac{z+1+z^3+2z^2+z-z^2-2z-1}{(z+1)(z^2-2z+2)}\\
&=\frac{z^2(z+1)}{(z+1)(z^2-2z+2)}\\
&=\frac{z^2}{(z^2-2z+2)}
\end{align}
$$
If what I did is correct, this is an unstable system, once we have Zeros:$\{0,0\}$
Poles:$\{1\pm j\}$
