24
DIFFERENTIAL EQUATIONS GILBERT WEINSTEIN 1. Introduction 1.1. What is a differential equation? It is an equation for one or more unknown functions involving derivatives of these unknowns, e.g., (1) y 00 + xy +3y 2 = e x ; (2) u 0 + u = cos(t); (3) u xx + u yy = 0; (4) x 0 = y, y 0 = -x. If the unknowns are functions of only one independent variable, such as in (1), (2), and (4), we call the equation ordinary, otherwise, as in (3), we call the equation a partial differential equation. 1.2. Dynamics. F = ma. If x = x(t) is the position of the particle at time t, then this equation reads x 00 = F/m. If also we are given a law for the force F = F (x, t), then this gives a differential equation: x 00 = F (x, t)/m, e.g., in a constant gravitational field we have F = -mg. If x = x(t) is a vector in 3-space, and the force is also a vector F = F(x,t), then we have a system of 3 equations in 3 unknowns written as: x 00 = 1 m F(x,t). In the central force problem we assume that F = f (|x|)x. For the central force problem in celestial mechanics, we assume f (|x|)= -|x| -3 , and we get the equations: x 00 = - x |x| 3 . This equation governs the motion of the planets around the sun in the first approximation. Suppose that the motion is radial, i.e., along a line from the center, then we get: r 00 = - 1 r 2 , where r = |x|. 1.3. Heat Diffusion. Let D be a domain in 3-space, say a gas vessel, and let u be temperature in D, then, we have: u t = u xx + u yy + u zz . If the temperature is in steady state then u t = 0, and we get u xx + u yy + u zz =0. These are partial differential equations for u. 1

Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS

GILBERT WEINSTEIN

1. Introduction

1.1. What is a differential equation? It is an equation for one or more unknown functionsinvolving derivatives of these unknowns, e.g.,

(1) y′′ + xy + 3y2 = ex;(2) u′ + u = cos(t);(3) uxx + uyy = 0;(4) x′ = y, y′ = −x.

If the unknowns are functions of only one independent variable, such as in (1), (2), and (4), we callthe equation ordinary, otherwise, as in (3), we call the equation a partial differential equation.

1.2. Dynamics. F = ma. If x = x(t) is the position of the particle at time t, then this equationreads x′′ = F/m. If also we are given a law for the force F = F (x, t), then this gives a differentialequation: x′′ = F (x, t)/m, e.g., in a constant gravitational field we have F = −mg. If x = x(t) is avector in 3-space, and the force is also a vector F = F(x, t), then we have a system of 3 equationsin 3 unknowns written as:

x′′ =1m

F(x, t).

In the central force problem we assume that F = f(|x|)x. For the central force problem in celestialmechanics, we assume f(|x|) = − |x|−3, and we get the equations:

x′′ = − x

|x|3.

This equation governs the motion of the planets around the sun in the first approximation. Supposethat the motion is radial, i.e., along a line from the center, then we get:

r′′ = − 1r2,

where r = |x|.

1.3. Heat Diffusion. Let D be a domain in 3-space, say a gas vessel, and let u be temperaturein D, then, we have:

ut = uxx + uyy + uzz.

If the temperature is in steady state then ut = 0, and we get

uxx + uyy + uzz = 0.

These are partial differential equations for u.1

Page 2: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

2 GILBERT WEINSTEIN

1.4. Calculus of Variations. Many differential equations in physics and engineering are derivedfrom a variational principle: the condition that some integral quantity is at a minimum. As anexample, we will consider Plateau’s problem: finding a surface of least area spanning a givencontour. Plateau was a 19th century physicists who experimented with soap films. If one dips acontour made of wire into a soap solution, the surface tension will cause a soap film with leastsurface area to span the contour when the wire is emerged. Consider the simple special case: whenthe contour consists of two parallel congruent rings of radius 1 a distance 2l apart. Assume thatthe surface has the same symmetry as the contour, hence is a surface of revolution. The surfacecan then be described by its generating curve y = y(x). It is convenient to scale the parameters xand y so that the rings are at the location x = −1 and x = 1. The radius of the rings is then 1/l.

The surface area of the surface of revolution is given by:

A(y) = 2πl2∫ 1

−1y

√1 + (y′)2dx.

Consider a one-parameter family y(x) + tz(x), where z(x) is a variation, an arbitrary continuouslydifferentiable function. If y has least A, then A(y + tz), considered as a function of t, will havea minimum when t = 0. Differentiate A(y + tz) with respect to t, and set t = 0 to obtain thedirectional derivative of A at y in the direction of the variation z:

d

dt(A(y + tz)) |t=0 =

∫ 1

−1(zF1 + z′F2)dx,

where F1 and F2 are expression involving only y and y′. Integrate the second term by parts. Thereare no boundary terms since z vanishes at the end points; indeed, z(1) = z(−1) = 0 if all themembers of the family y + tz are to satisfy the boundary conditions at x = 1 and x = −1. Weobtain:

d

dt(A(y + tz)) |t=0 =

∫ 1

−1z(F1 + F ′2)dx =

∫ 1

−1zF dx,

where F involves only y, y′, and y′′. Since this is to vanish for all variations z, it follows that F = 0.This gives the following differential equation for y:

yy′′ − (y′)2 − 1 = 0.

This differential equation is a necessary condition for y to have least A.

The order of an equation is the highest derivative which appears in the equation, e.g.,

(1) y′′ + y = 0 is a second order equation;(2) y′ = y2 is a first order equation.

A solution of a differential equation is any function which satisfies the equation, e.g.,

(1) y = cos(x), is a solution of y′′ + y = 0;(2) For any constant c, y = 2 + ce−x is a solution of y′ + y = 2;(3) For any constant a, y = cosh(ax)/a is a solution yy′′ − (y′)2 − 1 = 0.

The general solution of a differential equation is a solution written in terms of a number of arbitraryconstants such that every solution of the equation can be obtained by setting the constant to somevalue,

(1) y = cos(x) is not the general solution of y′′ + y = 0; y = sin(x) is another solution;(2) y = 2 + ce−x is the general solution of y′ + y = 2;(3) y = cosh(ax)/a is not the general solution of yy′′ − (y′)2 − 1 = 0; y = cosh(ax+ b)/a is the

general solution;

Page 3: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 3

Sometimes a solution cannot be written explicitly, but may be given implicitly as the solution ofan (algebraic) equation, e.g.,

(1) y2 + x2 = 1 defines implicitly a (actually two) solutions of yy′ = −x;(2) ey + xy = c defines implicitly a solution of (ey + x)y′ + y = 0.

The graph of a solution is called an integral curve of the equation. The set of integral curves isoften more important than any single solution. For “regular” equations of the form y′ = f(x, y),where f is “nice”, integral curves cannot cross, e.g.,

(1) The set of curves y + ce−x for various values of c, are the integral curves of the equationy′ + y = 2;

(2) The set of curves

y = ex2/2

(∫ x

02es

2/2 ds+ c

),

are the integral curves of y′ + xy = 2.

The general solution of an equation of first order always contains one arbitrary constant. Thisis often determined by initial conditions, e.g.,

(1) The problem y′ + y = 2, y(0) = 4, has the unique solution y = 2 + 2e−x;(2) The problem y′ + xy = 2 has the unique solution:

