Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic...

35
Fin500J Topic 6 Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig Reference: Lecture Notes by Paul Dawkins, 2007, page 20-33, page 102-121, page 137-155 and page 340-344 http://tutorial.math.lamar.edu/terms.aspx Slides designed by Yajun Wang

Transcript of Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic...

Page 1: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Fin500J Topic 6Fall 2010 Olin Business School 1

Fin500J: Mathematical Foundations in Finance

Topic 6: Ordinary Differential Equations

Philip H. DybvigReference: Lecture Notes by Paul Dawkins, 2007, page 20-33,

page 102-121, page 137-155 and page 340-344http://tutorial.math.lamar.edu/terms.aspx

Slides designed by Yajun Wang

Page 2: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Introduction to Ordinary Differential Equations (ODE)

Recall basic definitions of ODE,orderlinearityinitial conditionssolution

Classify ODE based on( order, linearity, conditions) Classify the solution methods

Fin500J Topic 6Fall 2010 Olin Business School 2

Page 3: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Derivatives Derivatives

dx

dy

Fin500J Topic 6Fall 2010 Olin Business School

Partial Derivatives

u is a function of more than one

independent variable

Ordinary Derivatives

y is a function of one independent variable

y

u

3

Page 4: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Differential Equations DifferentialEquations

162

2

xydx

yd

Fin500J Topic 6Fall 2010 Olin Business School

involve one or more partial derivatives of unknown functions

Ordinary Differential Equations

involve one or moreOrdinary derivatives of

unknown functions

02

2

2

2

x

u

y

u

4

Partial Differential Equations

Page 5: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Ordinary Differential EquationsOrdinary Differential Equations

Fin500J Topic 6Fall 2010 Olin Business School

)cos(25

:

2

2

xydx

dy

dx

yd

eydx

dy

Examples

x

Ordinary Differential Equations (ODE) involve one or more ordinary derivatives of unknown functions with respect to one independent variable

y(x): unknown function

x: independent variable

5

Page 6: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Order of a differential equationOrder of a differential equation

Fin500J Topic 6Fall 2010 Olin Business School

12

)cos(25

:

4

3

2

2

2

2

ydx

dy

dx

yd

xydx

dy

dx

yd

eydx

dy

Examples

x

The order of an ordinary differential equations is the order of the highest order derivative

Second order ODE

First order ODE

Second order ODE

6

Page 7: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Solution of a differential equationSolution of a differential equation

0)()(

)(

:Proof

)(

tt

t

t

eetxdt

tdx

edt

tdx

etxSolution

Fin500J Topic 6Fall 2010 Olin Business School

A solution to a differential equation is a function that satisfies the equation.

0)()(

:

txdt

tdx

Example

7

Page 8: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Linear ODELinear ODE

Fin500J Topic 6Fall 2010 Olin Business School

1

)cos(25

:

3

2

2

22

2

ydx

dy

dx

yd

xyxdx

dy

dx

yd

eydx

dy

Examples

x

An ODE is linear if the unknown function and its derivatives appear to power one. No product of the unknown function and/or its derivatives

Linear ODE

Linear ODE

Non-linear ODE

8

)()()()(')()()()()( 011

1 xgxyxaxyxaxyxaxyxa nn

nn

Page 9: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Boundary-Value and Initial value Problems

Boundary-Value Problems

The auxiliary conditions are not at one point of the independent variable

More difficult to solve than initial value problem

5.1)2(,1)0(

'2'' 2

yy

eyyy x

Fin500J Topic 6Fall 2010 Olin Business School

Initial-Value Problems

The auxiliary conditions are at one point of the independent variable

5.2)0(',1)0(

'2'' 2

yy

eyyy x

same different

9

Page 10: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Classification of ODEODE can be classified in different waysOrder

First order ODESecond order ODENth order ODE

LinearityLinear ODENonlinear ODE

Auxiliary conditionsInitial value problemsBoundary value problems

Fin500J Topic 6Fall 2010 Olin Business School 10

Page 11: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

SolutionsAnalytical Solutions to ODE are available for

linear ODE and special classes of nonlinear differential equations.

Numerical method are used to obtain a graph or a table of the unknown function

We focus on solving first order linear ODE and second order linear ODE and Euler equation

Fin500J Topic 6Fall 2010 Olin Business School 11

Page 12: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

First Order Linear Differential Equations

Def: A first order differential

equation is said to be linear if it

can be written)()( xgyxpy

Fin500J Topic 6Fall 2010 Olin Business School 12

Page 13: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

First Order Linear Differential EquationsHow to solve first-order linear ODE ?

Sol: )1()()( xgyxpy

)2()()()()()( xgxyxpxdx

dyx

Fin500J Topic 6Fall 2010 Olin Business School 13

Multiplying both sides by , called an

integrating factor, gives

)(x

assuming we get

)3(),(')()( xxpx

)4()()()(')( xgxyxdx

dyx

Page 14: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

First Order Linear Differential Equations

Fin500J Topic 6Fall 2010 Olin Business School 14

By product rule, (4) becomes

Now, we need to solve from (3)

)(

)(

)(')(')()( xp

x

xxxpx

)6()(

)()()(

)()()()(

)5()()())'()((

