Notes on the Z-transform, part 4 5 December 2002 Solving difference equations At the end of note 3 we saw how to solve a difference equation using Z-transforms. Here is a similar example, solve x k+2 6x k+ 55x k = 0 () with x = and x 0 = 0. We begin by taking the Z-tranform of both sides, remember, if we write Z[(x k )] = X() then so, in this case we get Z[(x k+ )] = X x 0 Z[(x k+2 )] = 2 X 2 x 0 x (2) X 6X 55 0 (3) or (4) 2 6 55 As before, we do a partial fraction expansion, but, first we move the over to the right hand side, 2 6 55 = ( )( + 5) = A + B (5) + 5 giving = A( + 5) + B( ) (6) Choose = to learn A = /6 and = 5 to learn B = 6. Therefore, or Both terms of the form /( r) 6( ) + 6( + 5) 6( ) + 6( + 5) (7) (8) x k = 6 ()k + 6 ( 5)k (9) The basic process is simple, you take the Z-tranform of both sides, you solve for X, you use partial fractions to put it into a convenient form and then work out x k. In the rest of this note we will look at a variety of examples which exhibit the various difficulties that might be encountered doing this. Conor Houghton, houghton@maths.tcd.ie, see also http://www.maths.tcd.ie/~houghton/2e2.html
. Not ero on the right hand side Consider the difference equation x k+2 6x k+ 55x k = ( 3) k (0) with x = 0 and x 0 = 0. This is different than the previous example in that the right hand side is not ero, it is 3 k. This doesn t make such a difference, take the Z-tranform of both sides, and noting the trivial initial data (x 0 = 0 and x = 0), 2 X 6X 55 Z[(3 k )] = () + 3 thus, Now, use partial fractions or ( )( + 5)( + 3) ( )( + 5)( + 3) = A + B + 5 + C + 3 (2) (3) = A( + 5)( + 3) + B( )( + 3) + C( )( + 5) (4) Now, the usual, = gives A = /224, = 5 gives B = /32 and = 3 gives C = /28. Not forgetting the minus in equation (2) this gives 224 32 + 5 + 28 + 3 x k = 224 k 32 ( 5)k + 28 ( 3)k (6) Remember that the sequence on the right hand side might be a sequence of ones, = k, so, consider x k+2 6x k+ 55x k = (7) with x = 0 and x 0 = 0. Take the -tranform of both sides X 6X 55 Z[()] = Z[( k )] = ( )( + 5)( ) Without going through the calculation, the partial fraction expansion is, ( )( + 5)( ) = 60 + 96 + 5 60 x k = 60 k + 96 ( 5)k 60 2 (5) (8) (9) (20) (2)
.2 Repeated root As happens with Laplace transforms, there can be a repeated root. Consider with x = 0 and x 0 = 0. Take the -tranform of both sides x k+2 6x k+ 55x k = k (22) X 6X 55= Z[( k )] = ( ) 2 ( + 5) Now, remember that for repeated root the partial fraction expansion has a term with the root and a term with its square: Thus, ( ) 2 ( + 5) = A + B ( ) + C 2 + 5 (23) (24) (25) = A( )( 5) + B( + 5) + C( ) 2 (26) Now, = gives B = /6 and = 5 gives C = /256. The problem is that no choice of gives A on its own, instead we chose any value that hasn t been used before, = 0 for example, = 55A + 5B + 2C (27) and now, we substitute for the known values of B and C, = 55A + 5 6 + 2 20 = 55A + 256 256 Hence 55A = 20 256 = 55 256 so A = /256. This means that 256 + 6 ( ) + 2 256 + 5 The only problem now is that the /( ) 2 term might look unfamiliar, but recall has this form. We get Z[(kr k )] = (28) (29) (30) ( r) 2 (3) x k = 256 k + k 6 k + 256 ( 5)k (32) 3
.3 Less convenient inital data So far the values of x 0 and x have been chosen to keep things as simple as possible. More general values of x 0 and x might be less convenient, but there is no big change in the method. Consider x k+2 6x k+ 55x k = 0 (33) with x = 2 and x 0 = 6. Taking the Z-tranform of both sides gives and substituting for the initial data Moving everything around, this gives, X 2 2 x 0 x 6(X x 0 ) 55 0 (34) X 2 6 2 2 6X + 36 55 0 (35) 62 34 2 6 55 We still want a on top when we are finished, so move one over: 6 34 2 6 55 (36) (37) and now, remember that the partial fraction expansion works fine provided whats on top is a polynomial of degree less than than the polynomial on the bottom, so we have or Choose = to get or A = 2. = 5 gives or B = 4. Thus, and 6 34 ( )( + 5) = A + B + 5 (38) 6 34 = A( + 5) + B( ) (39) 66 34 = 6A (40) 30 34 = 6B (4) 2 + 4 + 5 (42) x k = 2() k + 4( 5) k (43) 4
.4 Examples involving the delay theorem Consider with x = 0 and x 0 = 0. δ k is the unit pulse and Z[(δ k )] =. Hence so x k+2 6x k+ 55x k = δ k (44) (δ k ) = (, 0, 0, 0,...) (45) 2 X 6X 55 Z[(δ k )] = (46) Using the partial fraction expansion, this gives ( )( + 5) 6 6 + 5 The problem now is that there are no s on top. However, if we rewrite it as [ 6 ] 6 + 5 Now, the part inside the square brackets has the form we are familiar with, we can see [( Z 6 k )] 6 ( 5)k = 6 (50) 6 + 5 and we also know from the delay theorem that the affect of multiplying by / k 0 is to delay the sequence by k 0 steps. Hence, the sequence here is delayed by one step and (47) (48) (49) { 0 = 0 x k = 6 k 6 ( 5)k Of course, the sequence on the right might be more complicated, consider (5) x k+2 6x k+ 55x k = y k (52) with x = 0 and x 0 = 0 where (y k ) = (0, 2, 0, 0, 0,...) (53) We have to calculate Z[(y k )] before we can make any progress. However, it is easy to see that (y k ) is the first delay of twice the unit pulse (y k ) = 2(δ k ) so Z[(y k )] = 2 (54) 5
Thus the Z-tranform of the difference equation gives X 6X 55 2 (55) so, 2 ( )( + 5) There are two ways to go on from here, the first is to use the previous partial fractions expansion 2 [ 6 ] (57) 6 + 5 = 2 [ 2 6 ] (58) 6 + 5 so now we are dealing with a two step delay and, keeping the extra factor of two in mind (56) { 0 x k = 8 k 2 8 ( 5)k 2 2 The other way to make progress is to work out the partial fraction expansion This means that ( )( + 5) = 55 + 76 + 80 + 5 2 [ 55 + 76 + ] 80 + 5 and using the delay theorem { 0 = 0 x k = 2 δ 55 k + 88 (k + 40 ( 5)k (59) (60) (6) (62) Now, it might look like this is a very different answer, but it isn t, expression (59) and expression (62) are actually the same. Now that putting k = in (62) gives 2 55 δ 0 + 88 0 + 40 ( 5)0 = 2 55 + 88 + 40 = 0 (63) and, what s more, k = k 2 and ( 5) k = 5 ( 5) k 2. 6
2 Exercises. Solve the difference equation x k+2 4x k+ 5x k = 0 with x 0 = 0 and x =. 2. Solve the difference equation x k+2 9x k+ + 20x k = 2 k with x 0 = 0 and x = 0. 3. Solve the difference equation x k+2 + 5x k+ + 6x k = ( 2) k with x 0 = 0 and x = 0. 4. Solve the difference equation x k+2 + 2x k+ 48x k = 0 with x 0 = 4 and x = 2. 5. Solve the difference equation x k+2 + 7x k+ 8x k = δ k with x 0 = 0 and x = 0. 7
. So take the Z-transform of both sides 2 X 4X 5 0 (64) and move things around to get X/ on one side and then do partial fractions 2 4 5 = ( 5)( + ) = A 5 + B + (65) In the usual way, we have = A( + ) + B( 5) (66) and putting = 5 gives A = /6 and putting = gives B = /6. Now 6( 5) 6( + ) (67) and hence x k = 6 5k 6 ( )k (68) 2. So, in this example, the right hand side of the difference equation is not ero. Taking the Z-transform of both sides we get 2 X 9X + 20 Z[(2 k )] = Hence, since 2 9 + 20 = ( 5)( 4) The usual partial fractions tells us that ( 5)( 4)( 2) 2 (69) (70) ( 5)( 4)( 2) = 3( 5) 2( 4) + 6( 2) (7) x k = 3 5k 2 4k + 6 2k (72) 3. Again, taking the Z-tranform of both sides we have 2 X + 5X + 6 Now, since 2 + 5 + 6 = ( + 2)( + 3) + 2 ( + 2) 2 ( + 3) (73) (74) 8
and there is a repeated root. The partial fraction expansion with a repeated root includes the root and its square, so we get ( + 2) 2 ( + 3) = A + 2 + B ( + 2) + C 2 + 3 (75) = A( + 2)( + 3) + B( + 3) + C( + 2) 2 (76) Choosing = 2 gives B = and = 3 gives C =. No value of will give A on its own, so we choose another convenient value and put in the known values of B and C: = 6A + 3 + 4 (77) so A =. Now, this means + 2 + ( + 2) + 2 + 3 (78) x k = ( 2) k + k( 2) k + ( 3) k (79) 4. Take the Z-tranform of both sides, taking care to note the initial conditions Thus giving Multiplying across we get Choosing = 8 wehave implying A = 3. Choosing = 6 so B = and we get and 2 X 4 2 2 + 2(X 4) 48 0 (80) 2 X + 2X 48 4 2 0 (8) 4 0 ( + 8)( 6) = A + 8 + B 6 (82) 4 0 = A( 6) + B( + 8) (83) 42 = 4A (84) 4 = 4B (85) 3 + 8 + 6 (86) x k = 3( 8) k + 6 k (87) 9
5. Now, taking the Z-transform and using Z[(δ k )] = 2 X + 7X 8 (88) Thus 2 + 7 8 = ( 9)( + 2) = ( 9) ( + 2) ( ) ( 9) ( + 2), using the delay theorem, we have { 0 k = 0 x k = 9k ( 2)k k > 0 (89) (90) (9) 0