y = ex2/2

(∫ x

02es

2/2 ds+ 1).

The general solution of a second order equation contains two arbitrary constants. To determinethe solution uniquely, two initial conditions must be given, e.g., r′′ = −r−2, r(0) = r0, r′(0) = v0.Sometimes boundary conditions are given instead of initial conditions, e.g., yy′′ − (y′)2 − 1 = 0,y(1) = y(−1)1/l.

A concept which is sometimes useful to obtain a rough idea about the geometry of the integralcurves is the direction field. For an equation in the form y′ = f(x, y), the right hand side gives theslope of the integral curve at the point (x, y) in the plane. The line through (x, y) with slope f(x, y)is called a lineal element for the equation. By drawing a dense collection of those lineal elements,one may obtain some qualitative notion on the shape of the integral curves. Caution: Althoughthe direction fields of the equations y′ = y, and y′ = y2 are relatively similar, their integral curvesdiffer a great deal!

Page 4: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

4 GILBERT WEINSTEIN

2. Separable Equations

An ordinary differential equation is separable if it can be written as y′ = A(x)B(y). We separatethe variables:

dy

B(y)= A(x) dx,

and integrate to get an implicit solution.

(1) y′ = y2e−x. Assuming y 6= 0, we have y−2 dy = e−xdx, which after integration leads toy = 1/(e−x−c). Since y = 0 is a solution which is not included (cannot be obtain by settingany value for c), this is not the general solution.

(2) x2y′ = 1 + y. Assuming x 6= 0, and y 6= 0, we get y = −1 + ke−1/x. Note that y = 0 is asolution obtain by setting k = 0. Draw a few integral curves.

2.1. Carbon Dating. Radioactive decay is governed by the law: m′ = km. This is a separableequation with the general solution: y = Aekt. Note that A = y(0) is the initial mass. Note also thatit takes a fixed time for any amount of radioactive material to decay to half its size. This time periodis called the half-life of the radioactive material, e.g.,, the C-14 isotope of carbon has a half- life of5570 years. We have M/2 = y(H) = MekH , hence k = −H−1 ln 2, i.e., y = M exp(−tH−1 ln 2). C-14 is produced by γ-rays in the upper parts of the atmosphere, and absorbed into living organisms.During the organism’s life, the concentration of C-14 is in equilibrium. Once an organism dies, itdoes not absorb C-14 from the atmosphere anymore, and the isotope starts to decay. The amountof C-14 in a sample can be measured by counting β-emissions, e.g., C-14 has an emission of 15 pergram per minute. Suppose, an ancient dead wood sample is emitting 5 β-particles a minute, whilea comparable living wood sample would contain 2 grams of C-14. Then M = 2, H = 5570, andm = 1/3. We have to determine t. We get the equation 1/3 = 2 exp(−t ln(2)/5570) which givest = 5570 ln(6)/ ln(2) ≈ 14, 000 years.

2.2. Drainage. Two laws govern drainage:

(1) dV/dt = −kAv, where V is the volume of the fluid in the tank, A is the cross-sectionalarea of the drain-hole, v is the velocity of the fluid leaving the tank through the drain, and0 < k < 1 is an efficiency constant.

(2) Toricelli’s Law states that v is the velocity of a freely-falling particle released from a heightequal to the height of the fluid above the drain hole: v =

√2gh, where g is the gravitational

acceleration.

Put together, these two laws give:dV

dt= −kA

√2gh.

To obtain a differential equation one must express V and h in terms of one variable. This stepdepends on the shape of the tank.

Consider for example, a hemi-spherical tank of radius R. By slicing, we have that V (h) =∫ h0 πr

2 dh = π∫ h0 (2Rt− t2) dt, hence dV/dt = π(2Rh− h2)dh/dt. Thus, we obtain the differential

equation:π(2Rh− h2)h′ = −kA

√2gh,

which is separable, and integrates to:

43Rh3/2 − 2

5h5/2 = −kAt

π

√2g + C,

Page 5: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 5

where C is a constant of integration. If R = 18 feet, the radius of the hole is 3 inches, and k = 0.8,we obtain: 60h3/2 − h5/2 = −t + k, and k is determined from the condition h(0) = 18. We findk = 2268

√2. The tank is empty when h = 0, i.e., when t = k = 2268

√2.

2.3. Escape Velocity. Suppose a projectile is fired from the surface of a ‘star’ of radius R, withinitial velocity v0. Determine the escape velocity, the least value of v0 necessary for the projectileto escape the gravitational field of the star.

We use the equation for radial motion in a gravitational field: r′′ = −GM/R2, where G isthe gravitational constant, and M is the mass of the star. The important observation here isthe independent variable t does not appear explicitly in the equation. As a consequence, we cantransform the equation into a separable first order equation for v = dr/dt as a function of r. Indeed,dv/dt = (dv/dr)(dr/dt) = v dv/dt. Thus, we obtain: v dv/dt = −GM/r2 which integrates to:

12v2 − GM

r= E.

This identity is called conservation of energy in physics. Now, note that the projectile escapes iffE > 0. (Draw the potential energy curve P = −GM/r). Thus, the condition for escape is:

v20 >

2GMR

.

Assuming that light was made of particles whose initial velocity was c, Laplace, in 1796, used thisargument to show that if a star is so dense that GM/Rc2 > 1, then no light can escape from thatstar. Although, the argument is wrong (why?), the condition 2GM/Rc2 > 1 is the correct one forthe formation of a black hole in general relativity!

To integrate the equation further, solve the conservation of energy for v = dr/dt, and separatevariables again, and integrate:

t− c = ±∫

dr√2E + 2GM/r

.

Page 6: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

6 GILBERT WEINSTEIN

3. Linear Equations, Exact Equations and Integrating Factors

3.1. Linear Equations. A first order linear differential equation is one that has the form: y′ +p(x)y = q(x). We treat the linear equation by the method of variation of parameters. In thismethod, we first consider the homogeneous case, in which q(x) = 0. In this case, the equationbecomes y′ = −p(x)y which is separable. The solution is y = k exp(−

∫p dx).

(1) y′ + y = 0; y = ke−x;(2) y′ + xy = 0; y = ke−x

2/2.

For the non-homogeneous case, replace the constant k by a function, and substitute back intothe equation to get k′, i.e., try y = k(x) exp(−

∫p dx). One gets k′ = q exp(

∫p dx), integrates

k =∫q exp(

∫p dx) dx+ c, and substitutes back into y.

(1) y′ + y = 2; trying y = k(x)e−x, we get k′ = 2ex, k = 2ex + c, and thus y = 2 + ce−x;(2) y′+xy = 2; trying y = k(x)e−x

2/2, we get k′ = 2ex2/2, and thus y = e−x

2/2(∫ x0 2es

2/2ds+c).

3.2. Exact Equation. Consider a differential equation written as: M(x, y) +N(x, y)y′ = 0. Thiscan always be done, e.g., if y′ = f(x, y), we take M = f , and N = −1. A potential function forthis differential equation is a function function ϕ(x, y) such that ϕx = M , and ϕy = N . If such afunction exists, we say that the equation is exact. In this case, then for any solution y = y(x), wehave that ϕ(x, y(x)) is constant. Indeed, differentiating implicity:

