13
Differential equations Chris Hooley, University of St Andrews first written 31st August 2006; last revised 20th September 2009 Contents 1 Introduction 1 2 What you absolutely need to know 2 3 Introduction to the theory 3 3.1 Terminology and general remarks ........................... 3 3.2 Finding a solution vs. checking a solution ...................... 5 4 First-order differential equations 6 4.1 Separation of variables ................................. 6 4.2 Left-hand side an exact derivative .......................... 7 4.3 Integrating factor method ............................... 7 5 Second-order differential equations 9 5.1 Constant coefficients and homogeneous ........................ 9 5.2 Constant coefficients but not homogeneous ..................... 10 5.3 Example ......................................... 11 6 Exercises 12 6.1 On the need-to-know material ............................. 12 6.2 More advanced ..................................... 13 1 Introduction These notes are designed to be brief but self-contained, and deal with differential equations at a fairly elementary level. They are aimed at second-year students who either have not seen this topic before, or who have seen it but need to brush up. They assume familiarity with basic differentiation and integration. The notes begin with a simple statement of the material you absolutely need to know; this is followed by a development of the theory, which you are encouraged (though not required) to study. If any questions arise, I can be contacted either during the scheduled drop-in sessions, by e-mail ([email protected]), or at my office (temporarily room 310; reverting to room 304 some time during the semester). 1

Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

  • Upload
    doandat

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

Differential equations

Chris Hooley, University of St Andrews

first written 31st August 2006; last revised 20th September 2009

Contents

1 Introduction 1

2 What you absolutely need to know 2

3 Introduction to the theory 33.1 Terminology and general remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.2 Finding a solution vs. checking a solution . . . . . . . . . . . . . . . . . . . . . . 5

4 First-order differential equations 64.1 Separation of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64.2 Left-hand side an exact derivative . . . . . . . . . . . . . . . . . . . . . . . . . . 74.3 Integrating factor method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5 Second-order differential equations 95.1 Constant coefficients and homogeneous . . . . . . . . . . . . . . . . . . . . . . . . 95.2 Constant coefficients but not homogeneous . . . . . . . . . . . . . . . . . . . . . 105.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

6 Exercises 126.1 On the need-to-know material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126.2 More advanced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1 Introduction

These notes are designed to be brief but self-contained, and deal with differential equations ata fairly elementary level. They are aimed at second-year students who either have not seenthis topic before, or who have seen it but need to brush up. They assume familiarity withbasic differentiation and integration. The notes begin with a simple statement of the materialyou absolutely need to know; this is followed by a development of the theory, which you areencouraged (though not required) to study. If any questions arise, I can be contacted eitherduring the scheduled drop-in sessions, by e-mail ([email protected]), orat my office (temporarily room 310; reverting to room 304 some time during the semester).

1

Page 2: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

2 What you absolutely need to know

There are three basic types of differential equation that come up in second year. Each isgiven here, along with its general solution. They can be checked by substituting the solutionback into the equation if you so desire.

• First-order, exponential solution:

dy

dx= λy → y(x) = Aeλx, (1)

where A is an arbitrary constant to be fixed by boundary/initial conditions.

• Second-order, undamped oscillator:

d2x

dt2= −ω2x → x(t) = A cos(ωt) + B sin(ωt), (2)

where ω is the angular frequency of oscillation, and A and B are arbitrary constants tobe fixed by initial conditions.

• Second-order, damped oscillator:

md2x

dt2+ γ

dx

dt+ kx = 0 (3)

where m is the oscillator mass, γ the damping coefficient, and k the spring constant.There are three cases:

– Overdamped. This is when γ2 > 4km; the solution is then

x(t) = Aeα1t + Beα2t, (4)

where α1 and α2 are the solutions of the equation mα2 + γα + k = 0, and A andB are arbitrary constants.

– Critically damped. This is when γ2 = 4km; the solution is then

x(t) = (At + B) eαt, (5)

where α is the solution of the equation mα2 + γα + k = 0, and A and B arearbitrary constants.

– Underdamped. This is when γ2 < 4km; the solution is then

x(t) = (A cos(ωt) + B sin(ωt)) eΓt, (6)

where α = Γ± iω are the (complex) solutions of the equation mα2 + γα + k = 0,and A and B are arbitrary constants.

2

Page 3: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

3 Introduction to the theory

3.1 Terminology and general remarks

In the mathematics of physical problems, there are two types of variable: dependent andindependent. Roughly speaking, an independent variable is something we know already (likethe time), while a dependent variable is something we’re trying to find out (like the temperature).Solving a problem involves finding how the dependent variable changes as the independentvariable is varied — in this example, it would be finding the temperature as a function of thetime, T (t). If this solution were graphed, the dependent variable (temperature) would be on thevertical axis, and the independent variable (time) on the horizontal one.

A differential equation is an equation where the dependent variable sometimes or alwaysappears differentiated with respect to an independent variable. For example, in the equation

3x2 d2y

dx2− 6

dy

dx+ 7y = y4, (7)

the dependent variable is y, and the independent variable is x. As mentioned above, the aim isusually to solve for the dependent variable in terms of the independent one, i.e. for y(x).

The order of the differential equation means the highest derivative it contains; so (7) isa second-order differential equation. A differential equation is homogeneous if every termcontains the dependent variable to the power one; for example,

d2g

dt2− 5

dg

dt+ 7g = 0 (8)

andds

dp=

(p2 sin p

)s (9)

are homogeneous, whereas

zd2z

dy2− y2 dz

dy+ z = 0 (10)

and

3x2 d2y

dx2− 6

dy

dx+ 7y = 6 sin x (11)

are not1.Since a differential equation is eventually solved by integrating, the solution will contain

one or more arbitrary constants arising from the integration process. Strictly speaking, then, adifferential equation does not have a solution, but rather a family of solutions. To obtain aunique solution, extra information is required to fix the value(s) of the integration constant(s):this extra information takes the form of boundary conditions. For example, in the problemof the motion of a point particle, the boundary conditions might be its position and velocity att = 0. Since the general solution to an nth order differential equation has n arbitrary constants,it follows that if we can find a solution with n arbitrary constants, we need look no further.This observation is of great practical use, as we shall see in the following.

Finally, before we get stuck in to the details, let me draw your attention to Fig. 1, whichcontains a simple guide for how to solve a differential equation when it arrives in front of you.The details are all covered in the remaining part of these notes.

1The problem in (10) is the extra power of z in the first term; the problem in (11) is that there is no y in theterm on the right-hand side. Remember, it’s the dependent variable that determines whether the equation ishomogeneous; the number of powers of the independent variable is irrelevant.

3

Page 4: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

START

?

Is the equationfirst-order?

??

Is the equationseparable?

?

?

Separation ofvariables

Is the equationof the form

dydx + Py = Q?

?

-

Integratingfactor ’Phone a

friend

Is the left-handside of the formAy′′ + By′ + Cy?

?

?

Is the right-handside zero?

-

6

Exponentialsolution

Particularintegral

YES NO

YES

NO

YES

NO

NO

YES

YES

NO

Figure 1: A quick how-to-solve-a-differential-equation flow chart. Details for each box may befound in the text.

4

Page 5: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

3.2 Finding a solution vs. checking a solution

These notes show you how to find the general solution to a differential equation, provided thatit falls into one of several common classes. However, sometimes you don’t need to do anythingas general as that; often, it is sufficient to check that a certain function is a solution of theequation. This can be done by simply substituting the function into the equation and makingsure that the result is an identity.

For example, imagine that you were given the Schrodinger equation for the wave function ofthe electron in a hydrogen atom,

− ~2

2mr2

d

dr

(r2 dR

dr

)− e2

4πε0rR = ER, (12)

and asked to show that there is a solution of the form

R(r) = Ae−βr, (13)

where A and β are constants. All you have to do is to substitute (13) into (12) and show thatit works.

To do this, you need to work out the derivatives that appear on the left-hand side. The firstderivative is

dR

dr= −βAe−βr (14)

and hencer2 dR

dr= −βr2Ae−βr. (15)

The derivative of that with respect to r is

d

dr

(r2 dR

dr

)= −βA

d

dr

(r2e−βr

)(16)

= −βA(2re−βr − βr2e−βr

)(17)

=(−2βr + β2r2

)Ae−βr. (18)

Putting that into (12), we find2

− ~2

2mr2

(−2βr + β2r2

)Ae−βr − e2

4πε0rAe−βr ?= EAe−βr. (19)

Cancelling the common factor of Ae−βr leaves

~2β

mr− ~2β2

2m− e2

4πε0r

?= E. (20)

For this to be an identity, the first and third terms must cancel each other, so that

~2β

m=

e2

4πε0→ β =

me2

4πε0~2. (21)

2Notice the notation. It would be incorrect to say that the two sides are equal, since we don’t know yet whether(13) is really a solution. So we use a question mark above the equals sign to indicate that we’re in the process oftesting whether it’s true.

5

Page 6: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

Also, the second term on the left-hand side must equal the right-hand side, i.e.

E = −~2β2

2m. (22)

So we have shown that (13) is indeed a solution of (12), provided that β takes the value givenby (21), and E takes the value given by (22)3.

