# Connexions

You are here: Home » Content » m17 - Solution of Difference Equations using the Z-Transform

### Recently Viewed

This feature requires Javascript to be enabled.

# m17 - Solution of Difference Equations using the Z-Transform

Module by: C. Sidney Burrus. E-mail the author

Summary: The z transform will convert a linear, constant coefficient difference equation into an algebraic equation. This is the same as the Laplace transform converting a differential equation into an algebraic equation.

## Solution of Difference Equations using the Z-Transform

The z-transform can be used to convert a difference equation into an algebraic equation in the same manner that the Laplace converts a differential equation in to an algebraic equation. The one-sided transform is particularly well suited for solving initial condition problems. The two unilateral shift properties explicitly use the initial values of the unknown variable.

A difference equation DE contains the unknown function x ( n ) x ( n ) and shifted versions of it such as x ( n 1 ) x ( n 1 ) or x ( n + 3 ) x ( n + 3 ) . The solution of the equation is the determination of x ( t ) x ( t ) . A linear DE has only simple linear combinations of x ( n ) x ( n ) and its shifts. An example of a linear second order DE is

a x ( n ) + b x ( n 1 ) + c x ( n 2 ) = f ( n ) a x ( n ) + b x ( n 1 ) + c x ( n 2 ) = f ( n )
(1)
A time invariant or index invariant DE requires the coefficients not be a function of n n and the linearity requires that they not be a function of x ( n ) x ( n ) . Therefore, the coefficients are constants.

This equation can be analyzed using classical methods completely analogous to those used with differential equations. A solution of the form x ( n ) = K λ n x ( n ) = K λ n is substituted into the homogeneous difference equation resulting in a second order characteristic equation whose two roots give a solution of the form x h ( n ) = K 1 λ 1 n + K 2 λ 2 n x h ( n ) = K 1 λ 1 n + K 2 λ 2 n . A particular solution of a form determined by f ( n ) f ( n ) is found by the method of undetermined coefficients, convolution or some other means. The total solution is the particular solution plus the solution of the homogeneous equation and the three unknown constants K i K i are determined from three initial conditions on x ( n ) x ( n ) .

It is possible to solve this difference equation using z-transforms in a similar way to the solving of a differential equation by use of the Laplace transform. The z-transform converts the difference equation into an algebraic equation. Taking the ZT of both sides of the DE gives

a X ( z ) + b [ z 1 X ( z ) + x ( 1 ) ] + c [ z 2 X ( z ) + z 1 x ( 1 ) + x ( 2 ) ] = Y ( z ) a X ( z ) + b [ z 1 X ( z ) + x ( 1 ) ] + c [ z 2 X ( z ) + z 1 x ( 1 ) + x ( 2 ) ] = Y ( z )
(2)
solving for X ( z ) X ( z ) gives
X ( z ) = z 2 [ Y ( z ) b x ( 1 ) x ( 2 ) ] z c x ( 1 ) a z 2 + b z + c X ( z ) = z 2 [ Y ( z ) b x ( 1 ) x ( 2 ) ] z c x ( 1 ) a z 2 + b z + c
(3)
and inversion of this transform gives the solution x ( n ) x ( n ) . Notice that two initial values were required to give a unique solution just as the classical method needed two values.

These are very general methods. To solve an n n th order DE requires only factoring an n n th order polynomial and performing a partial fraction expansion, jobs that computers are well suited to. There are problems that crop up if the denominator polynomial has repeated roots or if the transform of y ( n ) y ( n ) has a root that is the same as the homogeneous equation, but those can be handled with slight modifications giving solutions with terms of the from n λ n n λ n just as similar problems gave solutions for differential equations of the form t e s t t e s t .

The original DE could be rewritten in a different form by shifting the index to give

a x ( n + 2 ) + b x ( n + 1 ) + c x ( n ) = f ( n + 2 ) a x ( n + 2 ) + b x ( n + 1 ) + c x ( n ) = f ( n + 2 )
(4)
which can be solved using the second form of the unilateral z-transform shift property.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

### Reuse / Edit:

Reuse or edit module (?)

#### Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

#### Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.