Solution of a difference equation with initial conditions using the z transform
Solve the difference equation
\operatorname{y}[n+2]-(3/2)\mathbf{y}[n+1]+(1/2)\mathbf{y}[n]=(1/4)^{n},\ \mathrm{for}\ n\geq0
with initial conditions \mathbf{y}[0]=10{\mathrm{~and~}}\mathbf{y}[1]=4.
Initial conditions for a second-order differential equation usually consist of a specifi cation
of the initial value of the function and its fi rst derivative. Initial conditions for a second-order difference equation usually consist of the specifi cation of the initial two values of the function
(in this case y[0]\operatorname{and}y[1]).
Taking the z transform of both sides of the difference equation (using the time-shifting
property of the z transform),
z^{2}({\bf Y}(z)-{\bf y}[0]-z^{-1}{\bf y}[1])-(3/2)z({\bf Y}(z)-{\bf y}[0])+(1/2){\bf Y}(z)=\frac{z}{z-1/4}
Solving for Y(z),
Y(z)= \frac{\frac{z}{z-1/4}z^2 y[0]+zy[1]-(3/2)zy[0]}{z^2-(3/2)z+1/2}
Y(z)=z{\frac{z^{2}y[0]-z(7y[0)/4-y[1])-y[1]/4+3y[0]/8+1}{(z-1/4)(z^{2}-(3/2)z+1/2)}}
Substituting in the numerical values of the initial conditions,
Y(z)=z{\frac{10z^{2}-(27/2)z+15/4}{(z-1/4)(z-1/2)(z-1)}}
Dividing both sides by z,
{\frac{\mathbf{Y}(z)}{z}}={\frac{10 z^{2}-(2{7}/2)z+15/4}{(z-1/4)(z-1/2)(z-1)}}.
This is a proper fraction in z and can therefore be expanded in partial fractions as
{\frac{Y(z)}{z}}={\frac{16/3}{z-1/4}}+{\frac{4}{z-1/2}}+{\frac{2/3}{z-1}}\Rightarrow Y(z)={\frac{16z/3}{z-1/4}}+{\frac{4z}{z-1/2}}+{\frac{2z/3}{z-1}}.
Then using
\alpha^{n}\operatorname{u}[n]\overset{\mathcal Z}{\longleftrightarrow }{\frac{z}{z-\alpha}}
and taking the inverse z transform, \mathbf{y}[n]=[5.333(0.25)^{n}+4(0.5)^{n}+0.667]\mathbf{u}[n]. Evaluating this
expression for n = 0 and n = 1 yields
\mathbf{y}[0]=5.333(0.25)^{0}+4(0.5)^{0}+0.667=10
y[1]=5.333(0.25)^{1}+4(0.5)^{1}+0.667=1.333+2+0.667=4
which agree with the initial conditions. Substituting the solution into the difference equation,
\left \{ \begin{matrix}5.333(0.25)^{n+2}+4(0.5)^{n+2}+0.667 \\ -1.5[5.333(0.25)^{n+1}+4(0.5)^{n+1}+0.667] \\ +0.5[5.333(0.25)^{n}+4(0.5)^{n}+0.667] \end{matrix} \right \}=(0.25)^{n},\ \mathrm{for}\ n\geq0
or
0.333(0.25)^{n}+(0.5)^{n}+0.667-2(0.25)^{n}-3(0.5)^{n}-1+2.667(0.25)^{n}+\,2(0.5)^{n}+0.333=(0.25)^{n},\,\,{\mathrm{for}}\,\,n\geq0
or
(0.25)^{n}=(0.25)^{n},\;\;{\mathrm{for}}\;n\geq0
which proves that the solution does indeed solve the difference equation.