6.4 Difference Equations In a difference equation the unknowns are one or more sequences of numbers, e.g. x0, x1, x2, x3, …, xn, y0, y1, y2, y3, …, yn, In applications we are often observing some system that is changing with time and x and y represent physical quantities that change with time. Instead of observing x and y at all times we only observe them at equally spaced discrete times and n represents the nth time we observe x and y. For example, we might observe the rabbit and fox population in a region once a year on July 1 and xn and yn are the rabbit and fox populations on July 1 of year n where n counts years from some starting year. The difference equations express xn+1 and yn+1 in terms of x0, x1, x2, x3, …, xn and y0, y1, y2, y3, …, yn. In applications the formulas for xn+1 and yn+1 are usually based on physical considerations. In this section we shall restrict our attention to the situation where xn+1 and yn+1 are given by linear formulas in terms of xn and yn. In addition to the difference equations we are often given the values of x0 and y0. These starting values are called initial conditions. Example 1. Consider the difference equations (1) xn+1 = xn + 3yn (2) yn+1 = 4xn + 2yn along with the initial conditions x0 = 2 and y0 = 1. It is always possible to use the difference equations along with the initial conditions to calculater the values of xn and yn for any particular value of n. Example 1 (continued). Find x2 and y2 in Example 1. Substituting n = 1 and x0 = 2 and y0 = 1 into (1) and (2) we get x1 = x0 + 3y0 = 2 + (3)(1) = 5 y1 = 4x0 + 2y0 = (4)(2) + (2)(1) = 10 x2 = x1 + 3y1 = 5 + (3)(10) = 35 y2 = 4x1 + 2y1 = (4)(5) + (2)(10) = 40 If possible we would like to "solve" the difference equations to get formulas for xn and yn. In the case where the difference equations are linear we can do this using the powers of the coefficient matrix. We illustrate this technique with the equations in Example 1. We begin by writing (1) and (2) in vector form. 6.4 - 1 xn+1 = xn + 3yn = 1 3 xn yn+1 4xn + 2yn 4 2 yn or (3) un+1 = Aun where x un = ynn 1 3 A = 4 2 x0 2 The initial conditions can be expressed as y = 1 or u0 0 2 = 1 . The equation (3) for n = 0 says u1 = Au0 For n = 1 the equation (3) says u2 = Au1. Putting in u1 = Au0 for u1 on the right we get u2 = A(Au0) = A2u0 For n = 2 the equation (3) says u3 = Au2. Putting in u2 = A2u0 for u2 on the right we get u3 = A(A2u0) = A3u0 Continuing in this fashion we see that un = Anu0 So n n xn = 1 3 x0 = 1 3 2 yn 4 2 y0 4 2 1 n 1 3 1 3 5 + 4 (- 2) In the previous section we saw that 4 2 = 7 4 5n - 4 (- 2)n n n n n n n xn = 1 3 5n + 4 (- 2)n 3 5n - 3 (- 2) n 2 yn 7 4 5 - 4 (- 2) 4 5 + 3 (- 2) 1 n n 1 9 5 + 5 (2) = 7 12 5n - 5 (- 2)n So xn = 9 5n + 5 (- 2)n 7 7 yn = 12 5n - 5 (- 2)n 7 7 6.4 - 2 3 5n - 3 (- 2)n . 4 5n + 3 (- 2)n So In general the solutions of homogeneous, constant coefficient linear difference equations have the form c1(1)n + c2(2)n + + cm(m)n where 1, 2, …, m, are the eigenvalues of the coefficient matrix. Here is a physical situation that gives rise to difference equations. Example 2. ZipCo has done a study of employee absenteeism. They found that from one day to the next 20% of those absent one day return to work the next 10% of those at work one day are absent the next Suppose today 100 employees are absent and 800 employees are at work. Find a formula for the number of employees absent and at work n days from now. Let sn = the number of employees absent on day n wn = the number of employees at work on day n The given information translates into the following difference equations. sn+1 = 0.8sn + 0.1wn wn+1 = 0.2sn + 0.9wn along with the initial conditions s0 = 100 and w0 = 800. In vector form one has sn+1 = 0.8 0.1 sn wn+1 0.2 0.9 wn s0 = 100 w0 800 So n sn = 0.8 0.1 s0 wn 0.2 0.9 w0 0.8 0.1 We need to find the eigenvalues and eigenvectors of A = 0.2 0.9 . 0.8 - 0.1 0 = det( A - I ) = = (0.8 - )(0.9 - ) – (0.1)(0.2) 0.2 0.9 - = 2 - 1.7 + 0.7 = ( - 1)( - 0.7) So the eigenvalues are 1 = 1 and 2 = 0.7 x An eigenvector v = y for 1 = 1 satisfies 6.4 - 3 0 = (A - I)v = - 0.2 0.1 x 0 0.2 - 0.1 y So 0 = - 0.2x + 0.1y 0 = 0.2x - 0.1y x 1 So an eigenvector for 1 = 1 is any vector v = y with y = 2x. So any multiple of the vector 2 is an x eigenvector for 1 = 1. An eigenvector v = y for 2 = 0.7 satisfies 0 = (A - I)v = 0.1 0 0.2 0.1 x 0.2 y 0 = 0.1x + 0.1y 0 = 0.2x + 0.2y 1 These equations are equivalent to x = - x. So any multiple of the vector - 1 is an eigenvector for 2 = 0.7. So -1 n n 0 1 1 0.8 0.1 = TDnT -1 = 1 1 1 0.2 0.9 2 - 1 0 (0.7)n 2 - 1 1 (0.7)n -1 -1 -1 1 1 (0.7)n 1 1 = 2 - (0.7)n 3 - 2 1 = 3 2 - (0.7)n 2 - 1 1 1 + 2 (0.7) = 3 2 - 2 (0.7)n n So sn = 1 1 + 2 (0.7)n wn 3 2 - 2 (0.7) n 1 - (0.7)n 2 + (0.7)n 1 - (0.7)n s0 2 + (0.7)n w0 1 (s + w ) + (2s - w ) (0.7) = 3 2(s0 + w0 ) - (2s 0- w 0) (0.7)n 0 0 0 0 So 1 2s - w sn = 3 (s0 + w0) + 0 3 0 (0.7)n 2 2s - w wn = 3 (s0 + w0) - 0 3 0 (0.7)n In the case that s0 = 100 and w0 = 800 one has sn = 300 - 200 (0.7)n wn = 600 + 200 (0.7)n Note that (0.7)n 0 as n . So as n one has 6.4 - 4 n sn 300 wn 600 in the case where the intial conditions are s0 = 100 and w0 = 800 and 1 sn 3 (s0 + w0) 2 wn 3 (s0 + w0) in the case of general initial conditions. So in the long run, about 1/3 of the total number of employees are absent on any particular day and 2/3 are at work. 6.4 - 5