2nd Order Linear Ordinary Differential Equations

Solutions for equations of the following general form: dy2 dy ++=ax12()axyhx () () dx2 dx

Reduction of Order

If terms are missing from the general second-order , it is sometimes possible to reduce the equation to a first-order ordinary differential equation. Second-order differential equations can be solved by reduction of order for two cases.

Dependent Variable (y) is Missing dy2 dy +=ax1()hx () dx2 dx The procedures is to define a new variable p as: dy = p dx which can be differentiated again with respect to x to give: dy2 dp = dx2 dx These are substituted into the differential equation to give: dp +=axphx() () dx 1 which can then be solved by integrating factors to give (see handout on solution methods for 1st order differential equations): 1 ⎡ ⎤ p =+⎢ hxFxdx() () I1 ⎥ Fx()⎣∫ ⎦

⎡ ⎤ where Fx()= exp ⎢ a1 () xdx⎥ ⎣∫ ⎦ The solution y is found by substituting for p = dy / dx and integrating again with respect to x.

1 ⎧⎫⎪⎪1 ⎡⎤ y =++⎨⎬⎢⎥hxFxdx() () I12 dx I ⎪⎪Fx()⎣⎦ ∫∫⎩⎭ ⎡⎤ where Fx()= exp ⎢⎥ a1 () xdx ⎣⎦∫

where I1 and I2 are constants of integration. (Note that throughout this document constants of integration will be indicated by this notation.)

Independent Variable (x) is Missing dy2 dy ++=a12ay 0 dx2 dx The procedures is to define a new variable p as: dy = p dx which can be differentiated again with respect to x to give: dy2 dp = dx2 dx but remember that p can be written as a of y which is a function of x. That is p = f(y(x)). This can be differentiated by chain rule to give (remembering that p = dy / dx): dp dp dy dp ==p dx dy dx dy These relationships for p are substituted into the differential equation to give: dp p ++=ap ay 0 dy 12 The 2nd order differential equation of y with respect to x has now been converted into a 1st order differential equation of p with respect to y. This equation is nonlinear (because p multiplies dp / dx) and can only be solved analytically if it is possible to separate and integrate. Once p is determined as a function of y (e.g., p = f(y)), then y can be found by integrating f(y) with respect to x to give: dy =+xI z fy() 2 The first will be contained in the function f(y).

2 Variation of Parameters

This method can be used anytime you already know one solution, yx1(), to the homogeneous form of the general differential equation given below. dy2 dy ++=ax12()axyhx () () dx2 dx

The complete solution is found by substituting yuxyx= ()1 () into the above differential equation. The differentials of y are as follows:

yuyuy′ = 11′ + ′

yuyuyuy′′ = 111′′+ 2 ′ ′ + ′′ which when substituted into the differential equation gives:

uy′′ 111111121+ u′′bgbg2() y++ axy uy′′ + axy ()()()′ += a xy hx

Since y1 is a solution to the homogeneous form of the differential equation shown at the top of the page, yaxyaxy11′′ + ( ) 12′ + ( ) 1= 0 , and the above equation reduces to give the following differential equation in u:

uy′′1111++ u ′(2()() y ′ axy) = hx The function u can be found from this differential equation by reducing order and then solving by integrating factors. The complete solution y can be found by multiplying u by y1 to give the general solution:

L 1 I O yuyy==hxyFdx()  +2 dx+ I y 11M 2  1 2  P 11 zNM yF1 z yF1 QP where Fadxaˆ =≠exp⎡⎤ when 0 ⎣⎦∫ 11 ˆ Fa= 1 when 1 = 0 From which you can identify the second solution and the particular solution as follows: dx yy= 212  z yF1 1 L O yy= h() x y Fdx dx p 1 2  M 1 P z yF1 Nz Q

3 Constant Coefficient Ordinary Differential Equations

dy2 dy a ++=b cy 0 dx2 dx where a, b and c are constants The form of the differential equation suggests solutions of ye= rx .

(At this point this form is deduced by understanding the properties of differentiating erx . Later, we will develop a general approach for determining that this is the form of the solution.) yre′ = rx

yre′′ = 2 rx

()ar2 ++ br c erx =0

−±bb2 −4 ac Characteristic Equation: r = 2a

Case 1: Real & Unequal Roots (bac2 − 40> )

(a) If rr12≠ and rr12≠− , then

rx12 rx yIe=+12 Ie

(b) If rrr12=− = , then

rx− rx yIeIe=+12 or yA= sinh( rxB )+ cosh( rx ) AB+ BA− where I = and I = 1 2 2 2

Case 2: Complex Roots (bac2 − 40< )

r = α ± iβ , complex conjugate

4 b 4ac− b2 where α=− and β= 2a 2a

αβxxi-i β x ye=+e Ie12 Ie j

But eix = cosx + i sin x αx yeIxixI=++−c 12cos(ββ ) sin( ) cos( ββ xix ) sin( ) h

Let IAB111=+i and IAB222= + i and AA= 12+ A and BB=−21 B ye=+αx b Acos(ββ x ) B sin( x )g

Case 3: Real and Equal Roots (bac2 − 40= )

b rrr===− 12 2a The characteristic equation gives only one solution, rx ye1 = The second solution can be found by variation of parameters to give:

