# Z Transform, Difference Equation.

Cuthbert Nyack
In analogy to how the Laplace Transform can be used to solve differential equations, then the Z transform can be used to solve difference equations. A difference equation with initial condition is shown below. Taking the Z transform and ignoring initial conditions that are zero, we get:- Solving for X(z) and expanding X(z)/z in partial fractions gives:- X(z) simplifies to:- And the inverse Z Transform can now be taken to give the solution for x(k). Difference equations arise out of the sampling process. If an analog signal is sampled, then the differential equation describing the analog signal becomes a difference equation. Consider the following case:- In the Z plane the poles are located according to the following 2 equations:-  The following applet shows the solution for different b, c.
eg parameters (0.7, 0.1, 1.0, 1.0) real poles.
eg parameters (-1.0, 0.0, 1.0, 1.0) real poles.
eg parameters (-1.0, 0.1, 1.0, 0.03) real poles, one outside the unit circle.
eg parameters (-1.8, 0.8, 2.0, 0.2) real poles, one on the unit circle.
eg parameters (-2.0, 1.0, 2.0, 0.02) 2 real poles on the unit circle.
eg parameters (-1.98, 1.0, 2.0, 0.2) CC poles on the unit circle and close to 1.
eg parameters (-1.98, 1.035, 2.0, 0.1) CC poles outside the unit circle and close to 1.
eg parameters (2.0, 1.005, 5.0, 0.06) CC poles outside the unit circle and close to -1.
eg parameters (0.0, 1.03, 5.0, 0.05) CC poles outside the unit circle and close to ±j.

Unlike a linear 2nd order differential equation, a linear 2nd order difference eqn can have unstable solutions.