4 First-order differential equations

4.1 Separation of variables

If a first-order equation can be separated so that all of the terms involving the dependent variableare on one side and all the terms involving the independent variable are on the other, then itcan be integrated straightforwardly4. Take, for example, equation (9) above. Multiplying bothsides by dp and dividing both sides by s, we obtain

ds

s= p2 sin p dp. (23)

Taking the indefinite integral of both sides, we get

ln s + C =∫

p2 sin p dp, (24)

where C is a constant of integration. The remaining integral can be performed using integrationby parts:

ln s + C =∫

p2︸︷︷︸u

sin p︸︷︷︸v′

dp (25)

= −p2 cos p +∫

2p︸︷︷︸u

cos p︸︷︷︸v′

dp (26)

= −p2 cos p + 2p sin p−∫

2 sin p dp (27)

= −p2 cos p + 2p sin p + 2 cos p + D, (28)

where D is another integration constant. Actually, we could move C to the right-hand side andsubtract it from D, making a single integration constant F :

ln s =(2− p2

)cos p + 2p sin p + F ; (29)

finally, exponentiating both sides to undo the logarithm, we find

s = exp[(

2− p2)cos p + 2p sin p + F

]= G exp

[(2− p2

)cos p + 2p sin p

], (30)

where G = eF .3Incidentally, if you’d care to work out (22) numerically, you’ll find it’s the ground-state energy of the hydrogen

atom.4Well, there’s no guarantee that we will actually be able to do the integrals that we obtain, but that’s life.

I’ve chosen an example where we can.

6

Page 7: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

The remaining integration constant G would have to be fixed by the boundary conditionsof the problem. For example, we might know that s = 1 when p = 0; substituting these valuesinto (30), we obtain the equation

1 = G exp [2 cos 0] = Ge2, (31)

and hence the constant G is given byG = e−2, (32)

yielding the following specific solution for s(p):

s = exp[(

2− p2)cos p + 2p sin p− 2

]. (33)

4.2 Left-hand side an exact derivative

There is another class of first-order differential equation where exact solution is possible. Thisis the case in which the left-hand side is an exact derivative (sometimes in disguise).

As a starting example, consider the equation

xdy

dx+ y = ln x. (34)

It is not separable as (9) was; on the other hand, its left-hand side is really just the x-derivativeof the product xy:

d

dx(xy) = lnx. (35)

Thus we can integrate both sides with respect to x, obtaining

xy + C =∫

lnx dx. (36)

The integral on the right can be done by parts, taking the first ’part’ to be a 1 standing in frontof the lnx bit:

xy + C =∫

1︸︷︷︸v′

lnx︸︷︷︸u

dx (37)

= x lnx−∫

dx (38)

= x lnx− x + D, (39)

and hencey = ln x− 1 +

F

x, (40)

where F = D − C is the new integration constant as above. Again, in a practical problem Fwould be fixed by the boundary conditions.

4.3 Integrating factor method

But that solution relied on our noticing that the left-hand side of (34) was an exact derivative.What if we hadn’t noticed? Or worse, what if it hadn’t been an exact derivative at all?

7

Page 8: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

The answer is that we can always make the left-hand side an exact derivative, by multiplyingthe whole equation by a suitable function. This function is called the integrating factor. Toshow how this works, consider an equation of the form5

dy

dx+ Py = Q, (41)

where P and Q are both functions of x. To make this an exact derivative, we need only multiplythroughout by an integrating factor I, given by

I = exp(∫

P dx

); (42)

this has the useful property thatdI

dx= PI, (43)

as you should be able to show. Then the equation reads

Idy

dx+ PIy = QI, (44)

or, using (43),

Idy

dx+

dI

dxy = QI. (45)

The left-hand side of (45) is now just the exact derivative of Iy,

d

dx(Iy) = QI, (46)

so we can integrate both sides as in the previous case.As an example, let us solve the following equation:

cos3 tdy

dt+ cos t y = cos t. (47)

First we divide by cos3 t to get rid of the prefactor in the derivative term:

dy

dt+

y

cos2 t=

1cos2 t

. (48)

Now the integrating factor (according to (42)) is6

I = exp(∫

dt

cos2 t

)= exp

(∫sec2 t dt

)= etan t; (49)

multiplying the equation through by this, we obtain

etan t dy

dt+

etan t

cos2 ty =

etan t

cos2 t, (50)

5If there was a prefactor to the first derivative, we assume that the whole equation has been divided by itbefore we start.

6We don’t bother putting a constant of integration in when performing the integral, since it would correspondonly to multiplying the differential equation by a constant.

8

Page 9: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