d

dx(ϕ(x, y(x))) = ϕx + ϕy

dy

dx= M +Ny′ = 0.

Thus, ϕ(x, y(x)) = c defines implicitly the general solution of the differential equation. For exampleϕ(x, y) = 2y2x+ exy + y2 is a potential function for the differential equation: 2y2 + yexy + (4xy +xexy + 2y)y′ = 0. The general solution of this differential equation is given by 2y2x+ exy + y2 = c.

Theorem 1. Suppose that M , N , My, and Nx are continuous for all (x, y) in a rectangle R. Thenthe differential equationM +Ny′ = 0 is exact if and only if My = Nx.

Indeed, if the equation is exact, then My = ϕxy = ϕyx = Nx. We illustrate the converse byexample: 3y4 − 1 + 12xy3y′ = 0. We have My = 12y3 = Nx. Integrate 3y4 − 1 with respectto x to get ϕ = (3y4 − 1)x + k(y). Then differentiate with respect to y and set equal to N :12y3x+ k′ = 12xy3. We get k′ = 0, hence k = 0, and a ϕ = (3y4 − 1)x.

3.3. Integrating factors. Although M +Ny′ = 0 is not exact, it is possible that µM +µNy′ = 0is exact for some µ 6= 0. Such a function is called an integrating factor. As before a condition forµ to be an integrating factor is (µM)y = (µN)x, i.e.,

µyM + µMy = µxN + µNx,

This is a linear partial differential equation for µ, which may be not be easier to tackle than theoriginal equation. For example, if it happens that (My − Nx)/N is independent of y, we maylook for µ = µ(x), by solving µx/µ = (My − Nx)/N . As an example, we consider the first orderlinear equation py − q + y′ = 0. We have M = py − q, and N = 1, hence (My − Nx)/N = p isindependent of y. Thus, an integrating factor is µ = exp(

∫p dx). Multiplying the equation by µ

we get: (µy)′ = µq, which can be integrated: y = µ−1(∫µq dx + c). Similarly, if (Nx −My)/M is

independent of x, then we may look for µ = µ(y) by solving µy/µ = (Nx −My)/M .

Otherwise, some other guess for µ may have to substituted. For example, consider the equation:x2y′ + xy + y−3/2 = 0. We have My = x − 3y−5/2/2, Nx = 2x, and clearly neither of the above

Page 7: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 7

works. We try an integrating factor of the form µ = xayb. We get:

(b− 3/2)xy−3/2 = (a− b+ 1)x2y,

which holds if and only if b = 3/2, a = 1/2. After multiplying by µ = x1/2y3/2, we get the equation:x5/2y3/2y′ + x3/2y5/2 − (3/2)x1/2 = 0, which integrates to: x5/2y5/2 − (5/2)x3/2 = c.

Page 8: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

8 GILBERT WEINSTEIN

4. Special Differential Equations and Applications

4.1. Homogeneous Equations. A differential equation is homogeneous if it can be written asy′ = f(y/x), e.g.,

(1) y′ = (x/y) sin(y/x);(2) y′ = y/(x+ y).

The change of variable u = y/x, y′ = u + xu′ transforms the homogeneous differential equationy′ = f(y/x) into xu′ = f(u)− u a separable differential equation, e.g.,

y′ =x

y+y

x,

leads to uu′ = 1/x, which integrates to u =√

2 lnx+ c, i.e., y = ±x√

2 lnx+ c.

4.2. A Pursuit Problem. A dog jumps into a canal of width w and swims with speed v directlyacross in a current of speed s. Pick coordinates in the plane so that the origin is the aim while(w, 0 is the starting point. Let x = x(t), y = y(t) be parametric equations for the dog’s path. Thenwe have x′ = −v cos(ϕ), y′ = s − v sin(ϕ), where ϕ is the polar angle of the dog’s position. Thus,we have

dy

dx=dy/dt

dx/dy=s− v sin(ϕ)v cos(ϕ)

= tan(ϕ)− s

v

1cos(ϕ)

.

Since tan(ϕ) = y/x, and 1/ cos(ϕ) = x−1√x2 + y2, we get the differential equation:

dy

dx=y

x− s

v

√1 +

y2

x2,

which is homogeneous. After integrating we get:

u+√

1 + u2 = cx−s/v.

The constant c is determined by the initial condition y(w) = 0: c = wx/v. Solve for u, andsubstitute y = xu to get:

y =w

2

[( xw

)1−s/v−( xw

)1+s/v].

4.3. Bernoulli Equation. A Bernoulli equation is an equation of the form y′ + p(x)y = r(x)yα,for some real number α. If α 6= 1, the substitution u = y1−α transforms the Bernoulli equationinto a linear equation, e.g., x3y′ = x2y − y3 is a Bernoulli equation with α = 3. Set u = y−2, toget: u′ + 2u/x = 2/x3, which integrates to x2u = 2 lnx + c. Substituting back u = y−2, we gety = ±x/

√2 lnx+ c.

4.4. Riccati Equation. A Riccati Equation is an equation of the form y′ = p(x)y2 + q(x)y+ r(x).If u(x) is a particular solution of this equation, the substitution y = u+1/z will yield a linear for z.Thus, the general solution can be found. y = x is a solution of y′ = xy2 − x3 + 1, hence substitutey = x+ 1/z to get z′ + 2x3z = −x. Integrating this linear differential equation we get:

z = e−2x3/3

(c−

∫ x

0se2s

3/3 ds

),

from which we conclude that the general solution of y′ = xy2 − x3 + 1 is

y = x+ e2x3/3

(c−

∫ x

0se2s

3/3 ds

)−1

.

Page 9: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 9

4.5. Mechanics. A 16-foot long chain weighing ρ pounds per foot hangs over a small pulley, 20feet above the ground. The chain is released with 7 feet on one side and 9 feet on the other. Howlone after the chain is released and with what velocity will the chain leave the pulley. Denote by x(t)the displacement from equilibrium. The net force on the chain is 2xρ, and its mass is 16ρ/32 = ρ/2.The equation of motion is: dv/dt = 4x. Since dv/dt = v dv/dx, we get v2 = 4x2 + E, where E isconstant. To determine E, set x = 1, and v = 0. Conclude E = −4. When x = 8, we get v =

√252.

To get the time required separate variables:

dt =dx

2√x2 − 1

,

and integrate:

t =∫ 8

1

dx

2√x2 − 1

=12

ln(8 +√

63).

Suppose instead that the chain is 40-foot long and begins to unwind when released with already10 feet played out. Determine the velocity when the chain leaves the support. Denote by x(t) thelength of the chain which has left the support. The equation of motion is: mdv/dt+ v dm/dt = F .We have F = xρ = mg, hence m = xρ/32, and dm/dt = ρv/32. As above dv/dt = v/, dv/dx, andthe equation is:

v′ +v

x= 32v−1,

a Bernoulli equation. Substitute v = w1/2 to get:

w′ +2wx

= 64,

which integrates to w = v2 = 64x/3 + c/x2. Set v = 0, x = 10, to get c = −64, 000/3, hence:v2 = (64/3)(x− 1000/x2). When x = 40, we have v2 = 840, i.e., v = 2

√210.

Friction is usually assumed to be proportional to v2. Thus, the equation of motion for free fallin a constant gravitational field with friction is: mdv/dt = mg−αv2. This is a separable equation:

dv

g − (α/m)v2= dt.

Integrate to get: √m

αgtanh−1

(√α

mgv

)= t+ c.

From the initial conditions v(0) = 0, we get c = 0. Solve for v to get:

v(t) =√mg

αtanh

(√αg

mt

).

We see that v →√mg/α, the terminal velocity, as t→∞.

4.6. Electrical Circuits. Kirchoff’s current law states that the sum of the currents entering anyjuncture in a circuit is equal to the sum of the currents leaving the juncture. Kirchoff’s voltagelaw states that the sum of the potential drops in a circuit is zero. Consider for example a circuitin which a battery, a resistor, and an inductor are placed in series. We get: E − iR − Li′ = 0.This is a linear equation for i whose general solution is: i = E/R + Ke−Rt/L. The constant K isdetermined by the initial conditions.

Consider next a circuit in which a battery, a switch, a resistor, and a capacitor are placedin series. Assume that initially, the switch is open, and the charge on the capacitor is zero. Ifq is the charge on the capacitor, we get: iR + q/C = E, where i = q′. Thus, the equation

Page 10: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

10 GILBERT WEINSTEIN

is: q′ + q/(RC) = E/R, whose general solution is: q = EC(1 − ke−t/RC). The constant k isdetermined from the initial condition q(0) = 0. Thus, k = 1, and the solution of the initial valueproblem is: q = EC(1 − e−t/RC). Note that the voltage q/C → E as t → ∞, hence in time anegligible amount of current flows in the circuit, and there is a negligible drop in voltage across theresistor. The current is given by i = q′ = Ee−t/RC/R.

4.7. Geometry. Consider the family of curves given by: y2 = kx3, for various values of k. Finda family of orthogonal trajectories. We first derive a differential equation for y. Differentiating,we get 2yy′ = 3kx2. We substitute k = y2/x3 in this equation to get: 2yy′ = 3y2/x, which canbe simplified into: y′ = 3y/2x. The orthogonal family has y′ = −3y/2x, which is separable andintegrates to: 3y2 + 2x2 = k2, a family of ellipses.

Page 11: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 11

5. Existence and Uniqueness

Consider the initial value problem: y′ = f(x, y), y(x0) = y0. This may not always be solvableexplicitly. Here, we discuss the solvability of this problem in principle. Note that there may be nosolutions, e.g., y′ = 2

√y, y(0) = −1. Furthermore, there may be more than one solutions, e.g.,

y′ = 2√y, y(1) = 0 has both the solutions y1 = 0, and y2 = 0 for x < 1, and y2 = (x−1)2 for x > 1.

The solution is not unique. In both of these case the function f(x, y) = 2√y was the problem. We

state the following existence and uniqueness theorem:

Theorem 2. Let f and fy be continuous in a rectangle R centered at (x0, y0). Then, there existsa positive number h such that the initial value problem:

y′ = f(x, y), y(x0) = y0,

has a unique solution in the interval |x− x0| < h.

Note that (0,−1) is not in any rectangle where f(x, y) = 2√y is defined, whence the first

initial value problem above has no solutions, and fy = 1/sqrty is not continuous in any rectanglecontaining the point (1, 0), whence the second initial value problem above has more than onesolution. We also note that the restriction to a small interval (x0 − h, x0 + h) is necessary. Indeed,consider the problem y′ = y2, y(0) = 1/a, for a > 0. All the conditions of the theorem are satisfied,and indeed there is a unique solution for any a given by: y = 1/(a − x). However, this solutionexists only on the interval x < a. The question of whether h can be made arbitrary large is referredto as the problem of global existence. One case in which this can be settled is the linear case:

Theorem 3. Let p and q be continuous on an open interval I, and let y0 be any real number. Thenthe initial value problem:

y′ + p(x)y = q(x), y(0) = y0,

has a unique solution defined in I.

Thus, in particular, if p and q are defined for all real x, also the solution exists for all x.

Another important problem in applications is the problem of continuous dependence on the initialdata. We need to know that if the data is varied a small amount, the solution only changes by acorrespondingly small amount. We will denote by y(x; a) the solution of the initial value problemy′ = f(x, y), y(x0) = a. We have the following theorem:

Theorem 4. Let f and fy be continuous on a rectangle R centered at the point (x0, y0). Supposethe solution y(x; y0) exists on an interval |x− x0| < h for some h > 0. Then there is a positivenumber k such that if |a− y0| < k, then y(x; a) also exists in that interval, and y(x; a) → y(x; y0)for all x in that interval.

We conclude this discussion by remarking that although all the statements here have been formu-lated for a single equation y′ = f(x, y), they apply equally well to systems y′ = F(x,y), y(0) = y0.

Page 12: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

12 GILBERT WEINSTEIN

6. Second Order Linear Equations

A second order linear equation has the form: y′′ + p(x)y′(x) + q(x)y = f(x). For example thecharge q in an RLC circuit satisties the equation q′′ + (R/L)q′ + (1/LC)q = E/L. As mentionedearlier, the initial data for second order equations consists of initial position and initial velocity.

Theorem 5. Let p, q, and f be continuous on an open interval I. Let x0 be a point in I, and leta, and b be real numbers. Then the initial value problem: y′′ + py′ + qy = f , y(x0) = a, y′(0) = bhas a unique solution defined for all x in I.

The existence of a local solution is obtained here, as for all second order equations, by trans-forming the problem into a first order system. This is done by introducing the variable z = y′.Thus, we can write the problem as a system:

y′ − z = 0, z′ + pz + qy = f, y(0) = a, z(0) = b.

The solution is now obtained by using the existence theorem for first order systems mentioned inthe last section. For a linear systems, one can also write the solution explicitly, which gives globalexistence.

6.1. The Homogeneous Case. We consider now the homogeneous case, i.e., f = 0. Note that inthis case if y1 and y2 are two solutions, then also any linear combination c1y1 + c2y2 is a solution.We say that two solutions y1, and y2 are linearly dependent on an open interval I if either is aconstant multiple of the other,e.g., 5 cos(x) and cos(x) are linearly dependent. Otherwise, we saythat the solutions are linearly independent. In this case, we say that they form a fundamental setof solutions, e.g., cos(t) and sin(t) form a fundamental set of solutions of the equation y′′ + y = 0.We define the Wronskian by:

W (x) =∣∣∣∣y1(x) y2(x)y′1(x) y′2(x)

∣∣∣∣To test for linear independence, we have the following.

Theorem 6. Suppose that p, and q and continuous on I. Let y1 and y2 be solutions of the equationy′′ + py′ + qy = f . Then:

(1) Either W (x) = 0 for all x in I, or W (x) 6= 0 for any x in I.(2) y1, and y@ are linearly independent if and only if W (x) 6= 0 on I.

To see this, one first verifies that W ′ + pW = 0. Thus W = exp(−p dx) and (1) follows. To see(2), note that we may assume y2(x0) 6= 0 for some x0 in I, hence we may assume that y2(x) 6= 0on some interval J . Since (y1/y2)′ = W/y2

2, we see that y1/y2 = c in J . But then y1 and cy2 bothsatisfy the same initial value problem, and hence are equal. We can now write the general solutionof the equation as c1y1(x) + c2y2(x) where c1 and c2 are arbitrary constants.

Theorem 7. Let y1 and y2 form a fundamental set of solutions of the equation y′′+ py+ q = 0 onI. Then every solution on I is a linear combination of y1 and y2.

To see this, let ϕ be a solution, fix x0 in I, set a = ϕ(x0), b = ϕ′(x0), and consider the initialvalue problem:

y′′ + py′ + qy = f, y(0) = a, y′(0) = b.

Clearly, ϕ is a solution. We will show that there is a solution of this problem which is a linearcombination of y1 and y2. By the uniqueness theorem, this solution must equal ϕ. Write the initial

Page 13: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 13

conditions for c1y1 + c2y2 as:

y1(x0)c1 + y2(x0)c2 = a

y′1(x0)c1 + y′2(x0)c2 = b.

This system of two equations in two unknowns has a solution since W (x0) 6= 0.

6.2. The Non-Homogeneous Case. The general solution of the non-homogeneous equation isthe sum of the general solution of the homogeneous equation with any one particular solution ofthe non-homogeneous equation. For example, a particular solution of y′′ + y = 2 is y = 2. Thus,the general solution of the non-homogenous equation is y = c1 cos(t) + c2 sin(t) + 2. This followsfrom the following.

Theorem 8. Let ϕ, and ψ be solutions of the equation y′′ + py′ + q′ = f , then ϕ − ψ satisfy thehomogeneous equation y′′ + py′ + qy = 0.

6.3. Reduction of Order. If one knows a solution ϕ of the homogeneous equation y′′+py′+qy = 0,then one may find a linearly independent solution by subtituting y = uϕ in the equation. Thisgives a first order linear equation for u′. This can be shown in general, but we will first illustratethis principle by way of example. Consider the equation x2y′′−7xy+16y = 0. The function y = x4

satisfies the equation. We substitute y = ux4 in the equation to get xu′′ + u′ = 0. This can beintegrated to u′ = 1/x, hence u = ln(x). Thus, a fundamental set of solutions of the equation is x4

and x4 ln(x), and the general solutions is y = c1x2 ln(x) + c2x

4.

For the general case, suppose that u satisfies the equation y′′ + py′ + qy = 0. Substitute y = uvin this equation, and use the fact that u′′ + pu′ + qu = 0, to get 2u′v′ + uv′′ + puv′ = 0. Substitutew = v′ to get a first order homogeneous linear equation uw′ + (pu + 2u′)w = 0 for w. If c1w isthe general solution of this equation with c1 an arbitrary constant, then the general solution of theoriginal equation y′′ + py′ + qy = 0 is y = c1uv + c2u, where v =

∫w dx is the indefinite integral of

w. Indeed, y1 = uv, and y2 = u form a fundamental set of solutions. The Wronskian is −u2v′.

Page 14: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

14 GILBERT WEINSTEIN

7. Constant Coefficients Linear Equations

7.1. Homogeneous Equations. A linear second order homogeneous equation with constant co-efficients has the form y′′ − 2by′ + cy = 0, where b and c are constants. We substitute y = eλx toget eλx(λ2 − 2bλ + c) = 0. Since eλx is never zero, we must have λ2 − 2bλ + c = 0. This equationis called the characteristic equation. We distinguish three cases:

(1) b2 > c; the characteristic equation has two distinct real roots: λ1,2 = b ±√b2 − c. In

this case the two solutions y1 = eλ1x and y2 = eλ2x are linearly independent; W (x) =(λ2 − λ1)e(λ1+λ2)x. For example, the equation y′′ − y′ − 2 = 0 has characteristic equationλ2 − λ− 2 = 0 with real roots −1 and 2, hence the general solution is y = c1e

−x + c2e2x.

(2) b2 = c; the characteristic equation has exactly one root λ = b. In this case, y1 = ebx isone solution, and using reduction of order, another solution is found y2 = xebx. Thesetwo solutions are linearly independent; W (x) = e2bx. For example, the general solution ofy′′ + 2y′ + 1 = 0 is y = c1e

−x + c2xe−x.

(3) b2 < c; the charateristic equation has complex roots b±iq, where q =√c− b2. Using Euler’s

formula eit = cos(t)+ i sin(t), and taking the sum and the difference of e(b+iq)x and e(b−iq)x,we obtain two linearly independent real solutions y1 = ebx cos(qx) and y2 = ebx sin(px);W (x) = qe2bx. For example, the equation y′′ + y has characteristic equation λ2 + 1 = 0,with roots ±i. The general solution is y = c1 cos(x) + c2 sin(x).

Note that Euler’s formula can be justified using power series: substitute x = it in the Taylorexpansion of ex =

∑∞n=0 x

n/n!, use i2 = −1, i3 = −i, i4 = 1, and separate real and imaginary partsto get

eit =∞∑n=0

(−1)nx2n

(2n)!+ i

∞∑n=0

(−1)nx2n+1

(2n+ 1)!= cos(t) + i sin(t).

7.2. Euler Equations. An Euler equation is one of the form x2y′′ + Bxy′ + Cy = 0. The trans-formation x = et transforms the equation into y + (B − 1)y + Cy = 0, where the dot denotesdifferentiation with respect to t. This equation can be solved using the methods of the last para-graph, upon which substitution of t = ln(x) yields the solution of the original equation. Considerfor example, the equation x2y′′ + 6xy′ + 6y = 0. Subtituting x = et, we get y + 5y + 6y = 0 whichhas the characteristic equation λ2 + 5λ+ 6 = (λ+ 3)(λ+ 2) = 0, with real roots −3, and −2. Thegeneral solution is y = c1e

−3t + c2e−2t. Substituting back x = et, we get y = c1x

−3 + c2x−2.

7.3. Undetermined coefficients. This method applies to the non-homogeneous second-orderconstant coefficients equation y′′ − 2by′ + cy = f(x), where f(x) is a simple function. We willillustrate with a number of examples:

(1) If f(x) = pn(x) is a polynomial of degree n, substitute y = xαqn(x), where qn is a polynomialof the same degree, and α is such that no term in xαqn(x) is a solution of the homogeneousequation. Consider, for example, y′′ − y′ − 6y = x − 1. Substitute y(x) = ax + b andsolve for a and b. We get −a − 6b = −1, and −6a = 1, from which we conclude thata = −1/6, b = 7/36. Thus, y(x) = −x/6 + 7/36 is a solution, and the general solution isy(x) = c1e

−2x + c2e3x − x/6 + 7/36.

(2) Similarly, if f(x) = pn(x)eβx, we substitute y = xαqn(x)eβx, with α as before. Consider,for example, y′′ − 2y′ + 1 = ex. Since ex, and xex both are solution of the homogeneousequation, we substitute y = ax2ex. We get a = 1/2, hence y(x) = 1

2x2ex is a solution, and

the general solution is y = c1ex + c2xe

x + 12x

2ex.

Page 15: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 15

(3) If f(x) = pn(x) cos(βx), or if f(x) = pn(x) sin(βx), we substitute

y = xα[qn(x) cos(βx) + rn(x) sin(βx)

],

with α as before, and rn another polynomial of degree n.(4) If f(x) = pn(x)eβx cos(γx), or if f(x) = pn(x)eβx sin(γx), we substitute

y = xαeβx[qn(x) cos(γx) + rn(x) sin(γx)

],

with α, and rn as before.

There is one more principle: if f(x) = f1(x) + f2(x) + · · · + fn(x), we may separately look forsolutions y1(x), y2(x), . . . , yn(x), corresponding to f1(x), f2(x), . . . , fn(x), and add these together.Consider, for example, y′′−y′ = 1+cos(x), which we break down into the two problems y′′1−y′1 = 1,and y′′2 − y′2 = ex. Since y1 = a is a solution of the first problem, we try y1 = ax. We find thata = −1, i.e., y1 = −x is a solution. For the second problem, we try y2 = a cos(x) + b sin(x),and find that −1

2 cos(x) − 12 sin(x) is a solution. Thus, a solution of the original problem will be:

y(x) = −x−12 cos(x)−1

2 sin(x), and the general solution will be y = c1x+c2ex−x−12 cos(x)−1

2 sin(x).

Page 16: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

16 GILBERT WEINSTEIN

8. Application to Oscillations

8.1. Models. We will consider three examples:

(1) Consider a spring hanging from a ceiling with a mass m attached to its free end. Hooke’sLaw states that if the displacement of the spring is x, then the restorative force on the springis −kx where k is a constant depending only on the spring. Assuming a linear dampingeffect, we have a damping force of −cx proportional to the velocity, where c is a positiveconstant. Assuming an external force f(t) acting on the mass, then Newton’s second lawof motion implies the equation:

mx+ cx+ kx = f(t),

for the displacement.(2) Consider an RLC electrical circuit, with a variable electromotive force E(t). Kirchoff’s

voltage law yields: E(t) = Ldi/dt+Ri+ q/C. Substituting i = dq/dt, we get the equation:

Lq +Rq +1Cq = E(t),

for the charge.(3) Consider a string of length l, fixed at its endpoints, undergoing vibrations. Assuming the

vibrations are small compared to l, and ignoring damping and other effects, the displacementu(x, t) satisfies the following partial differential equation and boundary conditions:

utt − a2uxx = 0; u(0, t) = u(l, t) = 0.

Here a is a constant depending on the tension and constitution of the string. Looking forsolutions of the special form u(x, t) = y(x)ϕ(t), we obtain the following:

utt − a2uxxa2u

a2ϕ− y′′

y= 0.

Since ϕ/ϕ is a function of t, and y′′/y is a function of x, both must be equal to the sameconstant µ. Thus, we get the following two ordinary differential equations:

y′′ − µy = 0, ϕ− a2µϕ = 0.

In addition y must satisfy the boundary conditions y(0) = y(l) = 0. This restrictsthe possible values for µ. If µ is positive, say µ = λ2, then the general solution isy = c1 cosh(λx) + c2 sinh(λx) which does not satisfy the boundary conditions. Indeed,y(0) = 0 implies that c2 = 0, and then y(l) = 0 is impossible. If µ = 0, then the generalsolution is y = c1 + c2x, which again is impossible. If µ is negative, say µ = −λ2, then thegeneral solution is y = c1 cos(λx) + c2 sin(λx). This will satisfy the boundary conditions ifc1 = 0, and λl = kπ for some positive integer k. Thus, the only allowable values of λ areλ = kπ/l; these are the modes of the string. Note that in each mode, the string vibratesaccording to the equation:

ϕ− ω2kϕ = 0,

where ωk = akπ/l. These are the natural frequencies of the string. The base tone corre-sponds to the lowest natural frequency ω1 = aπ/l; the overtones correspond to all the otherfrequencies. Foe example, if the base tone is pitch C, the first overtone is one octave higherwith twice the frequency. The next overtone is an octave and a fifth higher, pitch G, withthree times the frequency. This is also the first overtone of the G one octave lower with 3/2the frequency of the original C. This creates a problem in fixed tuned instruments, such asthe piano. Indeed, seven octaves correspond to twelve fifth. Thus, with exact tuning, one

Page 17: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 17

would require 27 = (3/2)12, which is not true (about 1.5% off)! The solution: temperedtuning where a small compromise is spread throughout the keyboard.

8.2. Free Motion. Without the forcing term, the equation is:

x+c

mx+

k

mx = 0.

The roots of the characteristic equation are:

λ =1

2m(−c±

√c2 − 4km).

There are three cases:

(1) Overdamping: c2 > 4km. The characteristic equation has two distinct real roots:

λ1 =1

2m(−c+

√c2 − 4km), λ2 =

12m

(−c−√c2 − 4km).

Both are negative, since√c2 − 4km < c, and it is possible to show that, regardless of the

initial conditions, the solution:

x = c1eλ1t + c2e

λ2t,

has at most one oscillation, i.e., x has at most one zero.(2) Critical damping: c2 = 4km. In this case, the general solution is:

x = (c1 + c2t)e−ct/2m.

and again, the solution has at most one oscillation.(3) Underdamping: c2 < 4km. The general solution is now:

x = e−ct/2m[c1 cos(ωt) + c2 sin(ωt)

],

where ω =√

4km− c2/2m. Now there are infinitely many oscillations, i.e., x has infinitelymany zeros.

Note that in all three cases x→ 0 as t→∞.

8.3. Forced Motion. We will only consider a periodic external force: f(t) = A cos(ωt), where Ais the amplitude, and ω the frequency of the force. The equation is:

x+c

mx+

k

mx =

A

mcos(ωt).

Using undetermined coefficients, we substitute x = a cos(ωt) + b sin(ωt) in the equation to get:

(−maω2 + bωc+ ak −A) cos(ωt) = (mbω2 + aωc− bk) sin(ωt).

Since this must hold for all t, and since the functions sin(ωt) and cos(ωt) are linearly independent,we get:

(k −mω2)a+ ωcb = A, −ωca+ (k −mω2)b = 0.

Solving for a and b, we get:

a =mA(ω2

0 − ω2)m2(ω2

0 − ω2)2 + ω2c2, b =

Aωc

m2(ω20 − ω2)2 + ω2c2

,

where ω0 =√k/m. As before, we have overdamped, critically damped, or underdamped forced

motion. We will only consider two specific examples:

Page 18: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

18 GILBERT WEINSTEIN

(1) Overdamped motion: Consider the initial value problem: x + 6x + 5x = cos(t), x(0) = 0,x(0) = 0. The solution is:

x =5

104e−5t − 1

8e−t +

113

cos(t) +326

sin(t).

Note that the only oscillatory motion, and also the only motion remaining in the long run,is the one driven by force.

(2) Underdamped motion: Consider the initial value problem: x+ 2x+ 2x = cos(2t), x(0) = 0,x(0) = 0. The solution is:

x = e−t(

110

cos(t)− 310

sin(t))− 1

10cos(2t) +

15

sin(2t).

Again, in the long run the only motion is the one driven by the force. However, for a while,the natural oscillations, with period 1, are excited by the driving force.

8.4. Resonance. Consider an undamped oscillator with the natural frequency equal to the inputfrequency:

x+ ω20x = A cos(ω0t).

The general solution is:

x = c1 cos(ω0t) + c2 sin(ω0t) +A

2ω0t sin(ω0t).

With the initial conditions x(0) = 0, x(0) = 0, the solution is:

x =A

2ω0t sin(ω0t).

Note that the amplitude of the oscillations increase without bound.

8.5. Amplitude Modulation. Consider an undamped oscillator with the natural frequency veryclose to the input frequency:

x+ ω20x = A cos(ωt),

where ω − ω0 is very small (compared to ω0). The general solution is:

x = c1 cos(ω0t) + c2 sin(ω0t) +A

ω20 − ω2

cos(ωt).

With the initial conditions x(0) = 0, x(0) = 0, the solution is:

x =A

ω20 − ω2

(cos(ωt)− cos(ω0t)

).

This can be rewritten as:

x =2A

ω20 − ω2

sin((ω0 + ω)t/2

)sin((ω0 − ω)t/2

).

This can be viewed as an oscillation with a frequency (ω0 + ω)/2), the average of ω0 and ω, andvarying, or modulated, amplitude. The amplitude oscillates with frequency (ω0 − ω)/2, a muchlower frequency. This is used by piano tuners, to fine tune strings slightly off exact tuning. Twopitches very close together will exhibit a so-called beat whose frequency the tuner is able to count.

Page 19: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 19

9. Variation of Parameters

We now return to the general non-homogeneous problem: y′′ + p(x)y′ + q(x)y = f(x). Weassume that a fundamental system of solutions y1, y2 of the homogeneous equation has alreadybeen found. The method of variation of parameters, will enable us to find a particular solution ofthe non-homogeneous equation. We look for a solution of the form y = uy1 + vy2, where u andv are functions satisfying u′y1 + v′y2 = 0. Differentiating twice, we obtain y′ = uy′1 + vy′2, andy′′ = u′y′1 + v′y′2 + uy′′1 + vy′′2 , which after substitution into the equation yields together with thecondition above, the system:

y1u′ + y2v

′ = 0

y′1u′ + y′2v

′ = f.

Since y1, and y2 are linearly independent, their Wronskian is non-zero, hence this system can besolved for u′ and v′.

9.1. Example. Find the general solution of y′′− 3y′+ 2y = cos (e−x). The characteristic equationis λ2 − 3λ + 2 = 0, with roots λ = 1, and λ = 2. Thus, two linearly independent solutions arey1 = ex, and y2 = e2x. Following the method above, we get:

exu′ + e2xv′ = 0

exu′ + 2e2xv′ = cos(e−x).

Solving these equations, we get: u′ = −e−x cos (e−x), v′ = e−2x cos (e−x). Integrating these, we get:u = sin (e−x), v = −e−x sin (e−x)− cos (e−x). Thus, a particular solution of the non-homogeneousequation is:

y = uex + ve2x = −e2x cos(e−x),

and the general solution is:y = c1e

x + c2e2x − e2x cos

(e−x).

Page 20: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

20 GILBERT WEINSTEIN

10. Green Functions

10.1. Initial Value Problem Green Function. Consider the initial value problem:

(1) y′′ + p(x)y′ + q(x)y = f(x), , y(0) = 0, y′(0) = 0,

For simplicity, we took the initial values at x = 0, but the same works for any value x = x0. Wewill express the solution as an integral:

y(x) =∫ x

0G(x, s)f(s) ds.

The function G(x, s) is called a Green Function.

We will start from the assumption that we have solved the homogeneous problem (1), i.e., wehave a fundamental system of solutions y1, y2 satisfying:

y1(0) = 1, y′1(0) = 0,(2)

y2(0) = 0, y′2(0) = 1.(3)

Note that given any fundamental system of solutions z1, z2, it is always possible to take linearcombinations of z1 and z2 satisfying these initial conditions. Note also that the Wronskian of y1, y2

is equal to 1 at x = 0, so that indeed y1, y2 are linearly independent.

Applying variation of parameters with the ansatz y = u1y1 +u2y2, gives the system of equations:

u′1y1 + u′2y2 = 0

u′1y′1 + u′2y

