
Difference Equation
Purpose:
The main purpose of this page is to help future students to gain better understanding of Difference Equations concept.
Definition:
According to the book, any definition of the general term in a sequence in terms of one or more previous terms and initial cases is called a difference equation.
Example:
Minimum number of moves to solve n-ring Towers of Hanoi is a difference equation:
|
Tn+1 = 2Tn + 1, n≥1 T1=1 |
Types of Difference Equations:
I. Linear Difference Equation:
|
K Ln= ∑ ciLn-i + f(n), L1, L2 ,..., Ln Specified i=1
|
II. Nonlinear Difference Equation:
|
Ln+1=(2+n)Ln - nLn2 |
Types of Linear Difference Equation:
I. Homogenous Linear Difference Equation:
|
Ln=Ln-1 - 2Ln-2 , n>1 |
II. Non-homogenous Linear Difference Equation:
|
Ln=Ln-1 - 2Ln-2 + n2 , n>1 |
Application:
Difference equations are being used in different fields by various companies everyday. Economic forecasting and business inventory which involve lots of difference equations are two good examples of common use of difference equations. In fact, we will learn how to set up a difference equation by analyzing the inventory of a rental car company.
Example:
Car-Rental is a company that has two offices in Atlanta and Miami. Their customers are common people who rent cars locally and one-way. Each month, it finds that half of the cars that start the month in Atlanta end it in Miami, and one third of the cars that start the month in Miami end it in Atlanta. Describe this situation with difference equations:
Solution:
Using the fact that 1/2 of the cars start in Atlanta and end up in Miami, and 1/3 of the cars that start in Miami end up in Atlanta, We can determine that 1/2 and 2/3 of the cars are being rented locally in Atlanta and Miami. Let the An be the number of cars in Atlanta at the beginning of the month of n (start: n=0), and Mn be the number of cars in Miami at the beginning of the month:
|
An=1/2An-1 + 1/3Mn-1 Mn=1/2An-1 + 2/3Mn-1 |
If we assume that company starts with 1000 cars in Atlanta and 500 in Miami, so our initial conditions are: A0=1000, M0=500. Therefore, the final linked difference equations are:
|
An=1/2An-1 + 1/3Mn-1 Mn=1/2An-1 + 2/3Mn-1 A0=1000, M0=500 |
Surprisingly after computing the An and Mn, the numbers of cars in each city will stay constant after 8 months:
| n | An | Mn |
| 0 | 1000 | 500 |
| 1 | 667 | 833.3 |
| . | . | . |
| . | . | . |
| 8 | 600 | 900 |
| . | . | |
| . | . | |
| 25 | 600 | 900 |
Solving Difference Equations:
I. Homogenous Difference Equation:
Example: Solve the difference equation an+1= 5an - 6an-1, given a1= -1 and a2=1.
Solution:
- First, assume that a = rn is a solution (an+1 = r2, an = r, an-1 = 1). So:
an+1 - 5an + 6an-1 = 0 ---> r2- 5r +6 = 0 ----> r = 2 and 3
Therefore according to Table.1 homogenous solutions are: C(2n)+D(3n).
- The next step is using the homogenous solution and a1and a2 to determine the final answer.
a)(a1= -1) --> C(2)1+D(3)1=-1 ---> 2C+3D =-1
b)(a2=1) ---> C(2)2+D(3)2=1 ---> 4C+9D = 1
- Finally, After solving the above equation: D = 1 and C = -2,
Therefore: an = -2(2)n + 1(3)n = 3n - 2n+1
II. Non-homogenous Difference Equation:
Example: Solve the difference equation an+ 3 an-1 + 2 an-2 = n(-1)n
Solution:
- First, we will solve the homogenous part like the pervious example:
an+ 3 an-1 + 2 an-2 = 0 ---> r2 + 3r + 2 = 0 ----> r = -1 and -2 ---> Homogenous Solutions: D(-1)n + D(-2)n
- Now, since the non-homogenous part is n(-1)n, according to the Table.1, our guess should be (An+B)(-1)n, but because (-1)n is one of our homogenous solutions, we will multiply out guess by n (Tip.1). Therefore, our guess is: n*(An+B)(-1)n
- Plugging our guess into the difference equation to find A and B:
(An2+Bn)(-1)n + 3 (A(n-1)2 + B(n-1))(-1)n-1 + 2(A(n-2)2+B(n-2))(-1)n-2 = n(-1)n
- After expanding and comparing the elements of the same degree with n(-1)n, we will find that: A = -1/2 and B = -5/2. Therefore after plugging A and B in our guess ( n*(An+B)(-1)n ), we get our Non-homogenous solution: (-n2/2 - 5n/2)(-1)n
- Finally, the complete answer is: D(-1)n + D(-2)n + (-n2/2 - 5n/2)(-1)n
| Table.1 | ||
|
Sn |
Guess |
Our Guess = solution |
| C |
A |
n * A |
| C n |
(An+B) |
n * (An+B)n |
| C n2 |
(An2+Bn+C) |
n * (An2+Bn+C) |
| C An |
DAn |
n * DAn |
| C n An | (An+B)An | n * (An+B)An |
|
Tip.1: If the Guess equals to Solution, multiply the Guess by n. |
||
This webpage is written and designed by: Reza Kasravi (gtg917y) and Mu-Ku Kang (gtg908y) .