and since the left-hand side is now an exact derivative this can be rewritten

d

dt

(etan ty

)=

etan t

cos2 t. (51)

Integrating both sides with respect to t yields

etan ty + C =∫

etan t

cos2 tdt; (52)

we can perform the integral on the right-hand side to obtain

etan ty + C = etan t + D, (53)

or, combining the integration constants,

etan ty = etan t + F → y = 1 + Fe− tan t. (54)

Again, the constant F would in practice be fixed by boundary conditions.

5 Second-order differential equations

5.1 Constant coefficients and homogeneous

Second-order differential equations are generally harder than first-order ones, and can be solvedonly in certain special cases. The first that we shall consider is where the equation is second-order and homogeneous, and all the coefficients are just constants. The general form of such anequation is

Ad2p

dz2+ B

dp

dz+ Cp = 0, (55)

where A, B, and C are constants. The standard approach to such equations is to try anexponential solution,

p = eαz. (56)

Substituting this into (55), we obtain(Aα2 + Bα + C

)eαz = 0. (57)

Now, since the exponential factor is never zero, this is a solution only if

Aα2 + Bα + C = 0. (58)

This is called the auxiliary equation. The solutions of this equation are the two roots of thequadratic; call them α+ and α−. They are given by the quadratic formula:

α± =−B ±

√B2 − 4AC

2A. (59)

There are three possible cases:

• B2 > 4AC → both roots real. In this case, the general solution is just an arbitrarysuperposition of the two permitted exponential forms:

p(z) = Feα−z + Geα+z. (60)

(Note that, since this has two arbitrary constants and the original equation (55) was ofsecond order, we know that it is the most general solution — see the comments above.)

9

Page 10: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

• B2 = 4AC → equal roots. (Call the single root in this case α.) This case is trickier, sincewe now seem to have only one solution, which doesn’t contain enough arbitrary constants.It is not hard to show, however, that in this special case the function zeαz is also a solution,and hence the general solution is

p(z) = Feαz + Gzeαz = (F + Gz)eαz. (61)

• B2 < 4AC → complex roots. In this case, the roots form a complex conjugate pair7:

α± = αR ± iαI with αR ≡ −B

2A, αI ≡

√4AC −B2

2A. (62)

The two ‘exponential’ solutions are therefore

p1(z) = eα+z = eαRzeiαIz = eαRz (cos αIz + i sinαIz) , (63)p2(z) = eα−z = eαRze−iαIz = eαRz (cos αIz − i sinαIz) . (64)

If we want real solutions8, we can add or subtract (64) from (63) to obtain

p3(z) = eαRz cos αIz, (65)p4(z) = eαRz sinαIz. (66)

The general solution is then made by superposing these:

p(z) = eαRz (F cos αIz + G sinαIz) . (67)

Since the equation (55) is Newton’s second law for a damped harmonic oscillator9, the threetypes of solution are often referred to as overdamped, critically damped, and underdampedrespectively. Note that it is only the underdamped solution that oscillates.

5.2 Constant coefficients but not homogeneous

A slightly more complicated case is where a ‘driving’ term — a function of the independentvariable only — is added to the right-hand side of (55), so that

Ad2y

dx2+ B

dy

dx+ Cy = f(x). (68)

The procedure for solving this equation is as follows:

• Define the corresponding homogeneous equation (CHE) as the one obtained by setting thedriving term to zero. Find the solution of this CHE, which is known as the homogeneoussolution: call it yH(x).

7The ‘R’ and ‘I’ stand for ‘real’ and ‘imaginary’ respectively.8As we often do — the dependent variable in the original equation usually represents a physical observable,

which must therefore be real.9This may be seen as follows. Consider a point particle of mass m, attached to the end of a spring with spring

constant k, and moving in a damping medium with damping coefficient γ. If x is the displacement of the particlefrom its equilibrium position, it experiences a force F = −γv − kx: the first term is the damping force, and thesecond is the force from the spring (Hooke’s Law). On the other hand, we know from Newton’s second law thatF = ma, and thus ma = −γv− kx or alternatively ma + γv + kx = 0. But v is the first time-derivative of x, anda is the second time-derivative of x, so that this may be rewritten mx + γx + kx = 0.

10

Page 11: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

• Find any solution — not necessarily a general one — of the full equation (68). This isknown as the particular integral: call it yP (x).

• The general solution of (68) is

y(x) = yH(x) + yP (x). (69)

This satisfies the inhomogeneous equation by virtue of yP (x), and is the general solutionbecause of the two integration constants contained in yH(x).