′2 = f.

Multliplying the first equation by y′2, the second by y2 and subtracting the second from the firstwe get Wu′1 = −y2f hence:

u1 = −∫y2f

Wdx.

Similarly:

u2 =∫y1f

Wds.

Note that these determine u1, u2 only up constants. We now use the initial conditions (2)–(3) tofix these constants. We have:

0 = y(0) = u1(0)y1(0) + u2(0)y2(0) = u1(0)

0 = y′(0) = u1(0)y′1(0) + u2(0)y′2(0) = u2(0).

Thus we conclude:

u1(x) = −∫ x

0

y2(s)f(s)W (s)

ds, u2(x) =∫ 2

0

y1(s)f(s)W (s)

ds.

Substituting these back into the function y:

y(x) = −y1(x)∫ x

0

y2(s)f(s)W (s)

ds+ y2(x)∫ x

0

y1(s)f(s)W (s)

ds

= −∫ x

0

y1(x)y2(s)f(s)W (s)

ds+∫ x

0

y2(x)y1(s)f(s)W (s)

ds

=∫ x

0G(x, s)f(s) ds.

Page 21: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 21

where the Green Function is:

G(x, s) =y1(s)y2(x)− y1(x)y2(s)

W (s).

Once we have the solution of the initial value problem (1), we can also solve any initial valueproblem:

(4) y′′ + p(x)y′ + q(x)y = f(x), y(0) = a, y′(0) = b,

using the fundamental system of solutions y1, y2 satisfying (2)–(3). The solution is given by:

y(x) =∫ x

0G(x, s)f(s) ds+ ay1(x) + by2(x).

We will present a simple example. Consider the initial value problem:

(5) y′′ − y = f(x), y(0) = a, y′(0) = b.

We already know a fundamental set of solutions is z1 = ex, y2 = e−x. To satisfy the additionalconditions in (1), we have to take the following linear combinations:

y1(x) = cosh(x) =ex + e−x

2, y2(x) = sinh(x) =

ex − e−x

2.

Note that W (x) = cosh2(x)− sinh2(x) = 1, so that:

G(x, s) = cosh(s) sinh(x)− cosh(x) sinh(s) = sinh(x− s).

Thus the solution of the initial value problem with forcing term f(x) can be expressed as

y(x) =∫ x

0sinh(x− s)f(s) ds+ a sinh(x) + b cosh(x).

It is straightforward to verify that this function satisfies (5). That can also be done in Maple.

11. Boundary Value Green Function

Consider now the boundary value problem:

(6) y′′ + p(x)y′ + q(x) = f(x), y(0) = 0, y(1) = 0.

As above, we could instead of the interval [0, 1] use any interval [a, b]. As before we will assumethat we have two solutions y1, y2 such that:

y1(0) = 1, y1(1) = 0,(7)

y2(0) = 0, y2(1) = 1.(8)

It is easy to check that y1 and y2 are then necessarily linearly independent. The solution is thesame as above, with the only difference being in the conditions imposed on u1 and u2. Indeed, wehave:

0 = y(0) = u1(0)y1(0) + u2(0)y2(0) = u1(0)