1

1

x

cdxxgxxy

cdxxgxxyx

xgxxyx

)(x

Page 15: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

First Order Linear Differential Equations

Fin500J Topic 6Fall 2010 Olin Business School 15

)7()(

)()(ln

)())'((ln)()(

)('

)(3

)(

2

2

dxxpcdxxp ecex

cdxxpx

xpxxpx

x

to get rid of one constant, we can use

)9()()(

)(

thenisequation aldifferentiorder first linear a osolution t The

)8()(

)(

)(

dxxp

dxxp

e

cdxxgxxy

ex

Page 16: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Summary of the Solution Process

Fin500J Topic 6Fall 2010 Olin Business School 16

Put the differential equation in the form (1)Find the integrating factor, using (8) Multiply both sides of (1) by and write

the left side of (1) asIntegrate both sidesSolve for the solution

)(x)(x

))'()(( xyx

)(xy

Page 17: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Example 1

Sol:

xeyy 2

xx

xx

xxx

xdxdx

dxxpdxxp

ece

cee

cdxeee

cdxeee

cdxxgeexy

2

2

2)1()1(

)()()()(

Fin500J Topic 6Fall 2010 Olin Business School 17

Page 18: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Example 2

Sol:

2

1)1(,2' 2 yxxyxy

.12

7

3

1

4

1

2

1

c,get tocondition initial Apply the

3

1

4

1

3

1

4

1

)1()1(

)()(

12

'

22342

2222

)()(

cc

cxxxcxxx

cdxxxxcdxxee

cdxxgeexy

xyx

y

dxx

dxx

dxxpdxxp

Fin500J Topic 6Fall 2010 Olin Business School 18

Page 19: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Second Order Linear Differential Equations

Homogeneous Second Order Linear Differential Equationso real roots, complex roots and repeated roots

Non-homogeneous Second Order Linear Differential Equationso Undetermined Coefficients Method

Euler Equations

Fin500J Topic 6Fall 2010 Olin Business School 19

Page 20: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

)(''' xgcybyay

where a, b and c are constant coefficientsLet the dependent variable y be replaced by the sum of the two new variables: y = u + vTherefore

)('''''' xgcvbvavcubuau

If v is a particular solution of the original differential equation

The general solution of the linear differential equation will be the sum of a “complementary function” and a “particular solution”.

purpose

Second Order Linear Differential Equations

The general equation can be expressed in the form

0''' cubuau

Fin500J Topic 6Fall 2010 Olin Business School 20

Page 21: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

0''' cybyay

Let the solution assumed to be: rxey

rxredx

dy rxer

dx

yd 22

2

0)( 2 cbrarerx

characteristic equation

Real, distinct rootsDouble rootsComplex roots

The Complementary Function (solution of the homogeneous equation)

Fin500J Topic 6Fall 2010 Olin Business School 21

Page 22: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

xrey 1 xrey 2

xrxr ececy 2121

Real, Distinct Roots to Characteristic Equation• Let the roots of the characteristic equation be real, distinct and of values r1 and r2. Therefore, the solutions of the characteristic equation are:

• The general solution will be

06'5'' yyy 0652 rr

3

2

2

1

r

r xx ececy 32

21

• Example

Fin500J Topic 6Fall 2010 Olin Business School 22

Page 23: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

rxey rxrx rVeVey ''rxVey Let rxrxrx VerVreVey 2'2'''' and

where V is a function of x

0''' cybyay

0)('' xV dcxV

rxrxrxrx xececedcxbey 21)(

Equal Roots to Characteristic Equation• Let the roots of the characteristic equation equal and of value r1 = r2 = r. Therefore, the solution of the characteristic equation is:

0cbrar2 0bar2

Fin500J Topic 6Fall 2010 Olin Business School 23

Page 24: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

)).sin()(cos(

,))sin()(cos()(

2

)(1

xixeey

xixeeyxxi

xxi

).sin(cos

:is d.e. theosolution t geneal theTherefore, equation.

aldifferenti the tosolutions twoare and that see easy to isIt

)sin()(2

1)(),cos()(

2

1)(

21

2121

xecx)(ecy(x)

vu

xeyyi

xvxeyyxu

λxλx

xx

Complex Roots to Characteristic EquationLet the roots of the characteristic equation be complex in the form r1,2 =λ±µi. Therefore, the solution of the characteristic equation is:

Fin500J Topic 6Fall 2010 Olin Business School 24

Page 25: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

(I) Solve 09'6'' yyy

characteristic equation

0962 rr

321 rr

xexccy 321 )(

Examples(II) Solve 05'4'' yyy

characteristic equation

0542 rr

ir 22,1

)sincos( 212 xcxcey x

Fin500J Topic 6Fall 2010 Olin Business School 25

Page 26: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

When g(x) is a polynomial of the form where all the coefficients are constants. The form of a particular solution is

)(''' xgcybyay

cky /

nnxaxaxaa ...2

210

nnxxxy ...2

210

Non-homogeneous Differential Equations (Method of Undetermined Coefficients)

When g(x) is constant, say k, a particular solution of equation is

Fin500J Topic 6Fall 2010 Olin Business School 26

Page 27: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Example

Solve 3844'4'' xxyyy

32 sxrxqxpy 232' sxrxqy

sxry 62''

3322 84)(4)32(4)62( xxsxrxqxpsxrxqsxr

equating coefficients of equal powers of x

84

0124

4486

0442

s

sr

qrs

pqr

32 26107 xxxy p

0442 rr

characteristic equation

xc exccy 2

21 )(

32221 26107)( xxxexcc

yyyx

pc

04'4'' yyy

complementary function

2r

Fin500J Topic 6Fall 2010 Olin Business School 27

Page 28: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Non-homogeneous Differential Equations (Method of Undetermined Coefficients)

rxAey • When g(x) is of the form Terx, where T and r are constants. Theform of a particular solution is

cbrar

TA

2

• When g(x) is of the form Csinnx + Dcosnx, where C and D are constants, the form of a particular solution is

nxFnxEy cossin

2222

2

)(

)(

bnanc

nbDCancE

2222

2

)(

)(

bnanc

nbDCancF

Fin500J Topic 6Fall 2010 Olin Business School 28

Page 29: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Example

Solve 18'6''3 yy

Cxy Cy '

0'' y

18)C(6)0(3

3C

xy p 3

063 2 rr

characteristic equation

xc eccy 2

21

x

pc

eccx

yyy2

213

0'6''3 yy

complementary function

2,0 21 rr

Fin500J Topic 6Fall 2010 Olin Business School 29

Page 30: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Example

Solve xeyyy 478'10''3

xCxey 4xCexy 4)41('

xCexy 4)816(''

71024 CC

2

1C

xp xey 4

2

1

0)4)(23(8103 2 rrrrcharacteristic equation

xxc BeAey 43/2

xxx

pc

BeAexe

yyy

43/24

2

1

08'10''3 yyy

complementary function

4,3/2 21 rr

Fin500J Topic 6Fall 2010 Olin Business School 30

Page 31: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

ExampleSolve xyyy 2cos526'''

xDxCy 2sin2cos )2cos2sin(2' xDxCy

)2sin2cos(4'' xDxCy

0102

52210

DC

DC

1

5

D

C

xxy p 2sin2cos5

0)3)(2(62 rrrrcharacteristic equation

xxc BeAey 32

xxBeAe

yyyxx

pc

2sin2cos532

06''' yyy

complementary function

3,2 21 rr

Fin500J Topic 6Fall 2010 Olin Business School 31

Page 32: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Euler EquationsDef: Euler equations

Assuming x>0 and all solutions are

of the form y(x) = xr

Plug into the differential equation to

get the characteristic equation

0'''2 cybxyyax

.0)()1( crbrar

Fin500J Topic 6Fall 2010 Olin Business School 32

Page 33: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Fin500J Topic 6Fall 2010 Olin Business School 33

• The characteristic equation has two different real solutions r1 and r2.

• In this case the functions y = xr1 and y = xr2 are both solutions to the original equation. The general solution is: 21

21)( rr xcxcxy

.xcxcy(x)

.r,rr-)r(r-

yxyyx

32

2

5

1

21

2

32

5015312

:isequation sticcharacteri the,015'3''2

Example:

Page 34: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Fin500J Topic 6Fall 2010 Olin Business School 34

• The characteristic equation has two equal roots r1 = r2=r.

• In this case the functions y = xr and y = xr lnx are both solutions to the original equation. The general solution is: )ln()( 21 xccxxy r

x.xcxcy(x)

.rr)r(r-

yxyyx

ln

401671

:isequation sticcharacteri the,016'7''

42

41

2

Example:

Page 35: Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.

Fin500J Topic 6Fall 2010 Olin Business School 35

• The characteristic equation has two complex roots r1,2 = λ±µi.

x))(μcx)(μ(cxy(x)

xixxxex

λ

xii

lnsinlncos

:be illsolution w general theroots,complex of case in the So,

)lnsin()lncos(

21

ln)(

.xxcxxcy(x)

i.rr)r(r-

yxyyx

)ln3sin()ln3cos(

310431

:isequation sticcharacteri the,04'3''

12

11

2,1

2

Example: