# Chapter 13 Difference Equations

Document Sample

```					                            Chapter 13
Difference Equations

1
Leonardo di Pisa (c. 1170 – c. 1250)   Thomas Robert Malthus (1766– 1834)
13.1 Difference Equations: Definitions
• We start with a time series {yn}={y1 , y2 , y3 , ..., yn-1, yn}
• Difference Equation – Procedure for calculating a term (yn) from the
preceding terms: yn-1, yn-2,.,... A starting value, y0, is given.
• For example: yn = f(yn-1, yn-2, ..., yn-k), given y0.
• If f(.) is linear, we have a linear difference equation. Our focus.

• First-Order Linear Difference Equation Form:
yn = ayn-1 + b             (a and b are constants)
• Second-Order Linear Difference Equation Form:
yn = ayn-1 + b yn-2 + c (a, b and c are constants)
• Similarly, an Kth-Order Linear Difference equation:
yn = an-1 yn-1 + an-2 yn-2 + ...+ an-k yn-k + c (an-1 , an-2 , ..., and c are
2
constants)
13.1 Difference Equations: Famous Example
• Originated in India. It has been attributed to Indian writer
Pingala (200 BC). In the West, Leonardo of Pisa (Fibonacci)
studied it in 1202.
• Fibonacci studied the (unrealistic) growth of a rabbit population.
• Fibonacci numbers: 0, 1, 1, 2, 3, 5, 8, 13, ... (each number
represents an additional pair of rabbits.
• This series can be represented as a linear difference equation
• Let f(n) be the rabbit population at the end of month n.
f(n)=f(n-1) + f(n-2), with initial values f(1)=1, f(0)=0.

3
13.1 Difference Equations: Example 1
• The number of rabbits on a farm increases by 8% per year in
addition to the removal of 4 rabbits per year for adoption. The
farm starts out with 35 rabbits. Let yn be the population after n
years. We can write the difference equation.
yn = 1.08yn-1 – 4;          y0 = 35        Initial Value

Percentage change
every year. (a)        What you add or subtract every year. (b)

4
13.1 Difference Equations: Example 1 – A Few
Terms
• Generate the first few terms - This gives us a feeling for how
successive terms are generated.
• Graph the terms - Plot the points (0, y0), (1, y1), (2, y2), etc.
• Example: yn = 1.08yn-1 – 4, y0 = 35

a. Generate y0, y1, y2, y3, y4
y0 = 35
y1 = 1.08(35) – 4 = 37.8 – 4 = 33.8
y2 = 1.08(33.8) – 4 = 36.50 – 4 = 32.50
y3 = 1.08(32.50) – 4 = 35.1 – 4 = 31.1
y4 = 1.08(31.1) – 4 = 33.59 – 4 = 29.59
y5 = 1.08(29.59) – 4 = 31.96 – 4 = 27.96
5
13.1 Difference Equations: Example 1 - Graphing
Difference Equations
b. Graph these first few terms
(0, 35) (1, 33.8) (2, 32.5) (3, 31.1) (4, 29.59)

yt

time (t)

6
13.1 Difference Equations: Example 2
• yn = 0.5 yn-1 – 1, y0 = 10
a. Generate y0, y1, y2, y3, y4
y0 = 10
y1 = 0.5 (10) –1 = 5 –1 = 4
y2 = 0.5 (4) –1 = 2 – 1 = 1
y3 = 0.5 (1) – 1 = 0.5 – 1 = -1/2
y4 = 0.5 (-1/2) – 1 = -0.25 – 1 = -5/4
b. Graph these first few terms
(0, 10) (1, 4) (2, 1) (3, -1/2) (4, -5/4)

7
13.1 Difference Equations: Problems

• The population of a country is currently 70 million, but is declining
at the rate of 1% per year. Let yn be the population after n years.
Difference equation showing how to compute yn from yn-1:
yn = .99yn-1,           y0 = 70,000,000 (initial value)

• We borrow \$150,000 at 6% APR compounded monthly for 30
years to purchase a home. The monthly payment is determined to
be \$899.33. The difference equation for the loan balance (yn) after
each monthly payment has been made:

yn = 1.005yn-1 – 899.33        y0 = 150,000

8
13.1 Difference Equations: Jokes

• Order of Fibonaccos
Customer: "How much is a large order of Fibonaccos?"
Cashier: "It's the price of a small order plus the price of a medium
order."

• Exponential Growth
I have been dabbling with mathematics for many years. As a matter of fact,
the first time I became quite annoyed with math was the day I turned 2 (that's
how far back I go with number crunching). For you see, the day I turned 2 I
realized that in one year my age doubled, which led me to conclude that by the
time I was 7 I'd really be 64!!!
9
13.1 Difference Equations: The Steady State

•    The steady state or long-run value represents an equilibrium, where
there is no more change in yn. We call this value y∞ :

b
yn  ayn1  b  y       ; a  1.
1 a
• Example 1: y∞ = b/(1-a) = -4/(1-1.08) = 50
Check: yn = 1.08 (50) – 4 = 50

• Example 2: y∞ = b/(1-a) = -1/(1-0.5) = -2
Check: yn = 0.5 (-2) – 1 = -2

10
13.2 Difference Equations: Solving A Difference
Equation – Repeated Iteration
• We want to generate a formula from which we can directly
calculate any term without first having to calculate all the terms
preceding it.
• Repeated Iteration Method (Backward Solution):

yn  ayn 1  b  a (ayn  2  b)  b  a 2 yn  2  ab  b 
 a 2 (ayn 3  b)  ab  b  a 3 yn 3  a 2b  ab  b 
 a n y0  a n 1b  a n  2b  ... ab  b
1 an 
 1  a b;
 a n y0                    a 1
                                                    11
13.2 Difference Equations: Solving A Difference
Equation – Repeated Iteration
• Solution:
 1 an   
y n  a n y0  
 1 a    b;
          a 1
         
 1 an   
lim n yn  y  lim n         a n y0  lim n 
 1 a    b

         

• We have 3 cases:
a) If |a|< 1 => y∞ = b/(1-a) = finite; yn converges
b) If |a| > 1 => y∞ indefinite; yn diverges
12
c) If |a|= 1 => y∞ indefinite; yn diverges
13.2 Difference Equations: Solving A Difference
Equation – Forward Solution
• Solve for yn-1 = (1/a)yn + b/a.
• Or yn = (1/a)yn+1 + b/a.

1          b 1 1                b    b   1        1   1
yn     yn 1   ( yn  2  )   ( ) 2 yn  2  ( ) 2 b  b 
a          a a a                a    a   a        a   a
1 t            1 t       1 t 1        1 2   b
 ( ) yn t  ( ) b  ( ) b  ... ( ) b 
a              a         a             a     a
 1   t 1                   1
  yn 1  
t
 1   b;          w here  ; a  1
                              a

• If | |= |(1/a)| < 1, yn converges        (|a|>1)
13
• When {a|>1, equation is divergent, the forward solution works.
13.2 Difference Equations: Solving A Difference
Equation – General Solution
• Steps:
1) Get a solution to the homogenous equation (b=0)
2) Get a particular solution, for example y∞
3) General solution: Add both solutions
• Step 1) Homogenous equation: yn = a yn-1,
– Guess a solution: yn = A kn,
– Check the guessed solution:        yn = A kn
= a yn-1 = a (A kn-1) => a=k
= A an
• Step 2) Particular solution:          y∞=b/(1-a), a≠1
b
• Step 3) General Solution:      yn  Aan  y  Aan 
1  a 14
13.2 Difference Equations: Solving A Difference
Equation – General Solution
• Step 3) General Solution:
b
yn  Aa  y  Aa 
n             n

1 a

• We can determine A, if we have some values for yt. Say y0.
b                                     b
y0  Aa  y  A 
0
 A  y0  y  y0 
1 a                                  1 a

• We can replace A in the general solution:
b         b
y n  ( y0       )a 
n

1 a      1 a                           15
13.2 Difference Equations: Solving A Difference
Equation – General Solution
• Example: Solve the difference equation: yn = 0.5 yn-1 – 1, y0 = 10

b             b
yn         ( y0        )a n
1 a           1 a
1             1
         (10         ).5n  2  12(.5) n
1  .5         1  .5

The steady state is:    y∞= -2

16
13.2 Difference Equations: Special Case - a=1
(“Random Walk”)
• In the difference equation yn = ayn-1 + b, let a=1
• Difference equation: yn = yn-1 + b
• Solution (Repeated Iteration):       yn = y0 + bn
There is only a change in b (constant change per period).
• Solve the difference equation
yn = yn-1 + 5, y0 = 10
Solution: yn = 10 + 5n

17
13.2 Difference Equations: Simple Financial
Difference Equations
•   Simple Interest:     yn = yn-1 + (y0 i)
•   Compound Interest: yn = (1 + i)yn-1
•   Increasing Annuities: yn = (1 + i)yn-1 + b (PMT)
•   Decreasing Annuities: yn = (1 + i)yn-1 – b (PMT)
•   Loans: yn = (1 + i)yn-1 – b (PMT)

• Compound Interest Solution:         yn = y0(1 + i)n
This equation is the same as FV = PV(1 + i)n

18
13.3 Graphing Difference Equations:
Definitions

• Vertical Direction – The up-and-down motion of successive
terms.
– Monotonic: The graph heads in one direction (up-increasing,
down-decreasing)
– Oscillating: The graph changes direction with every term.
– Constant: The graph always remains at the same height.

19
13.3 Graphing Difference Equations
Vertical Direction
• Monotonic: The graph heads in one direction (up – increasing,
down – decreasing). The constant a is positive (a > 0).
• Example:
yn = 2yn-1 + 3, y0 = 0             yn = 0.2yn-1 + 3, y0 = 10

a>1                            0<a<1                       20
13.3 Graphing Difference Equations
Vertical Direction
• Oscillating: The graph changes direction with every term. The
constant a is negative (a < 0).
• Example:
yn = -0.2yn-1 + 3, y0 = 0     yn = -2yn-1 + 3, y0 = 0

-1< a < 0                              a < -1
21
13.3 Graphing Difference Equations
Vertical Direction

• Constant: The graph always remains at the same height
=> yn = y∞
• Example:         yn = yn-1 + 0, y0 = 5

a =1; b=0                           22
13.3 Graphing Difference Equations
Definitions

• Long-run Behavior – The eventual behavior of the graph.
– Attracted or Stable: The graph approaches a horizontal line
(asymptotic or attracted to the line).
– Repelled or Unstable: The graph goes infinitely high or
infinitely low (unbounded or repelled from the line).

• In general, we say a system is stable if its long-run behavior is
not sensitive to the initial conditions. Some “unstable” system
maybe “stable” by chance: when y0=y∞.

23
13.3 Graphing Difference Equations
Long-run Behavior
Attracted (Stable)            Repelled (Unstable)
Example: yn = 0.5yn-1+300, y0=400   yn = 2yn-1+300, y0=400
monotonic, increasing, stable     monotonic, increasing, unstable
|a|<1; y0 < b/(1-a)                  |a|>1; y0 > b/(1-a)

24
13.3 Graphing Difference Equations
Long-run Behavior: Summary
• |a| > 1 unstable or unbounded --repelled from line b/(1-a)]
• |a| < 1 stable or bounded --attracted or convergent to [b/(1-a)]
• a < 0 oscillatory
• a > 0 monotonic
• a = -1 bounded oscillatory
• a = 1, b = 0 constant
• a = 1, b > 0 constant increasing
• a = 1, b < 0 constant decreasing
Note: All of this can be deduced from the solution:
b         b
y n  ( y0       )a 
n

1 a      1 a                            25
Figure 13.1 Stable Difference Equations (13.2)
and (13.3)

26
Figure 13.2 Unstable Difference Equations
(13.5) and (13.6)

27
Figure 13.3 Phase Diagram for Equation
(13.2)

28
Figure 13.4 Phase Diagrams for Difference
Equations (13.3), (13.5), and (13.6)

29
13.3 Difference Equations: Application
•   Solow’s Growth Model
•   kt: capital per capita
•   yt: income/production per capita: f(kt)=A (kt)α
•   δ: depreciation
•   it: investment per capita: capital accumulation: kt -(1- δ) kt-1
•   st: savings per capita: σ f(kt)        (σ: propensity to save)
•   equilibrium condition: st= it          => kt - (1- δ) kt-1 = σ f(kt)
•   Difference equation: kt - σ f(kt)= (1- δ) kt-1

30
13.3 Difference Equations: Application
• Half-life PPP
• Half-life: how long it takes for the initial deviation from y0 and y∞ to
be cut in half.
• rt: real exchange rate
• rt follows an AR(1) process: rt = a rt-1 + b
• rH = (r0 + r∞)/2
b
• Recall solution to rt:    rt  a r0  (1  a )r ;
t             t
r       ;a 1
1 a
• rH = aH r0 + (1-aH ) r∞    => (r0 + r∞)/2= aH r0 + (1-aH ) r∞
=> (1-2aH) r0 = (1-2aH ) r∞
=> 1-2aH = 0           => 1=2aH
=> H=- ln(2)/ln(a)
• If a=0.9     => H=- ln(2)/ln(0.9)=6.5763
• If a=0.95    => H=- ln(2)/ln(0.95)=13.5135                         31
• If a=0.99    => H=- ln(2)/ln(0.95)=68.9675
13.4 Second-Order Difference Equations
•   We want a general solution to yn = a1 yn-1 + a2 yn-2 + c
•   Steps:
1) Guess a solution to the homogenous equation (c=0)
2) Get a particular solution, for example y∞
3) General solution: Add both solutions
•   Step 1: Homogenous equation: yn = a1 yn-1 + a2 yn-2
Guess a solution: yn = kn
– Check the guessed solution: kn = a1 kn-1 + a2 kn-2
=> (k2 - a1 k1 - a2) kn-2 = 0     (quadratic equation)
k1, k2 = (a12 ± [a1 +4 a2]1/2)/2
- 3 cases: a12 + 4 a2>0 => k1, k2 are real and distinct.
a12 + 4 a2=0 => k1=k2 real and repeated.
a12 + 4 a2<0 => k1, k2 are complex and distinct. 32
13.4 Second-Order Difference Equations
• If a12 + 4 a2>0, the characteristic equation has distinct real roots.
The general solution of the homogeneous equation is:
A k1t + B k2t ,2
t where k1 and k2 are the two roots.

• If a12 + 4 a2=0, then the characteristic equation has a single root.
The general solution of the homogeneous equation is
(A + Bt) kt , where k = −(1/2) a1 is the root.
t

• If a12 + 4 a2<0, then the characteristic equation has complex roots.
The general solution of the homogeneous equation is
Art cos(θt + ω),
where A and ω are constants, r=√-a2, and θ= −a1/(2√-a2), or,
alternatively: C rt cos(θt) + C rt sin(θt),
1          2

where C = A cos ω and C = −A sin ω (using the formula that 33
1                     2

cos(x+y) = (cos x)(cos y) − (sin x)(sin y).
13.4 Second-Order Difference Equations:
Example
Example 1:        xt+2 + xt+1 − 2xt = 0.
The roots are 1 and −2 (real and distinct). Thus the solution is
xt = A (1)t + B(−2)t = A + B(−2)t.

Example 2:        xt+2 + 6xt+1 + 9xt = 0.
The roots are −3 (real and repeated). Thus the solution is
xt = (A + Bt)(−3)t.

Example 3:        xt+2 − xt+1 + xt = 0.
The roots are complex. We have r = 1 and cos θ = 1/2, so θ =
(1/3)π. Thus the general solution is
xt = A cos((1/3)πt + ω).

The frequency is (π/3)/2π = 1/6 and the growth factor is 1, so the
34
oscillations are undamped.
13.4 Second-Order Difference Equations:
Example
• Step 2: Get a particular solution, for example, y∞
• Step 3: General Solution: Add homogeneous solution to particular
solution

Example: yt = -6yt-1 - 9yt-2 + 16.
Solution to homogeneous equation: yt = (A + Bt)(−3)t.
Particular solution: y∞= 16/(1+6+9)=1
Solution:             yt = (A + Bt)(−3)t + 1

Note: If we have y0 and y1, we can solve for A and B.
Say: y0 = 1 and y1 = 2
y0 = 1 = (A + B 0)(−3)0 + 1 = A + 1            => A=0
y1 = 2 = (A + B 1)(−3)1 + 1 = -3x0 -3B + 1 => B=-1/3
35
Definite Solution:        yt =   (-1/3t)(−3)t   +1
13.5 System of Equations: First-Order Difference
Equations
• Now, we have a system
yt = a yt-1 + b xt-1 + m
xt = c yt-1 + d xt-1 + n

• Let’s rewrite the system using linear algebra:
 y  a b   yt 1  m
zt   t         x    n   A zt 1  
 xt   c d   t 1   

• Diagonalizing the system:
H-1 zt = H-1 A (H H-1) zt-1 + H-1 κ
H-1 A H = Λ
H-1 zt = ut     and   H-1 κ = s
That is,
ut = Λ ut-1 + s                                     36
13.5 System of Equations: First-Order Difference
Equations
• Diagonalized system: ut = Λ ut-1 + s

 u1,t  l1 0   u1,t 1   s1   l1u1,t 1  s1 
ut                              l u

 u
u 2,t   0 l2   2,t 1   s2   2 2,t 1  s2 

• To solve the system, we need to solve the eigenvalue equation:
l2 - (a + d) l + (ad - cb) = 0         (l2 - tr(A) l + |A| = 0)

37
13.5 System of Equations: First-Order Difference
Equations - Example
• Now, we have a system
yt = 4 yt-1 + 5 xt-1 + 2
xt = 5 yt-1 + 4 xt-1 + 4

• Let’s rewrite the system using linear algebra:
 yt  4 5  yt 1  2
zt           x    4
 xt  5 4  t 1   

• Eigenvalue equation: l2 - 8 l - 9 = 0            => l1, l2(9,1)

• Transformed univariate equations:
u 1,t = 9 u1,t-1 + s1     (unstable equation)
u 2,t = -1 u2,t-1 + s2    (unstable equation)
38
13.5 System of Equations: First-Order Difference
Equations - Example
• Two eigenvalues: l1, l2(9,1)

• Transformed univariate equations:
u 1,t = 9 u1,t-1 + s1     (unstable equation)
u 2,t = -1 u2,t-1 + s2    (unstable equation)
• Recall solution for linear first-order equation:
 1  at        
yn  a y0  
t
 1 a          b;
            a 1
               
• Solution for transformed univariate equations:
u 1,t = 9t u1,0 + (1-9t)/(-8) s1
u 2,t = (-1)t u2,0 + (1-(-1)t)/(2) s2
39
13.5 System of Equations: First-Order Difference
Equations - Example
• Use the eigenvector matrix, H, to transform the system:
1 1                1  1
H            ; H 1               ( 1 / 2 )
1  1             1 1   
s             1 / 2    1 / 2   2  3 
s   1   H 1                   4    1
 s2           1 / 2  1 / 2    
1 1   u1,t  u1,t  u 2 ,t 
zt  Hut                               
1  1 u 2 ,t  u1,t  u 2 ,t 

 t          1  9t                         1  ( 1) t 
 yt  [9 u1, 0  3 8 ]  [(1) u 2 , 0  1
t
]
2
x               1 9 t                                     
1  ( 1) t 
 t  [9 t u  3          ]  [(1) t u 2 , 0  1            ]


1, 0
8                                 2      


If we are given y0 and x0, we can solve for u1,0 and u2,0 (a 2x2 system):
y0 = u1,0 + u2,0                                       40
x0 = u1,0 - u2,0

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 13 posted: 11/25/2011 language: Italian pages: 40