7 - DIFFERENCE EQUATIONS Many problems in Probability give rise to difference equations. Difference equations relate to differential equations as discrete mathematics relates to continuous mathematics. Anyone who has made a study of differential equations will know that even supposedly elementary examples can be hard to solve. By contrast, elementary difference equations are relatively easy to deal with. Aside from Probability, Computer Scientists take an interest in difference equations for a number of reasons. For example, difference equations frequently arise when determining the cost of an algorithm in big-O notation. Since difference equations are readily handled by program, a standard approach to solving a nasty differential equation is to convert it to an approximately equivalent difference equation. Classification of Difference Equations As with differential equations, one can refer to the order of a difference equation and note whether it is linear or non-linear and whether it is homogeneous or inhomogeneous. The present discussion will almost exclusively be confined to linear second order difference equations both homogeneous and inhomogeneous. Notation Convention A trivial example stems from considering the sequence of odd numbers starting from 1. The associated difference equation might be specified as: f(n)=f(n-1)+2 given that f(1) =1 In words: term n in the sequence is two more than term n-1. The proviso, f(1) = 1, constitutes an initial condition. The first term in the sequence is 1. A term like f(n) so strongly suggests a continuous function that many writers prefer to use a subscript notation. The present difference equation would be presented as: Un = Un-1+2 given that u1 = 1 (7.1) This is the notation which will be used below. It is strongly implicit that n is an integer. In simple cases, a difference equation gives rise to an associated auxiliary equation (first explained in (7.2) overleaf). In the case of (7.1) the associated auxiliary equation is: w1 - 1 =0 The highest power of the polynomial in w is 1 and, accordingly, (7.1) is said to be a first order difference equation. If the constant term 2 were absent from (7.1), the equation would be homogeneous but its presence makes it inhomogeneous. Some standard techniques for solving elementary difference equations analytically will now be presented. . . - 7.1 -
Second Order Homogeneous Linear Difference Equation - I To solve: Un = Un-1 + Un-2 given that u0 = 1 and u1 = 1 transfer all the terms to the left-hand side: Un -Un-1-Un-2=0 The zero on the right-hand side signifies that this is a homogeneous difference equation. Guess: Un = Awn SO: Aw" - Awn-1 - Awn-2 = 0 and: w2 - w - 1 = 0 (7.2) This is the auxiliary equation associated with the difference equation. Being a quadratic, the auxiliary equation signifies that the difference equation is of second order. The two roots are readily determined: 11 - 1+ V/5 2 and W2 = 1- v5 2 For any A1 substituting A1w" for un in un - Un-1 - Un-2 yields zero. For