0 = y(1) = u1(1)y1(1) + u2(1)y2(1) = u2(1).

Thus:

u1(x) = −∫ x

0

y2(s)f(s)W (s)

ds, u2(x) = −∫ 1

x

y1(s)f(s)W (s)

ds.

Page 22: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

22 GILBERT WEINSTEIN

Substituting these back into the function y:

y(x) = −y1(x)∫ x

0

y2(s)f(s)W (s)

ds− y2(x)∫ 1

x

y1(s)f(s)W (s)

ds

= −∫ x

0

y1(x)y2(s)f(s)W (s)

ds+∫ 1

x

y2(x)y1(s)f(s)W (s)

ds

=∫ 1

0G(x, s)f(s) ds,

where:

G(x, s) =

−y1(x)y2(s)

W (s)0 6 s 6 x 6 1

−y2(x)y1(s)W (s)

0 6 x 6 s 6 1.

As above, we can now solve any boundary value problem:

(9) y′′ + p(x)y′ + q(x)y = f(x), y(0) = a, y(1) = b.

The solution is given by:

y(x) =∫ 1

0G(x, s)f(s) ds+ ay1(x) + by2(x).

Here too, we will present a simple example. Consider the boundary value problem:

(10) y′′ + y = 0, y(0) = a, y(π/2) = b.

We take y1 = cos(x), y2 = sin(x), and since W = 1, we find:

G(x, s) =

{− cos(x) sin(s) 0 6 s 6 x 6 1− cos(s) sin(x) 0 6 x 6 s 6 1.

For example, if f(x) = 1, then:∫ 1

0G(x, s) f(s) ds = −

∫ x

0cos(x) sin(s) ds−

∫ 1

xcos(s) sin(x) ds = 1− cos(x)− sin(x).

Thus, the solution of (10) is:

y(x) = 1 + (a− 1) cos(x) + (b− 1) sin(x).

It can easily be checked that this function solves (10).

Page 23: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

DIFFERENTIAL EQUATIONS 23

12. Numerical Methods

All the methods will be illustrated on the first order initial value problem:

y′ = f(x, y), y(0) = y0.

12.1. Euler’s Method: The idea is to approximate the values of f at x1 = x0 + h, x2 = x0 + 2h,. . . , xn = x0 + nh by using its first degree Taylor polynomial. Thus, y1 = y0 + y′(x0)(x1 − x0) =y0 + hf(x0, y0), y2 = y1 + hf(x1, y1), . . . , yn+1 = yn + hf(xn, yn). Consider, for example the initialvalue problem:

y′ = y sin(x); y(0) = 1.The solution is:

y = e1−cos(x).

We use Euler’s method to approximate the solution with three different step sizes h, and numberof iterations N : (i) h = 1/5, N = 20; (ii) h = 1/10, N = 40; (iii) h = 1/20, N = 80. Defining theglobal discretization error by:

E(h) = max16k6N

|yk − y(xk)| ,

we obtain in the cases above: (i) E(1/5) 6 1.75; (ii) E(1/10) 6 0.93; (iii) E(1/20) 6 0.48.

12.2. Error Analysis for Euler’s Method. We now show that if f and fy are continuous, andif the solution y has a continuous second order derivative y′′, then |E(h)| = O(h), i.e., E(h) 6 Chfor some constant C independent of h. Here, it is understood that the end points a = x0, andb = xN are fixed, and thus in particular, the size B = b− a of the interval is also fixed. We definethe local discretization error at x by:

L(x, h) =1h

[y(x+ h)− y(x)

]− f(x, y(x)).

Note that if yk = y(xk), theny(xk+1)− yk+1 = hL(xk, h).

Using a second order Taylor expansion, we obtain:

L(x, h) =12hy′′(ξ),

for some x0 < ξ < x0 + Nh. Since y′′ is continuous on the closed interval [x0, x0 + Nh], we mayassume that |y′′(ξ)| 6 M for some constant M , i.e., we conclude that

|L(x, h)| 6 12hM.

Define the local discretization error by:

L(h) = maxx06x6x0+Nh

|L(x, h)| .

We have just derived the bound:

L(h) 612hM.

Note that y(xk + h) = hL(xk + h) + hf(xk, y(xk)) + y(xk), hence

y(xk+1)− yk+1 = y(xk + h)− yk − hf(xk, yk)

= y(xk)− yk + hL(xk, h) + h[f(xk, y(xk))− f(xk, yk)

].

Since f and fy are continuous, we can use the mean value theorem to obtain that

|f(x, y(xk))− f(xk, yk)| = |fy(xk, η)(y(xk)− yk)| 6 R |y(xk)− yk| ,

Page 24: Introduction - profs.info.uaic.rofliacob/An2/2012-2013/Resurse/Privitoare la modelare prin...2 GILBERT WEINSTEIN 1.4. Calculus of Variations. Many di erential equations in physics

24 GILBERT WEINSTEIN

where η is between y(xk) and yk, and R > |fy|. Let ek = y(xk)− yk, then we have obtained:

|ek+1| 6 (1 + hR) |ek|+ hL(h) 6 C |ek|+K.

where C = 1 + hR, and K = Mh2/2. By iterating this inequality, we deduce:

|ek+1| 6 (1 + C + · · ·+ Ck−1)K 6 (1 + C + · · ·+ CN−1)K.

Note that N = B/h, hence:CN = (1 + hR)B/h → eRB,

and thus, there is a number P , independent of h, such that Ck 6 P for 1 6 k 6 N − 1. Weconclude:

|ek+1| 612NPMh2 =

12BPh.

Since this is true for all 0 6 k 6 N − 1, we finally have obtained:

E(h) 612BPMh.

12.3. Other One-Step Methods. The Second Order Taylor Method is similar to the EulerMethod, but uses the second, instead of the first, degree polynomial: y(x) ≈ y(x0) + y′(x0)(x −x0) + 1

2y′′(x0)(x − x0)2. The second derivative is computed using the equation y′ = f(x, y):

y′′ = fx + fyy′ = fx + fyf . Thus, we obtain:

yk+1 = yk + hf(xk, yk) +12h2[fx(xk, yk) + fy(xk, yk)f(xk, yk)

].

Rewrite the previous formula as:

yk+1 = yk + h

[f(xk, yk) +

h

2(fx(xk, yk) + f(xk, yk)fy(xk, yk)

)].

Note that f(xk, yk) + h2

(fx(xk, yk) + f(xk, yk)fy(xk, yk)

)is the first degree Taylor polynomial for

f(xk + h/2, yk + hfk/2) where fk = f(xk, yk). The Modified Euler Method uses this idea:

yk+1 = yk + hf

(xk +

h

2, yk +

hf(xk, yk)2

).

The RK4 Method elaborates on that idea:

yk+1 = yk +16h

[Wk1 + 2Wk2 + 2Wk3 +Wk4],

where

Wk1 = f(xk, yk),

Wk2 = f

(xk +

h

2, yk +

hWk1

2

),

Wk3 = f

(xk +

h

2, yk +

hWk2

2

),

Wk4 = f (xk + h, yk + hWk3) .

All three methods are one-step method, in the sense that yk+1 is computed using yk, and all aresecond order, in the sense that E(h) = O(h2).