dx  L b O F bxI yy21= where F = expdx = expG J 2  M a P H a K z yF1 Nz Q

rx dx rx rx ye2 ===edxxe z ee−bx a bx a z rx rx yIeIxe=+12

5 Equidimensional Ordinary Differential Equation

dy2 a dy b ++=y 0 dx22x dx x where a and b are constants The form of the differential equation suggests solutions of yx= r

(At this point this form is deduced by understanding the properties of differentiating xr . Later, we will develop a general approach for determining that this is the form of the solution.) yrx′ = r−1

yrrx′′ =−()1 r−2 brr()−+10 ar + bxg r−2 = Characteristic Equation: rarb2 +−()10 +=

114−±aab() −2 − r = 2

Case 1: Real & Unequal Roots ()140−−>ab2

rr12 yIxIx=+12

Case 2: Complex Roots ()140−−

1− a 41ba22−−() where α= and β= 2 2 αβiii α−− β αβlnxx α i β ln yIxx=+12 Ixx = Ixe 1 + Ixe 2 But eix = cosx + i sin x

Let IAB111=+i and IAB222= + i and AA= 12+ A and BB=−21 B

yAx=+ααcos(ββ ln x ) Bx sin( ln x )

6 Case 3: Real and Equal Roots ()140−−=ab2

1− a rrr=== 12 2 The characteristic equation gives only one solution, r yx1 = The second solution can be found by variation of parameters to give:

dx  L a O a yy21= where F = expdx== expbg a ln x x 2  M x P z yF1 Nz Q

r dx r dx rrdx yx2 =====x x xxln z xx21()/−−aa 2z xx () 1 aa z x rr yIxIxx=+12ln

7 Special Equations

Several second-order ordinary differential equations arise so often that they have been given names. Some of these are listed below.

Harmonic Equation The following differential equation commonly arises for problems written in a rectangular coordinate system. dy2 +=by2 0 dx2 where b2 is not a function of x or y This differential equation is a constant coefficient equation with the solution:

yI= 12sin( bxI )+ cos( bx )

Modified Harmonic Equation Like the harmonic equation, this equation commonly arises for problems written in a rectangular coordinate system. dy2 −=by2 0 dx2 where b2 is not a function of x or y This differential equation is a constant coefficient equation with the solution:

yI= 12sinh( bxI )+ cosh( bx ) This equation can also be written in terms of the exponential as:

yI= 12exp( bxI )+ exp(− bx ) As a general rule, it is usually convenient to use the sinh/cosh form of the solution for problems with finite boundaries and to use the exponential form of the solution for problems with one or more infinite boundaries.

Bessel's Equation The following differential equation commonly arises for problems written in a cylindrical coordinate system. dy2 dy x2 ++x ejbx22 − p 2 y =0 dx2 dx

8 where b2 and p2 are constants. This differential equation has the solution

yAJbxBJbx= pp()+ − ()

where A and B are constants of integration, and Jp is the of the first kind and order p. If p is an integer or if p = 0, then the differential equation is: dy2 dy x2 ++x ebx22 − n 2j y =0 dx2 dx where n is an integer or zero. The solution to this equation is:

yAJbxBYbx= nn()+ () where Yn is the Bessel function of the second kind and order n. The Bessel functions of the first and second kind are similar to the and cosine functions (i.e., solutions to the harmonic equation). In particular, like the sine and cosine functions, Bessel functions of the first and second kind are periodic for real arguments.

Modified Bessel's Equation Like Bessel's equation, this equation commonly arises for problems written in cylindrical a coordinate system. dy2 dy x2 +−x ebx22 + p 2j y =0 dx2 dx where b2 and p2 are constants. This differential equation has the solution

yAIbxBIbx= pp()+ − ()

where A and B are constants of integration, and Ip is the modified Bessel function of the first kind and order p. If p is an integer or if p = 0, then the differential equation is: dy2 dy x2 +−x ebx22 + n 2j y =0 dx2 dx where n is an integer or zero. The solution to this equation is:

yAIbxBKbx= nn()+ () where Kn is the modified Bessel function of the second kind and order n. Modified Bessel functions of the first and second kind are similar to the hyperbolic sine and hyperbolic cosine functions (i.e., solutions to the modified harmonic equation). Most importantly, modified Bessel functions of the first and second kind are not periodic functions.

9 Special Functions

Error Function A number of physical problems of interest to chemical engineers will produce equations in which

dy 2 = e−x dx which has the solution yxdxI=−+z expe 2 j where I is a constant of integration. To clarify the exact operation that is intended by the above equation, it is better to write the solution as: x ysdsI=−+expe 2 j z0 The of the exp(-s2) must be determined numerically, except when x is , in which case ∞ π exp −=sds2 ej 2 z0 Because problems with this type of solution arise frequently, it was convenient to define a function that represents this integral. The name of this function is the and it is defined as: x 2 erf() x=− expe s2 j ds π z0 By defining it in this way, erf(x) = 0 when x = 0 and erf(x) = 1 when x → ∞. Using the error function, the solution to the differential equation at the top of this page is: π yerfxI=+() 2

Complementary Error Function The complementary error function erfc(x) is defined as: erfc() x= 1− erf () x

10