It is the middle step of these three — finding the particular integral — that is difficult, andthere is no general procedure to follow. Here we give a table of various things to try, dependingon the form of f(x) and the nature of the homogeneous solution yH(x):

f(x) Suggested yP (x)cos βx or sinβx (β 6= αI) c1 cos βx + c2 sinβxcos βx or sinβx (β = αI) (c1 cos βx + c2 sinβx)× quadratic polynomialpolynomial of degree n polynomial of degree n + 2eβx× polynomial of degree n eβx× polynomial of degree n + 2.

Take the suggested yP (x), substitute it into (68), and find the unique values of the coefficients(c1, c2, c3) that will make it a solution. Notice that, if the oscillating frequency of the drivingterm matches the natural frequency αI , special measures are required. Just remember: for theparticular integral, absolutely any function that satisfies (68) will do.

5.3 Example

For example, let us solve the second-order inhomogeneous equation

3d2s

dt2+ 4

ds

dt+ s = cos 2t. (70)

The first step is to find the homogeneous solution, sH(t), which satisfies the equation

3d2sH

dt2+ 4

dsH

dt+ sH = 0. (71)

The auxiliary equation is3α2 + 4α + 1 = 0; (72)

B2 > 4AC and hence we are in the overdamped case with two real roots:

α± =−4±

√16− 126

=−4± 2

6→ α+ = −1

3, α− = −1. (73)

The general solution is thus (copying the general solution for the overdamped case from above)

sH(t) = Fe−t/3 + Ge−t. (74)

The second step is to find a particular integral of (70). Following the advice in the tableabove, we try the form

sP (t) = c1 cos 2t + c2 sin 2t. (75)

11

Page 12: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

The first and second derivatives of this guess are:

s′P (t) = −2c1 sin 2t + 2c2 cos 2t; (76)s′′P (t) = −4c1 cos 2t− 4c2 sin 2t. (77)

Substituting these into (70), we find

3 (−4c1 cos 2t− 4c2 sin 2t) + 4 (−2c1 sin 2t + 2c2 cos 2t) + c1 cos 2t + c2 sin 2t = cos 2t; (78)

multiplying out and simplifying the terms on the left-hand side, we obtain

(−11c1 + 8c2) cos 2t + (−11c2 − 8c1) sin 2t = cos 2t. (79)

Comparing the coefficients on the left- and right-hand sides, we conclude that

−11c1 + 8c2 = 1; (80)−11c2 − 8c1 = 0. (81)

Equation (81) can be rearranged to read

c2 = − 811

c1; (82)

substituting this into (80), we obtain

−11c1 −6411

c1 = 1 (83)

∴ −121c1 − 64c1 = 11 (84)

∴ c1 = − 11185

. (85)

Putting this back into (82) gives

c2 =8

185, (86)

and hence the particular integral is

sP (t) =1

185(−11 cos 2t + 8 sin 2t) . (87)

Putting these together, we find that the general solution of (68) is

s(t) = sH(t) + sP (t) = Fe−t/3 + Ge−t︸ ︷︷ ︸transient

+1

185(−11 cos 2t + 8 sin 2t)︸ ︷︷ ︸

steady state

. (88)

Note that the part of the solution labelled ‘transient’ becomes smaller and smaller as t increases,leaving only the ‘steady state’ part.

12

Page 13: Differential equations - University of St Andrewsmd90/PH3066/Differential equation.pdf · Differential equations ... Solving a problem involves finding how the dependent variable

6 Exercises

6.1 On the need-to-know material

1. The number of radioactive atoms in a sample of uranium, N , obeys the following differentialequation:

dN

dt= −N

τ, (89)

where τ is a constant. Solve this equation to find N(t), given that there are N0 atoms attime t = 0.

2. The position x(t) of a damped harmonic oscillator is described by the equation

md2x

dt2+ γ

dx

dt+ kx = 0, (90)

where m, γ, and k are constants. The damping has been tuned so that γ =√

4km. Solvethis equation to find the motion of the oscillator, given that at time t = 0 it is releasedfrom rest a distance a from its equilibrium position.

3. Find the general solution of the equation

4d2f

dq2− 3

df

dq+ 2f = 0. (91)

6.2 More advanced

1. Find the general solution of the equation

t3dx

dt+ 3t2x = t2 ln t. (92)

2. Solve the equation

vdv

dx=

1cos2 x

, (93)

given that v = 0 when x = π4 . For what range of values of x is your solution for v real?

3. Solve the equation

2d2y

dt2+ 4

dy

dt+ 2y = e−2t, (94)

given that y and dydt are both zero when t = 0.

4. Find the general solution of the equation

d2z

dy2+

dz

dy+

132

z = cos(

52y

). (95)

13