<<

Math 215/255 Lecture Notes 2019

University of British Columbia, Vancouver

Yue-Xian Li April 3, 2019

Contents

1 Introduction to Differential Equations 4 1.1 What is a differential equation (DE)? ...... 4 1.2 Ordinary DE (ODE) versus partial DE (PDE) ...... 6 1.3 Order of a DE ...... 6 1.4 Linear versus nonlinear ODEs ...... 7 1.5 Why should we learn ODEs? ...... 7 1.6 Solutions and solution curves of an ODE ...... 8 1.7 Slope fields and solution curves ...... 9

2 First-Order ODEs 10 2.1 Vanishing or direct integration/antiderivation ...... 10 2.2 Mathematical modeling using differential equations ...... 12 2.3 Brief summary of what we have learned ...... 13 2.4 Separable Equations ...... 14 2.5 First-order linear ODEs ...... 17 2.6 Existence and uniqueness ...... 20 2.7 Numerical methods ...... 22 2.8 Exact Equations ...... 27 2.9 Autonomous equations and phase analysis ...... 30 2.10 Applications of first-order ODEs ...... 35

3 Second-Order Linear ODEs 39 3.1 Introduction ...... 39 3.2 Homogeneous, 2nd-order, linear ODEs with constant coefficients ...... 41 3.3 Introduction to complex numbers and Euler’s formula ...... 46 3.3.1 Definitions and basic concepts ...... 46 3.3.2 Basic complex computations ...... 47 3.3.3 Back to Example 3.2.5 ...... 48 3.3.4 Complex-valued exponential and Euler’s formula ...... 49 3.3.5 Back again to Example 3.2.5 ...... 50

1 3.3.6 One more example ...... 52 3.4 Applications: mechanical and electrical vibrations ...... 53 3.4.1 Harmonic vibration of a spring-mass in frictionless medium . . . . . 53 3.4.2 Spring-mass-damper system: a simple model of suspension . . . . . 57 3.4.3 Oscillations in a RLC circuit ...... 62 3.5 , , and fundamental solutions ...... 65 3.6 Nonhomogeneous, 2nd-order, linear ODEs ...... 76 3.6.1 Method 1: Undetermined coefficients ...... 79 3.6.2 Method 2: (Lagrange) ...... 85 3.7 Applications to forced vibrations: beats and resonance ...... 93 3.7.1 Forced vibration in the absence of damping: γ =0...... 93 3.7.2 Forced vibration in the presence of damping: γ 6=0 ...... 96

4 Systems of linear first-order ODEs 98 4.1 Solving the homogeneous system y0 = Ay ...... 100 4.2 , vector field, solution ...... 107 4.3 How does the IC determine the solution? ...... 109 4.4 Complex eigenvalues and repeated eigenvalues ...... 112 4.5 Fundamental and evaluation of eAt ...... 117 4.6 Wronskian and linear independence ...... 120 4.7 Nonhomogeneous linear systems ...... 121

5 Nonlinear Systems 124 5.1 Some examples of nonlinear systems ...... 124 5.2 Phase-plane analysis of a of two nonlinear ODEs ...... 126 5.3 Classification and stability of isolated critical points ...... 140 5.4 Conservative systems that can be solved analytically in closed forms ...... 141

6 Laplace Transform 147 6.1 Introduction - What? Why? How? ...... 147 6.2 Definition and calculating the transforms using the definition ...... 147 6.3 Use a table to find Laplace transforms and the inverse ...... 150 6.4 More techniques involved in calculating Laplace transforms ...... 152 6.5 Existence of Laplace transform ...... 153 6.6 Laplace transform of ...... 155 6.7 Use Laplace transform to solve IVPs ...... 155 6.7.1 Solving IVPs involving extensive partial fractions ...... 157 6.7.2 Solving general IVPs involving a linear ODE with constant coefficients . . . 159 6.7.3 Some inverse LTs where Heaviside’s method fails to apply ...... 162 6.8 Unit step/Heaviside ...... 165 6.8.1 Laplace transform of u(t) and u(t − τ)...... 165 6.8.2 Expressing piecewise continuous function in terms of u(t − τ)...... 166 6.8.3 Solving nonhomogeneous ODEs with piecewise continuous forcing ...... 168 6.9 Laplace transform of and inverse transform of derivatives ...... 170 6.10 Impulse/ ...... 172

2 6.11 Convolution product ...... 174

3 1 Introduction to Differential Equations

1.1 What is a differential equation (DE)?

A Differential Equation (DE): An equation that relates one derivative of an unknown function, y(t), to other quantities that often include y itself and/or its other derivatives.

y(n) = F (t, y, y0, ... , y(n−1)), (1) (n) dny where t is the independent/free variable (many textbooks prefer to use x), y ≡ dtn , (n ≥ 1) is the nth derivative of the unknown function.

• In (1), we call y(n) the LHS of the equation and F (t, y, y0, ... , y(n−1)) the RHS of the equation.

• A solution of the DE (1) is a function y(t) that satisfy the DE. In other words, when y(t) is plugged in the DE, it will make LHS=RHS.

• Solving a differential equation is to find all possible functions y(t) that satisfy the equation.

4 Example 1.1.1: dN(t) N 0(t) = kN(t), (N 0(t) for ), (2) dt models the change of the size of a population N(t) when the average net growth rate is k (typically a known constant).

Example 1.1.2: dy d2y my00 + cy0 + ky = F (t), (y0, y00 for , ) (3) dt dt2 models the displacement y(t) of a mass suspended by a spring, subject to an external force F (t). m, c, k are known constants.

Example 1.1.3:

∂c  ∂2c ∂2c ∂2c  c = D(c + c + c ) also expressed as = D + + , (4) t xx yy zz ∂t ∂x2 ∂y2 ∂z2

models the diffusion of a pollutant in the atmosphere in which c(t, x, y, z) (a multivariable function) describes the concentration of the pollutant at time t and space location (x, y, z). D (> 0) is the diffusion constant of the pollutant.

Example 1.1.4: ∂c ∂2c c + c = c also expressed as + = c (5) x xx ∂x ∂x2 where c(t, x, y, z) is a multivariable function.

Example 1.1.5: d4y ty(4) − y2 = 0, (y(4) for ), (6) dt4 does not necessarily model anything.

5 1.2 Ordinary DE (ODE) versus partial DE (PDE)

Ordinary Differential Equation (ODE): a DE in which the unknown is a single-variable func- tion or in case the unknown is a multivariable function but all derivatives are taken w.r.t. the same independent variable.

Among the previous examples, (2), (3), (5), and (6) are ODEs.

Partial Differential Equation (PDE): a DE in which the unknown is a multi-variable function and its derivatives w.r.t. more than one independent variables appear in the equation.

Among the previous examples, (4) is a PDE.

Focus of the present course: ODEs.

1.3 Order of a DE

Order of a DE: the order of the highest derivative of the unknown that appears in the equations.

Among the previous examples, (2) is 1st order, (3), (4), and (5) are 2nd order, (6) is 4th order.

Remark: An nth (n > 1) order ODE can always be reduced to a system of n 1st order ODEs.

Example 1.3.1: my00(t) = −mg or y00(t) = −g (7) models the displacement of a free-falling mass in a frictionless medium on the surface of the earth. y(t) is the vertical displacement of the mass at time t. It is a 2nd order ODE.

By introducing a second unknown function v(t) = y0(t) (i.e. its velocity), we turn the above ODE into the following system of two 1st order ODEs involving two unknowns y(t) and v(t):

 y0(t) = v(t), (8) v0(t) = −g.

Systems of linear ODEs will be covered later in this course.

6 1.4 Linear versus nonlinear ODEs Linear vs nonlinear: An ODE is linear if it can be expressed in the following form

(n) (n−1) 0 y + an−1y + ··· + a1y + a0y = f(t), (9) where a0, a1, ..., an−1, f(t) are known functions of t but often are known constants, i.e. if only linear combinations of the unknown and its derivatives appear in the equation. Otherwise, it is nonlinear.

Among the previous examples, all but (6) are linear.

Remarks:

• Linear ODEs can often be solved in closed forms. We shall devote more than two third of the time in this course on solving linear ODEs.

• Nonlinear ODEs are often too difficult to solve in closed forms. Numerical, qualitative, and approximation methods are often required in solving nonlinear ODEs. We shall only touch a little bit on nonlinear ODEs.

1.5 Why should we learn ODEs?

The answers to many social, economic, scientific, and problem are achieved in solving ODEs that correctly model/describe the corresponding problem.

7 1.6 Solutions and solution curves of an ODE

Solution of an ODE: A function y(t) is a solution of an ODE if y and its derivatives are continuous and satisfy the ODE on an interval a < t < b.

Solution curve: The graph of a solution y(t) in the ty-plan is called the solution curve.

At this point, a few questions should be asked (but not answered). First, does every ODE have a solution? Second, if so, is it the only solution? Last, what is the interval in which the solution is valid?

Existence and uniqueness: In eq.(1), if F and its partial derivatives w.r.t. its dependent variables are continuous in the closed ty-domain of our interest, the existence and uniqueness of a solution can be guaranteed for any (t0, y(t0)) located in the interior of the domain. We shall not get deeper into this in the lecture here. Read Ch.1.2.2 of the online text and/or Ch.2.8 of the Boyce-DiPrima textbook for more details.

Remark: Before we learn any of the techniques for solving ODEs, we can always try to guess what the solution could be. Fortunately, we can always verify if a guessed solution is indeed a solution by substituting it into the ODE (by verifying it).

Example 1.6.1: Find one solution and then all possible solutions of the following ODE. y0(t) = y(t) (10) Answer:

Obviously, y(t) = 0 is one but a trivial solution.

Notice that we are looking for a function whose derivative is equal to itself. Only exponential func- tions have this property. Thus, we realize y(t) = et is one non-trivial solution.

A more careful inspection reveals that y(t) = 2et is also a solution, further more y(t) = Cet for an arbitrary constant C. This form actually represents all possible solutions of the ODE includ- ing the above two special solutions (for C = 0 and C = 1, respectively).

Special solution vs general solution: Any function that satisfies the ODE is one special solu- tion. The expression that represents all possible solutions of an ODE is called the general solution. It must contain at least one arbitrary constant.

Remark: An ODE usually has a family of infinitely many solutions that differ by one or more constants. The number of arbitrary constants is equal to its order and are often referred to as integration constants since they arise each time we integrate.

8 1.7 Slope fields and solution curves

Consider the following first-order ODE

y0(t) = f(t, y). (11)

Since its right-hand-side (rhs) is known, we can always explicitly calculate the slope of y(t) (i.e. y0(t)) for any given pair of values (t, y). In other words, the slope of the solution can always be predetermined.

Slope field of the ODE is obtained by the plotting the slope of the solution at regular intervals in the ty-plane. Since the solution curve must be tangent to the slope field, it can be obtained by tracing out a curving while making sure that it is tangent to the slope field at every point of its passage.

Example 1.7.1: Plot the slope field of the following ODE and out the solution curve for y(0) = 0.5. y0 = y (12)

y

3

2

1 t 0 1 2 3 4 5 Figure 1: Sketch of the slope field and one solution curve of y0 = y.

9 2 First-Order ODEs

All first-order ODEs can be expressed in the following ‘normal’ form:

y0(t) = f(t, y(t)). (13)

2.1 Vanishing derivative or direct integration/antiderivation

Theorem 2.1.1 (Vanishing Derivative Theorem): 1. The general solution of y0(t) = 0 is y(t) = C, C is any constant.

2. The general solution of y0(t) = f(t)(f is continuous) is y(t) = F (t) + C, where F (t) = R f(t)dt, and C is an arbitrary constant. Proof: Part 1. Suppose y(t) is a solution of the ODE y0 = 0 on a t-interval I. According to Mean value Theorem, if t0 and t are both on I, then there is a number t∗ (t0 < t∗ < t) such that

0 y(t) − y(t0) = y (t∗)(t − t0)

Since y0(t∗) = 0, we see that for all t in I,

y(t) = y(t0) = C.

Part 2. Let F (t) be an antiderivative of f on I, i.e. F 0(t) = f(t). Rewrite the ODE y0 = f into the following form y0 − f = (y − F )0 = 0 Applying the 1st part of the theorem, we see that for all t in I,

y(t) − F (t) = C.

Example 2.1.1: Find the general solution of

y0(t) = cos t. (14)

Answer: Note that

y0(t) = cos t ⇒ y0(t) − cos t = 0 ⇒ (y(t) − sin t)0 = 0, we see that y(t) − sin t = C ⇒ y(t) = sin t + C.

10 Alternatively, Z y0(t) = cos t ⇒ y(t) = cos tdt = sin t + C.

Example 2.1.2: Find the general solution of the population model

N 0(t) = −kN(t). (15)

Answer: First rewrite the equation in the following form,

N 0 + kN = 0

Multiply both sides by the function ekt

ektN 0 + kektN = (ektN)0 = 0.

According to the Vanishing Derivative Theorem,

ektN(t) = C or N(t) = Ce−kt.

Example 2.1.3: Find the general solution of

3y2y0 = et, (nonlinear!) (16)

Answer: Note that 3y2y0 = (y3)0, thus the ODE can be rewritten as

Z √ (y3)0 = et ⇒ y3 = etdt = et + C ⇒ y(t) = 3 et + C.

11 2.2 Mathematical modeling using differential equations

Modeling is a process loosely described as recasting a problem from its natural environment into a form, called a model, that can be analyzed via techniques we understand and trust (ODEs). It often involves the following steps listed in this very simple example.

Example 2.2.1: A simple model of free falling objects.

Motivations: Questions to answer: (1) If it takes 3 seconds for a piece of stone to drop from the top of a building, what is the height of the building? (2) If a cat falls from a roof of 4.9 meters high, what is the speed when she hits the ground? Assume that we can ignore air resistance.

Determine system variables: One single independent variable is time t. The unknown variables (functions) are the vertical of the free-falling object y(t) and its speed v(t).

Determine the domain of variation for all variables: For example, t varies between 0 and 3 seconds for question (1), y(t) varies between 0 and 4.9 meters in question (2).

Natural law: Newton’s second law of motion: A free-falling object near earth’s surface moves with constant acceleration g if air resistence can be ignored, where g is the earth’s gravitational constant.

Write down the equation and initial conditions:: y00(t) = −g, 0 ≤ t ≤ T (T is the falling time) (17) y(0) = h, y0(0) = v(0) = 0 (h = height of the building) (18)

Determine system parameters: The earth’s gravitational constant g = 9.8 m/s2, the total time T = 3 s, the initial height h = 4.9 m..

Solve the equation: Remember, by introducing a new function v(t) = y0(t) (i.e. its speed), we turn this 2nd-order ODE in a system of two 1st order ODEs:  y0(t) = v(t), (19) v0(t) = −g. with initial conditions y(0) = h and v(0) = 0. Note that −gt is the antiderivative of −g,

0 v (t) = −g ⇒ v(t) = −gt + C1

Since v(0) = 0, C1 = 0. Thus, v(t) = −gt (unique).

Notice also −gt2/2 is the antiderivative of −gt,

0 2 y (t) = v(t) = −gt ⇒ y(t) = −gt /2 + C2

12 2 Since y(0) = h, C2 = h. Therefore, y(t) = h − gt /2 (unique).

The answer to our first question about the height of the building is found by substituting t = 3 sec, g = 9.8 m/sec2, and y(t) = 0 (means object on the ground) into the solution: h = 44.1 m! If you feel any doubt about this result, you should blame the assumption that air resistance can be neglected in the model but NOT the math. As to the cat’s impact speed, we can first find out how long does it take for her to reach the ground (1 sec for h = 4.9 m), then to find out that the speed is v(1) = −9.8 m/s (minus sign for downward direction).

Explanation of the results and possibly predictions.

2.3 Brief summary of what we have learned

1. Solving ODEs basically involves finding a function given a constraint on its derivative(s).

2. Integration is often required in the process of solving ODEs.

3. There are usually infinitely many solutions to an ODE that differ by one or more integration constants.

4. An expression of all possible solutions to an ODE is called the general solution. Any other solution is called a special/particular solution.

5. Unique solution is obtained only when appropriate initial conditions are satisfied.

6. Modeling with ODEs usually follow some standard steps.

13 2.4 Separable Equations

Definition: A first-order ODE is called separable if it can be expressed as

y0(t) = g(t)h(y), (20)

where g(t) is a function of t only while h(y) is a function of y only.

Separation of variables: For a separable equation, dy dy = g(t)h(y) ⇒ = g(t)dt, dt h(y) which is solved by integrating both sides: Z dy Z = g(t)dt. h(y)

Example 2.4.1: The population model dN = −kN, (21) dt is a separable equation. Solve it using .

Answer: Separation of variables yields dN Z dN Z = −kdt ⇒ = − kdt ⇒ ln N = −kt + C ⇒ N(t) = eC1−kt = Ce−kt. N N 1

Example 2.4.2: Solve the separable equation dy x2 = . dx 1 + y2

Answer: Separation of variables yields Z Z y3 x3 (1 + y2)dy = x2dx ⇒ (1 + y2)dy = x2dx ⇒ y + = + C, 3 3 where the solution y(x) is expressed in an implicit form.

14 Example 2.4.3 Solve y0 = 2xey(1 + x2)−1.

Step 1. Separate the variables and express the equation into the following form: 2xdx e−ydy = 1 + x2 Step 2. Integrate both sides. Z Z 2xdx e−ydy = 1 + x2 R y y R 2xdx 2 Thus (calculate the integrals e dy = e and 1+x2 = ln(1 + x )),

−e−y = ln(1 + x2) + C or y = −ln(−ln(1 + x2) − C)

This solution is defined only for −ln(1 + x2) − C > 0 or C < −ln(1 + x2). For this problem, y can be expressed explicitly in terms of x.

Example 2.4.4

0 xy Solve y = (1+x)(1+y) , with y(0) = 1 and x > 0. (A problem from the final exam in 1995).

This is an initial value problem (IVP). First find the genral solution then determine the constant. Step 1. Separate the variables and express the equation into 1 + y x dy = dx y 1 + x Step 2. Integrate both sides. Z 1 Z 1 (1 + )dy = (1 − )dx y 1 + x Thus, ex y + ln y = x − ln(1 + x) + C or yey = C 0 1 1 + x

C0 where C1 = e . This general solution is always valid for x > 0 and C1 > 0. Step 3. Substitute intitial condition into the general solution to determine the value C0 or C1.

C0 = 1 or C1 = e

Therefore, the solution for the IVP is:

e1+x y + ln y = x − ln(1 + x) + 1 or yey = . 1 + x In this problem, y can not be solved explicitly in terms of x.

15 Example 2.4.5 Solve y0 + p(t)y = 0

This is a homogeneous, first-order, linear ODE. We can see that it is also separable. 1 dy = −p(t)dt y Integrate both sides, we get ln y = −P (t) + C0 Or by taking the exponential of both sides

y(t) = Ce−P (t) C = eC0

Summary: Separable equations are ODEs that can be either linear or nonlinear. This a special class of ODEs that can be solved by applying the method called separation of variables. However, linear ODEs can readily be solved in closed forms using other methods as discussed below.

16 2.5 First-order linear ODEs

All first-order linear ODEs can be expressed in the following ‘normal’ form:

y0 + p(t)y = q(t), (22)

where p(t) and q(t) are known functions of t.

Method of : Main idea is to turn the lhs of eq.(22) into the derivative of a single function F (t, y) such that eq.(22) is turned into the form

F 0 = f(t), which can be solved by direct integration.

Integrating factor: the idea expressed above is always achievable by multiplying both sides of eq.(22) by its integrating factor Z eP (t), with P (t) = p(t)dt (i.e. P 0(t) = p(t)), which yields

0 eP (t)y0 + p(t)eP (t)y = q(t)eP (t) ⇒ eP (t)y = q(t)eP (t) ⇒ eP (t)y(t) = R(t) + C, where R(t) = R q(t)eP (t)dt. Dividing both sides by eP (t), we obtain

y(t) = e−P (t) [R(t) + C] . (23)

Example 2.5.1 y0 + y = t.

Answer: p(t) = 1, q(t) = t. The integrating factor is

R R e p(t)dt = e dt = et.

Multiply both sides by et yields Z ety0 + ety = tet ⇒ (ety)0 = tet ⇒ ety = tetdt = tet − et + C.

Thus, y(t) = e−t[tet − et + C].

17 Theorem 2.5.1 (General Solution Theorem): The general solution of the linear ODE

y0 + p(t)y = q(t),

where p(t) and q(t) are continuous on a t-interval I, has the form

y(t) = e−P (t)[R(t) + C], where P (t) = R p(t)dt and R(t) = R q(t)eP (t)dt, and C is any constant.

Proof. Multiply both sides of the equation by the integrating factor eP (t),

eP (t)(y0 + p(t)y) = eP (t)q(t)

This equation can be re-written in the following form

(eP (t)y)0 = eP (t)q(t)

Applying the Vanishing Derivative Teorem, we get

eP (t)y(t) = R(t) + C

Multiply both sides by the nonzero function e−P (t). End of proof.

Remarks: This theorem tells us that to solve a linear ODE, we only need to calculate the an- tiderivatives (indefinite integrals) of the two functions p(t) and eP (t)q(t).

Example 2.5.2: Solve y0 − 2y = 4 − t.

Answer: Notice that p(t) = −2 and q(t) = 4 − t. Z P (t) = (−2)dt = −2t ⇒ eP (t) = e−2t.

Z Z 1 1 R(t) = q(t)eP (t)dt = (4 − t)e−2tdt = (t − 4)e−2t + e−2t. 2 4 1 7 y(t) = e−P (t)[R(t) + C] = Ce2t + t − . 2 4

18 0 sin t Example 2.5.3: Solve ty + 2y = t . (A problem from the 1995 final exam!)

Answer:

Step 1: Transform the equation into the normal form given by eq.(22) and identify the p(t) and q(t) for this problem. In this case, we have to devide both sides by t. (Be careful that we can do sint this only for t 6= 0! At t = 0 the equation is reduced to 2y(0) = 1 (remember limt→0 t = 1)). 2 sin t y0 + ( )y = t t2 Thus, p(t) = 2/t and q(t) = sin t/t2 for this equation.

Step 2: Calculate the antiderivatives. Z 2 P (t) = dt = ln(t2), thus the integrating factor is eP (t) = t2. t Z sin t Z sin t Z R(t) = (eP (t)) dt = (t2) dt = sin tdt = − cos t t2 t2 Therefore, the solution for t 6= 0 is C − cos t y(t) = t2 Notice that for t = 0 this solution exists only when C = 1. In this case, y(0) = 1/2 (remember cost = 1 − t2/2! + t4/4! − · · · .) This is in agreement with the original equation. Therefore, there is only one single solution (when C = 1) for this equation in the domain (−∞ < t < +∞). However, on either (−∞ < t < 0) or (0 < t < +∞) there exists a whole class of solution for any C.

Step 3: Verify the result by substituting it back into the original ODE.

Note that we can always check if our calculation is correct! The special concern here is not to forget to discuss the special situations like t = 0.

19 2.6 Existence and uniqueness

Thoerem 2.6.1 (for linear 1st-order ODEs): If p(t), q(t) are continuous on an open interval α < t < β containing the point t = t0, then there exists a unique solution y = φ(t) that satisfies the following initial value problem (IVP):

 y0 + p(t)y = q(t), (24) y(t0) = y0 .

Proof: Solve explicitly y = φ(t) using method of integrating factor.

∂f Thoerem 2.6.2 (for general 1st-order ODEs): If f and ∂y are continuous in the rectangle: α < t < β, γ < y < δ containing the point (t0, y0) in the ty-plane. Then, in some interval t0 − h < t < t0 + h (h > 0) contained in α < t < β, there exists a unique solution y = φ(t) that satisfies the following IVP:  y0 = f(t, y), (25) y(t0) = y0 .

Proof: Read 2.8 of Boyce and DiPrima.

Example 2.6.1: Find an interval on which

 ty0 + 2y = 4t2, (26) y(1) = 2 . has a unique solution.

0 2 Answer: Rewrite it in normal form: y + t y = 4t. Note that q(t) = 4t

is continuous everywhere, but 2 p(t) = t

is continuous in either (−∞, 0) or (0, +∞) but not at t = 0. But only (0, +∞) contains t0 = 1. So, the above IVP has a unique solution on interval (0, +∞).

20 Example 2.6.2: Find a rectangle in the xy-plane in which the following IVP has a unique solution.

( 2 y0 = 3x +4x+2 , 2(y−1) (27) y(0) = −1 .

Answer: For this 1st-order ODE, the rhs is given by

3x2 + 4x + 2 f(x, y) = 2(y − 1)

∂f which is continuous for all −∞ < x < ∞. But both f and ∂y are discontinuous at y = 1. Thus, a unique solution is possible for either −∞ < y < 1 or 1 < y < ∞. But only −∞ < y < 1 contains y0 = −1. Therefore, the IVP has a unique solution in the rectangle: −∞ < x < ∞ and −∞ < y < 1.

21 2.7 Numerical methods

In many practical science, engineering, and social economical application, the ODEs are often too hard or impossible to solve exactly in closed forms. Fortunately, one can always solve an ODE using numerical methods on computers.

Motivation/goal: Given the following IVP defined on the interval a ≤ t ≤ b

 y0 = f(t, y), (28) y(t0) = y0 . solve approximately the values of y(t) on discretized points of t (i.e. a ≤ t0, t1, ... , tN ≤ b) with desired accuracy and explicit error estimates.

Standard procedure:

• Step 1: Discretize the interval [a, b] into N (usually N >> 1 is a very big integer) subintervals often of equal length t − t b − a h = N 0 = , N N h (usually 0 < h << 1 is a very small number) is called the step-size.

y y(t)

y(t ) .N . y( t 2 ) y( t 1 ) y0=y(t 0 ) t ...... t0 =a t 1 t 2 t N=b

Figure 2: Discretization of the interval [a, b].

• Step 2: Select one iteration scheme (the actual numerical method) from a collection of known schemes to calculate yi (i = 1, 2, ... , N) sequentially

y0 (given) → y1 → y2 → · · · → yN such that yi ≈ y(ti), (i = 1, 2, ... , N).

22 • Step 3: Determine the upper bound of truncation errors based on the step-size and the specific iteration method used. When the iteration method is fixed, usually the smaller the step-size h the better the sequence of numbers yi (i = 1, 2, ... , N) approximates the exact solution y(t) itself in [a, b].

Euler’s method: The simplest method based on tangent-line approximation.

Now we focus on how to calculate the value yi based on the previous value yi−1.

Basic idea behind Euler’s method: If the step-size is very small, the solution curve is seg- mented into N very small pieces by the red dashed vertical lines (see Fig. 3) drawn at t = ti (i = 1, 2, ... , N). We can approximate each segment by a straight line tangent to the curve (see Fig. 3 for a schematic diagram).

y y(t)

y(t ) .N . y2 y( t 2 ) y1 y( t 1 ) y0=y(t 0 ) t ...... t0 =a t 1 t 2 t N=b

Figure 3: Euler’s/tangent-line method demonstrated. Green lines are the tangent lines while dash-dotted green lines represent the values of y1 and y2.

Formula for Euler’s method: can be derived using the discretized version of the ODE

yi+1 − yi yi+1 − yi ≈ f(ti, yi) ⇒ ≈ f(ti, yi) ⇒ yi+1 − yi ≈ hf(ti, yi) ti+1 − ti h

Therefore,

yi+1 = yi + hf(ti, yi), (i = 0, 1, ... , N − 1) (29)

23 is Euler’s iteration scheme (Euler’s method). Given the value of yi we can use it to calculate the value of yi+1. Thus, given the initial value of y0, we can calculate y1, y2, ... , yN sequentially.

Sources of error: There are two major sources of error in such numerical methods:

1. truncation error that arises when we approximated the curve by its tangent line and it prop- agates as we iterate further from the initial point (see Fig. 3). This error can be limited by choosing a better iteration scheme and/or reducing the step-size h.

2. round-off error that occurs when we calculate real numbers with infinitely many decimal points by computer numbers with finite decimal points. This error can be reduced by using computers that allow float numbers with longer digits.

Truncation error for Euler’s method:

1. Local truncation error is the error that occurs at a single iteration step.

2 Elocal = Kh

for Euler’s method, where K is a constant.

2. Global truncation error is the error that accumulated after N steps of iteration.

Eglobal = Mh

for Euler’s method, where M is a constant.

Euler’s method is first-order because its Eglobal is proportional to the first power of step-size h. n For an n-th order method, usually Eglobal = Mh . For an n-th order method, Eglobal is reduced by n orders of magnitude when h is reduced by 10 fold.

24 Example 2.7.1: Use Euler’s method with step-size h = 0.1 to solve the following IVP on interval 0 ≤ t ≤ 1.  y0 + 2y = t3e−2t, (30) y(0) = 1 .

3 −2t Answer: For this ODE, f(t, y) = −2y + t e , t0 = 0, y0 = 1, t10 = 1.

y(0.1) ≈ y1 = y0 + hf(t0, y0) = 1 + 0.1(−2 + 0) = 0.8; 3 −0.2 y(0.2) ≈ y2 = y1 + hf(t1, y1) = 0.8 + 0.1(−2(0.8) + 0.1 e ) = 0.640082;

y(0.3) ≈ y3 = y2 + hf(t2, y2) = 0.512602; ······

y(1) ≈ y10 = y9 + hf(t9, y9) = 0.139779. (31)

Actually, the exact solution of this IVP can be found e−2t y(t) = (t4 + 4) 4 which yields y(1) = 0.169169.... The error is quite significant since h = 0.1 is not small enough. However, if we made h = 0.0000001, we would have to make 1 million times more calculations. This is beyond doing by hand, but fortunately for modern computers this only requires tiny, negligible computation time.

Convergence of numerical solution to exact solution:

Example 2.7.2: Given the IVP  y0 = −2y, (32) y(0) = 1 , of which we know the exact solution is y(t) = e−2t. Suppose there is no round-off error, show that the theoretical approximate solution using Euler’s method converges to this exact solution as the step-size h approaches zero.

Answer: Divide the interval [0, t] into N subintervals of length h: t − 0 t h = = . N N Using Euler’s iteration scheme:

yi+1 = yi + hf(ti, yi) = yi + h(−2yi) = (1 − 2h)yi, (i = 0, 1, ... , N − 1)

Therefore, y1 = (1 − 2h)y0 = (1 − 2h),

25 2 y2 = (1 − 2h)y1 = (1 − 2h) , 3 y3 = (1 − 2h)y2 = (1 − 2h) , ··· = ··· , N yN = (1 − 2h)yN−1 = (1 − 2h) . Thus, N 2t  (−2t) N→∞, h= t →0 y(t) ≈ y = (1 − 2h)N = (1 − )N = 1 + −→ N e−2t, N N N where the famous limit a lim (1 + )x = ea x→∞ x was used.

26 2.8 Exact Equations

To understand this subsection, one needs to know the Chain rule for differentiating a multivariable function. dz(x(t), y(t)) ∂z dx ∂z dy = + dt ∂x dt ∂y dt

Example 2.8.1 Solve 2x + y2 + 2xyy0 = 0.

This equation is neither linear nor separable. The methods for sovling those types of ODEs can’t apply here. Yet, as we will show in the following, this equation can also be solved in closed form. Why? Because it belongs to another special class of equations that happens to be solvable: exact equations.

Let’s first express it in the following “standard” form:

M(x, y) + N(x, y)y0 = 0 (33) In this example, M(x, y) = 2x + y2 and N(x, y) = 2xy. The special feature of this equation is

My = Nx(= 2y) (34) This is actually the definition of an exact equation. According to this definition, separable equations are also exact because for separable equations My(x) = Nx(y)(= 0).

What is good about this feature? It allows us to find a function Ψ(x, y) with its derivative with respect to x equals the lhs of eq.(33), thus having a vanishing derivative.

For this to be true, the following equation should hold.

dΨ chain rule dx dy z}|{= Ψ + Ψ = Ψ + Ψ y0 = M + Ny0 = 0 ⇒ Ψ(x, y(x)) = C. (35) dx x dx y dx x y The problem is how to find the function Ψ. According to eq.(35),

Ψx = M Ψy = N

To solve the particular problem in this example, we can first solve Ψy = N by integrating both sides with respect to y (treating x as constant while doing this):

27 Z Z Z 2 Ψydy = Ndy = 2xydy ⇒ Ψ = xy + h(x)

where h(x) is an unknown function of x. Now substitute the Ψ expression into Ψx = M, we obtain

y2 + h0(x) = M = 2x + y2 ⇒ h0(x) = 2x ⇒ h(x) = x2 + C Therefore, Ψ = x2 + xy2 + C for this example problem. The solution now becomes

x2 + xy2 = C (only one constant is needed!) Actually the smae method could be used to calculate Ψ for general exact equations. R Step 1. Integrate Ψy = N to obtaine Ψ(x, y) = N(x, y)dy + h(x). R 0 R Step 2. Substitue Ψ(x, y) = N(x, y)dy +h(x) into Ψx = M to get h (x) = M(x, y)− Nx(x, y)dy. Step 3. Integrate the equation for h0(x). Before that, we have to check if the rhs is indenpendent of y by differnetiating it with respect to y ∂ Z [M(x, y) − N (x, y)dy] = M − N = 0 ∂y x y x

0 Therefore, the special feature My = Nx guarantees that h(x) can be determined by solving h (x) = R M(x, y) − Nx(x, y)dy. We have proved the following theorem.

Theorem 2.8.1 Let M,N,My,Nx be continuous in the rectangular region R in the xy-plane. Then M(x, y) + N(x, y)y0 = 0

is an exact equation in R iff (if and only if)

My(x, y) = Nx(x, y) That is, there exists a function Ψ satisfying

Ψx(x, y) = M(x, y)Ψy(x, y) = N(x, y)

dΨ 0 0 Since dx = M(x, y) + N(x, y)y = 0. The general solution of M(x, y) + N(x, y)y = 0 is implicitly defined by Ψ(x, y) = C (C is any constant).

Example 2.8.2 Solve (ycosx + 2xey) + (sinx + x2ey − 1)y0 = 0.

Step 1. Check if it is exact. M(x, y) = ycosx + 2xey, N(x, y) = sinx + x2ey − 1.

y My(x, y) = cosx + 2xe = Nx(x, y)

Step 2. Start calculating the function Ψ(x, y) with Ψx = M or Ψy = N which ever is simpler.

y Ψx = M(x, y) = ycosx + 2xe

28 Integrating with respect to x, we obtain

Ψ(x, y) = ysinx + x2ey + h(y)

2 y Step 3. Substitute Ψ(x, y) = ysinx + x e + h(y) into Ψy = N.

sinx + x2ey + h0(y) = sinx + x2ey − 1

Thus, 0 h (y) = −1 ⇒ h(y) = −y + C0 Step 4. Write down the solution in implicit form.

2 y 2 y Ψ(x, y) = ysinx + x e − y + C0 = C1 ⇒ ysinx + x e − y = C (C = C1 − C0)

Therefore, the constant in h(y) can always be obsorbed in the constant on the rhs of the final solution. We do not have to put a constant when solving the ODE for h.

Example 2.8.3. Solve (3xy + y2) + (x2 + xy)y0 = 0.

Step 1. Check if it is exact.

My(x, y) = 3x + 2y 6= Nx(x, y) = 2x + y

This is not an exact equation.

However, some equations that are not exact (including this particular one given above), can be transformed into an exact equation by multiplying both sides of the equation by an function µ(x, y) (also called integrating factor). Unfortunately, to find the integrating factor is often as difficult as solving the original ODE. A detail discussion is out of the scope of this course.

However, the the above equation. It is not so hard to find that x is an integrating factor. Since the ODE (3x2y + xy2) + (x3 + x2y)y0 = 0 is exact.

2 My = 3x + 2xy = Nx

Thus, 3 2 3 2 2 Ψy = x + x y ⇒ Ψ = x y + x y /2 + h(x) And, 2 2 0 2 2 0 3x y + xy + h (x) = 3x y + xy ⇒ h (x) = 0 ⇒ h(x) = C0 Therefore the solution is x3y + x2y2/2 = C.

Notice that the same equation can be solved by using other integrating factors. For exampl, µ(x, y) = 1/(xy(2x + y)) is also an integrating factor.

29 2.9 Autonomous equations and phase space analysis

Def: The first-order ODE y0 = f(t, y) is called an autonomous equation if

f(t, y) = f(y)

i.e. if the RHS does not explicitly depend on the independent variable t. The space (i.e. a line here) span by the unknown function (i.e. the y-axis) is call the phase space or .

• The slope/vector filed of an autonomous 1st order ODE does not change as a function of time (i.e. on each line parallel to the t-axis, the vectors are all parallel.)

• The direction of phase flow is fixed at every point in phase space (i.e it does not change with t).

• Non autonomous ODEs can be transformed into autonomous ODEs by introducing one addi- tional variable.

Example 2.9.1: The logistic equation. y0 = y(1 − y) is an autonomous equation and is separable. Solve the equation and sketch the solutions for a few representative initial values y(0) = y0.

Answer: Separation of variables yields dy Z dy Z = −dt ⇒ = − dt = −t + C . y(y − 1) y(y − 1) 1

The on the lhs requires integration by partial fractions:

Z dy Z  1 1 y − 1 = − dt = ln(y − 1) − ln y = ln . y(y − 1) y − 1 y y

Thus, y − 1 y − 1 1 ln = −t + C ⇒ = Ce−t ⇒ y(t) = . y 1 y 1 − Ce−t

Substitute the initial condition y(0) = y0 into the solution, one finds

y0 y(t) = −t . y0 − (y0 − 1)e

One finds two special solutions: (i) for y0 = 0, y(t) = 0 for all t ≥ 0; (ii) for y0 = 1, y(t) = 1 for all t ≥ 0. One needs a graph plotter to find out how the solution curves looks like for other initial conditions (see figure).

30 y(t) y y(0)

1 Projecting 1

y(0) 1/2 onto y−axis 1/2

y(0) 0 0 0 t

The image on the solutions projected onto the phase space on the right is called the of the equation. In this phase portrait, the direction of is represented by arrow directions which are often referred to as flow direction or phase trajectories.

Phase space analysis is a qualitative method we often employ in the study of autonomous ODEs so that we can achieve the same results presented in the figure above without having to solve the equation and/or use a graph plotter to find the solution curves and the phase portrait.

Step 1. Finding the steady states (also called fixed points, critical points, equilibriums, ...)

Def: A steady state of the autonomous equation y0 = f(y) is a state at which y0 = 0, i.e. it is a special solution of the equation that remains constant (steady) for all t ≥ 0. All steady states are found by solving

f(y) = 0.

Example: For the logistic equation f(y) = y(1 − y).

f(y) = y(1 − y) = 0 ⇒ ys = 0 and ys = 1 are the two steady states.

Step 2. Sketch the curve of f(y) and determine the phase flow directions.

y’=f(y) y’=f(y)

0 1/2 1 y 0 1/2 1 y

31 Notice that if f 0(y) > 0 at a steady state, the trajectories flow away in both directions; however, if f 0(y) < 0, the trajectories flow toward it in both directions.

Step 3. Determine the stability of the steady states using the graph of f(y).

Def: Stability of a steady state. A steady state ys is stable, if trajectories flow toward it from all possible directions; it is unstable if trajectories flow away from it in at least one direction.

In real world, only stable steady states can be observed in experimental observations due to the existence of noises.

0 For the logistic model y = y(1 − y), plot of f(y) vs y shows clearly that ys = 0 is unstable because the trajectories point away from it. However, ys = 1 is stable because trajectories from all possible directions point toward it.

Step 4. Sketch the solution curves y(t) using the graph of f(y).

For an autonomous equation, the plot of f(y) uniquely defines the slope of y(t), i.e. y0(t), at each value of y. Therefore, one can always trace out the concavity of the solution y(t) and determine the point(s) of inflection in y(t). This allows us the sketch the shape of the solution curve for each initial condition we choose. The result is the following qualitative graph of the solutions for a few representative initial conditions.

y(t) y(0)

1

y(0) 1/2

y(0) 0 0 t

For y(0) > 0 close to zero (blue curve in the figure above), the solution is “sigmoidal” because the curve is initially concave up as the slope increases. It reaches maximum slope at y = 0.5, after that the slope decreases as it turns into concave down shape. The point of inflection happens at the local maximum of f(y).

32 Example 2.9.2: Find all steady states of the autonomous ODE y0 = y(y − 0.25)(1 − y) and determine their stability. Sketch the solution curve for each representative choice of the initial value y(0).

Ans: It is clear that ys = 0, 0.25, 1 are the values that make f(y) = y(y − 0.25)(1 − y) = 0. Thus, there are 3 steady states. A sketch of f(y) is given below which clearly show the 3 zeros/steady states. The flow directions show that ys = 0 and 1 are two stable steady states but ys = 0.25 is unstable. This is a system that show the phenomenon of bistability.

Based on the sketch of the f(y), one can sketch the solutions curves for 6 representative initial value of y (see the figure below.) f(y)

y

01/4 1

y 1

1/4

0 t

Therefore, phase space analysis allows us to qualitatively find the solutions of the nonlinear ODE without having to solve the equation analytically in closed form or numerically using a computer.

33 Linear stability analysis. Often f(y) is a function that is not easy to sketch the curve. In this case, we still can determine the stability of the steady states by using analytical method.

0 Consider an ODE y = f(y). Let ys be a steady state, i.e. f(ys) = 0. The stability of ys is determined by the behaviour of the system near ys. Let δ(t)(|δ(t)| << 1) be a small difference between y(t) and ys, thus

δ(t) = y(t) − ys ⇒ y(t) = ys + δ(t). Substitute into the ODE:

d(y + δ) s = f(y + δ), ⇒ δ0 = f(y ) + f 0(y )δ + O(δ2). dt s s s Since |δ|2 << |δ|, we can ignore higher order terms in δ and obtain the following linearized ODE

0 0 0 f (ys)t δ = f (ys)δ, ⇒ δ(t) = δ0e .

Therefore, 0 • If f (ys) > 0, δ(t) → ∞ as t → ∞, ys is unstable.

• If ys is unstable, phase trajectories (flows) move away from it in at least one directions.

0 • If f (ys) < 0, δ(t) → 0 as t → ∞, ys is stable.

• If ys is stable, phase trajectories (flows) converge (move) toward it from all possible directions.

0 • If f (ys) = 0, neutral or stability determined by higher order terms (if exist). • Unstable steady states, under normal conditions, cannot be detected in experimental settings or numerical simulations.

Application to Example 2.9.1: For logistic equation, f(y) = y(1 − y), ys = 0, 1 are the steady states.

f 0(y) = 1 − y + y(−1) = 1 − 2y f 0(0) = 1 > 0 and f 0(1) = −1 < 0.

Thus, ys = 0 is unstable and ys = 1 is stable.

Application to Example 2.9.2: For this example, f(y) = y(y − 0.25)(1 − y), ys = 0, 0.25, 1 are the steady states.

f 0(y) = (y − 0.25)(1 − y) + y(1 − y) + y(y − 0.25)(−1) f 0(0) = −0.25 < 0 (stable); f 0(0.25) = 0.25 × 0.75 > 0 (unstable); f 0(1) = −0.75 < 0 (stable).

34 2.10 Applications of first-order ODEs

Example 2.10.1: Terminal speed problem. A paratrooper jumps out of an airplane at altitude h. With a fully open parachute, the air resistance is proportional to the speed with a constant mk, where m is the mass of the trooper and constant k > 0 is related to the size, shape, and other properties of the parachute. Assume that initially vertical speed of the trooper is zero and that h is large enough so that a terminal constant speed is reached long before the trooper hits the ground. Find:

(a) the speed of the trooper as a function of time v(t);

(b) the terminal speed vt = v(∞).

mkv

mg

Figure 4: Forces experienced by a paratrooper.

Answer: Based on Newton’s law of motion

my00 = mv0 = −mg − mkv ⇒ v0 = −g − kv ⇒ v0 + kv = −g, where “-” of the first term implies the positive direction of the y coordinate is upward, “-” of the second term means the air resistance is alway opposite to the direction of the speed v. The initial condition is v(0) = 0.

This is a first-order, linear ODE with p(t) = k and q(t) = −g. Thus, the integrating factor eP (t) and R(t) are R Z g e p(t)dt = ekt, ⇒ R(t) = (−g)ektdt = − ekt. k Therefore the general solution is g v(t) = e−kt[R(t) + C] = Ce−kt − . k g Using the initial condition v(0) = 0, we obtain C = k . Thus g g v(t) = [e−kt − 1] t−→→∞ − . k k g The terminal speed is v(∞) = − k , where the “-” sign implies it is downward.

35 Example 2.10.2: Mixing problem. Salt solution of concentration s ([kg]/[L]) is continuously flown into the mixing tank at a rate r ([L]/[min]). Solution in the tank is continuously stirred and well mixed. The rate for the outflow of the well-mixed solution is also r. Initially (i.e., at t = 0), the volume of the solution inside the tank is V ([L]) and the total amount of salt is Q0 ([kg]). Find: (a) the total amount of salt in the tank as a function of time Q(t); (b) the amount of salt a very long time after the initiation of the experiment, Q(∞).

Figure 5: Mixing salt solution in a stirred tank.

Answer: Because the rates of in and out flows are identical, the volume remains unchanged in the experiment, V = const. dQ Q r = rate in − rate out = rs − r , ⇒ Q0 + Q = rs. dt V V

r P (t) This is a first-order, linear ODE with p(t) = V and q(t) = rs. Thus, the integrating factor e and R(t) are Z R p(t)dt r t r t r t e = e V , ⇒ R(t) = rse V dt = sV e V .

Therefore the general solution is

− r t − r t Q(t) = e V [R(t) + C] = sV + Ce V .

Using the initial condition Q(0) = Q0, we obtain C = Q0 − sV . Thus

− r t Q(t) = sV + (Q0 − sV )e V is the amount of salt in the tank as a function of time. Since

− r t t→∞ Q(t) = sV + (Q0 − sV )e V −→ sV, after a very long time the total amount of salt in the tank is Q(∞) = sV .

36 Example 2.10.3: Escape speed. A bullet is shot vertically into the sky. Assume that air resistance can be ignored. Answer the following questions:

1. If the initial speed is v0, at what height, hmax, it reverses direction and starts to fall?

2. What should the value of v0 be in order to make hmax = ∞? (i.e., the escape speed ve.)

v(t)            y(t)

Re

Figure 6: Escaping bullet.

The known related quantities:

• m=mass of the bullet.

• G=universal gravitational constant.

• Re=radius of the earth.

• Me=mass of the earth.

GMe • g = 2 =gravitational constant on earth’s surface. Re

Answer: based on Newton’s law

00 0 mMeG dv MeG my = F ⇒ mv = − 2 ⇒ = − 2 . (Re + y) dt (Re + y) Note that the ODE as it is contains two unknown functions y(t) and v(t). Using the chain rule

dv dv dy dv = = v . dt dy dt dy This expression allows us to solve v as a function of y since t is not explicitly involved in the equation. Now, we have dv MeG v = − 2 . dy (Re + y)

37 This is a separable equation. Separation of variables yields Z Z MeG MeG vdv = − 2 dy ⇒ vdv = − 2 dy (Re + y) (Re + y) which leads to 2 2 1 2 MeG MeG Re gRe v = + C = 2 + C = + C. 2 Re + y Re Re + y Re + y 1 2 Using the initial condition v(0) = v0, we obtain C = 2 v0 − gRe. Thus,

2 2gRe 2 v = + v0 − 2gRe. 1 + y/Re

2 Rev0 2 2gRehmax 1. To find hmax, plug in v(hmax) = 0. We obtain hmax = 2 and v0 = . 2gRe−v0 Re+hmax

2 √ 2. To find the escape speed ve, plug in hmax = ∞. We obtain ve = 2gRe ⇒ ve = 2gRe ≈ 11.1 km/s.

38 3 Second-Order Linear ODEs

3.1 Introduction A second-order ODE can be generally expressed as

y00 = f(t, y, y0). (36)

If f(t, y, y0) = f(y, y0) (i.e. its rhs is explicitly independent of t), it is called an autonomous ODE. Otherwise, it is non-autonomous.

A second-order linear ODE is often expressed in the following “normal” form

y00 + p(t)y0 + q(t)y = g(t), (37) where p(t), q(t), g(t) are known functions of t. Basically, if these three functions are continuous in 0 an interval containing t0, a unique solution exists for proper initial conditions y(t0) = y0, y (t0) = y1 in the neighbourhood of t0 (read Boyce and DiPrima for more details).

Homogeneous vs nonhomogeneous: If g(t) = 0 in eq.(37), it is homogeneous; otherwise, it is nonhomogeneous.

Linear operator and simplified expression for 2nd-order linear ODEs: Define a linear operator

d2 d L ≡ + p(t) + q(t) (38) dt2 dt such that d2y dy L[y] = + p(t) + q(t)y = y00 + p(t)y0 + q(t)y. (39) dt2 dt Thus, the 2nd-order linear ODE in eq.(37) is shortened to

L[y] = g(t). (40)

Theorem 3.1.1 Principle of superposition: If y1(t) and y2(t) are both solutions of the homo- geneous equation L[y] = 0, then a linear combination (superposition) of the two

y(t) = C1y1(t) + C2y2(t)

is also a solution of the equation, where C1,C2 are arbitrary constants.

39 Proof: y1 is a solution ⇒ L[y1] = 0. y2 is a solution ⇒ L[y2] = 0. Now, substitute in & reorganize L[C1y1 + C2y2] = C1L[y1] + C2L[y2] = C1 × 0 + C2 × 0 = 0, therefore, y(t) = C1y1 + C2y2 is also a solution.

Definition: linear dependence (LD) vs linear independence (LI). On a given interval I = (a, b), tow functions f(t) and g(t) are linearly dependent (LD) if

k1f(t) + k2g(t) = 0 (for all t ∈ I) can be satisfied by two constants k1 and k2 that are not both zero (i.e., one is the constant multiple of the other). Otherwise, if it is satisfied only when k1 = k2 = 0 (i.e., one is not the constant multiple of the other), then the two are linearly independent (LI).

Example 3.1.1: Determine whether the following pairs of functions are LI?

1. f(t) = e2t and g(t) = e−t.

2. f(t) = e3t and g(t) = e3(t+1).

Answer:

2t −t −t 3t 1. k1e + k2e = e [k1e + k2] = 0 if and only if (iff) k1 = k2 = 0. So, they are LI.

3 3t 3(t+1) 3 2.( −e )e + e = 0 for k1 = −e and k2 = 1, they are LD.

Later, we shall introduce a more straight forward method for verifying the linear independence of two functions.

Theorem 3.1.2 The general solution of L[y] = 0 is

y(t) = C1y1(t) + C2y2(t), (41) where C1,C2 are arbitrary constants, y1(t), y2(t) are two LI solutions of L[y] = 0 and are referred to as a fundamental set of solutions.

Remark: Based on this theorem, finding the general solution of L[y] = 0 is reduced to finding two LI solutions.

40 3.2 Homogeneous, 2nd-order, linear ODEs with constant coefficients

If in the homogeneous 2nd-order linear ODE L[y] = 0, both p(t) and q(t) are constants, the equation becomes an ODE with constant coefficients

ay00 + by0 + cy = 0, (42) where a (6= 0), b, c are constants.

Question: How to solve eq.(42)?

Surprising insight can be achieved by a verbal interpretation of eq.(42):

• Eq.(42) says a linear combination of y00, y0, y is equal to zero ⇐⇒

• y00, y0, y are LD on each other ⇐⇒

• y00, y0, y are constant multiples of each other ⇐⇒

• y00, y0, y only differ by a multiplicative factor ⇐⇒

• y00, y0, y are all exponential functions of the form ert.

Conclusion: For eq.(42), we always look for solutions of the form y(t) = ert.

Substitute y(t) = ert into eq.(42), we obtain

(ar2 + br + c)ert = 0 ⇐⇒ ar2 + br + c = 0, (43) often referred to as the characteristic equation of eq.(42).

The quadratic characteristic equation eq.(43) often yields two roots: √ −b ± b2 − 4ac r = . 1, 2 2a

r1t r2t Both y1 = e and y2 = e are solutions to eq.(42). If r1 6= r2, the two are LI and form a fundamental set. In this case the general solution to eq.(42) is

r1t r2t y(t) = c1y1 + c2y2 = c1e + c2e , (44)

where c1, c2 are arbitrary constants.

41 Example 3.2.1 Find the general solution of

y00 + 5y0 + 6y = 0.

Answer: Let y(t) = ert. Plug into the ODE, we obtain the following characteristic equation

r2 + 5r + 6 = 0 =⇒ (r + 3)(r + 2) = 0, which yields r1 = −3 and r2 = −2. Thus, both

r1t −3t r2t −2t y1(t) = e = e and y2(t) = e = e are solutions to the ODE and are LI of each other (because r1 6= r2). Thus, they form a fundamental set. The general solution is

−3t −2t y(t) = c1y1(t) + c2y2(t) = c1e + c2e .

Example 3.2.2 Solve the following IVP  4y00 − 8y0 + 3y = 0, 0 1 y(0) = 2, y (0) = 2 .

Answer: The characteristic equation is

4r2 − 8r + 3 = 0 which yields √ 8 ± 64 − 48 1 3 1 r = = 1 ± = , . 1, 2 8 2 2 2

Thus, the general solution is

3 t 1 t y(t) = c1e 2 + c2e 2 .

Using initial conditions

y(0) = 2 =⇒ c1 + c2 = 2;

1 3 1 1 y0(0) = =⇒ c + c = =⇒ 3c + c = 1. 2 2 1 2 2 2 1 2

1 5 Solve the two algebraic equations for c1 = − 2 , c2 = 2 . Therefore

42 1 3 t 5 1 t y(t) = − e 2 + e 2 . 2 2

Everything seems easy and moves smoothly until we encounter some suprprises.

Special case I: repeated roots.

Example 3.2.3 Find the general solution of

y00 − 4y0 + 4y = 0.

Answer: The characteristic equation is

r2 − 4r + 4 = 0 =⇒ (r − 2)2 = 0

which yields r = r1 = r2 = 2,

rt 2t This means that there is only one value r = 2 that allows y1(t) = e = e to satisfy the ODE. Without a second LI solution, we cannot write down the general solution!

Question: In this case, how can we find a 2nd LI solution y2(t)? How to find the general solution?

Answer: Reduction of order (Due to D’Alembert) The general solution can be expressed as y(t) = v(t)e2t (an educated guess!)

To determine the function v(t), we substitute the guessed solution into the ODE:

y0(t) = v0e2t + 2ve2t = (v0 + 2v)e2t. y00(t) = (v0 + 2v)e2t0 = (v00 + 4v0 + 4v)e2t.

Substitute y, y0, y00 into the ODE, we obtain

simplify [(v00 + 4v0 + 4v) − 4(v0 + 2v) + 4v] e2t = 0 =⇒ v00 = 0.

Thus, v(t) = c1 + c2t.

The general solution is:

2t 2t 2t 2t y(t) = v(t)e = (c1 + c2t)e = c1e + c2te .

43 2t 2t We notice that this general solution is a linear combination of two terms y1(t) = e and y2(t) = te . Indeed, we can easily verify that y2(t) is another solution of the ODE that is LI of y1(t).

00 0 Theorem 3.2.1 If the characteristic equation of ay + by + c = 0 yields repeated root r1 = r2 = r, then rt y1(t) = e is one solution and rt y2(t) = te is a second solution that is LI of y1(t). The two form a fundamental set of solutions.

Proof:

rt 2 We know y1(t) = e is a solution since r is the root of the characteristic equation ar + br + c = 0. The two roots are given by √ −b ± b2 − 4ac r = . 1, 2 2a 2 r1 = r2 only occurs when b − 4ac = 0 which yields −b r = r = r = =⇒ 2ar + b = 0. 1 2 2a Notice that: 0 rt0 rt rt rt y2(t) = te = e + rte = (1 + rt)e , 00 rt0 rt rt 2 rt y2 (t) = (1 + rt)e = re + (r(1 + rt)e = (2r + r t)e . Plug into the ODE: a(2r + r2t)ert + b(1 + rt)ert + ctert = 0, which simplifies to (ar2 + br + c)tert + (2ar + b)ert = 0.

rt Therefore, y2(t) = te is a solution. We shall learn a technique later to verify that it is LI of rt y1(t) = e .

Example 3.2.4 Solve the IVP  y00 + 6y0 + 9y = 0, y(0) = 3, y0(0) = −1.

2 2 Answer: Ch. eq. is r + 6r + 9 = 0 =⇒ (r + 3) = 0 =⇒ r = r1 = r2 = −3.

−3t −3t Based on Theorem 3.2.1, y1(t) = e and y2(t) = te form a fundamental set.

44 Thus, the general solution is −3t −3t y(t) = c1e + c2te . Its derivative is 0 −3t −3t −3t y (t) = −3c1e + c2e − 3c2te Using initial condition,

0 y(0) = 3 = c1, y (0) = −1 = −3c1 + c2 = −9 + c2,

which yield c1 = 3 and c2 = 8. Therefore, the solution to the IVP is

y(t) = 3e−3t + 8te−3t = (3 + 8t)e−3t.

Special case II: complex roots.

Example 3.2.5 Find the general solution of

y00 + 2y0 + 10y = 0.

Answer: Ch. eq. is r2 + 2r + 10 = 0 =⇒

√ −2 ± 4 − 40 √ √ r = = −1 ± 1 − 10 = −1 ± −9. 1, 2 2 No real-valued root!!!

Remark: We can no longer proceed without appropriate knowledge of complex numbers.

45 3.3 Introduction to complex numbers and Euler’s formula

3.3.1 Definitions and basic concepts

The imaginary number i: √ i ≡ −1 ⇐⇒ i2 = −1. (45)

Every imaginary number is expressed as a real-valued multiple of i: √ √ √ √ −9 = 9 −1 = 9i = 3i.

A : z = a + bi, (46) where a, b are real, is the sum of a real and an imaginary number.

The real part of z=a+bi: Re{z} = a is a .

The imaginary part of z=a+bi: Im{z} = b is a also a real number.

A complex number z=a+bi represents a point (a, b) in a 2D space, called the complex space.

Im{z}

z=a+bi b

Re{z} a

−b z=a−bi

Figure 7: A complex number z and its conjugatez ¯ in complex space. Horizontal axis contains all real numbers, vertical axis contains all imaginary numbers.

The of z=a+bi: isz ¯ = a − bi (i.e., reversing the sign of Im{z} changes z intoz ¯!)

Notice that: z +z ¯ z − z¯ Re{z} = = a, Im{z} = = b. 2 2i

46 3.3.2 Basic complex computations

Addition/subtraction: If z1 = a1 + b1i, z2 = a2 + b2i (a1, a2, b1, b2 are real), then

z1 ± z2 = (a1 + b1i) ± (a2 + b2i) = (a1 ± a2) + (b1 ± b2)i. Or, real parts plus/minus real parts, imaginary parts plus/minus imaginary parts.

Multiplication by a real number c:

cz1 = ca1 + cb1i.

Multiplication between complex numbers:

2 z1z2 = (a1 + b1i)(a2 + b2i) = a1a2 + a1b2i + a2b1i + b1b2i = (a1a2 − b1b2) + (a1b2 + a2b1)i. All rules are identical to those for multiplication between real numbers, just remember i2 = −1.

Length of a complex number z = a + bi √ √ |z| = zz¯ = p(a + bi)(a − bi) = a2 + b2, which is dentical to the length of a 2D vector (a, b).

Division between complex numbers:

z1 z1z¯2 (a1 + b1i)(a2 − b2i) (a1a2 + b1b2) − (a1b2 + a2b1)i = = 2 = 2 2 . z2 z2z¯2 |z2| a2 + b2

Example 3.3.1: Given that z1 = 3 + 4i, z2 = 1 − 2i, calculate

1. z1 − z2;

z1 2. 2 ;

3. |z1|;

4. z2 . z1

Answer:

1. z1 − z2 = (3 − 1) + (4 − (−2))i = 2 + 6i;

z1 3 4 2. 2 = 2 + 2 i = 1.5 + 2i; √ √ √ 2 2 3. |z1| = z1z¯1 = 3 + 4 = 25 = 5;

z2 z2z¯1 (1−2i)(3−4i) 11−10i 11 2 4. = = 2 = = − i. z1 z1z¯1 5 25 25 5

47 3.3.3 Back to Example 3.2.5

Example 3.2.5 Find the general solution of

y00 + 2y0 + 10y = 0.

Answer: Ch. eq. is r2 + 2r + 10 = 0 =⇒ √ −2 ± 4 − 40 √ √ r = = −1 ± 1 − 10 = −1 ± −9 = −1 ± 3i. 1, 2 2

Since r1 6= r2 (actually r1 =r ¯2, i.e. they are a pair of complex conjugates), the general solution is

r1t r2t (−1+3i)t (−1−3i)t −t 3it −3it y(t) = c1e + c2e = c1e + c2e = e [c1e + c2e ].

Remarks:

• The solution contains exponential functions with complex-valued exponents.

• The ODE is real-valued and models a spring-mass problem.

• The solution should also be real-valued and with clear physical meanings.

Question: How does e3it relate to real-valued functions?

48 3.3.4 Complex-valued exponential and Euler’s formula

Euler’s formula: eit = cos t + i sin t. (47)

Based on this formula and that e−it = cos(−t) + i sin(−t) = cos t − i sin t:

eit + e−it eit − e−it cos t = , sin t = . (48) 2 2i

Why? Here is a way to gain insight into this formula.

Recall the Taylor series of et: ∞ X tn et = . n! n=0

We assume that this series holds when the exponent is complex-valued.

∞ ∞ ∞ ∞ ∞ X (it)n X (it)n X (it)n X (it)2m X (it)2m+1 eit = = + = + n! n! n! (2m)! (2m + 1)! n=0 n even n odd m=0 m=0

∞ ∞ ∞ ∞ X i2mt2m X i2m+1t2m+1 X (i2)mt2m X i(i2)mt2m+1 = + = + (2m)! (2m + 1)! (2m)! (2m + 1)! m=0 m=0 m=0 m=0

∞ ∞ X (−1)mt2m X (−1)mt2m+1 = + i = cos t + i sin t. (2m)! (2m + 1)! m=0 m=0

49 3.3.5 Back again to Example 3.2.5

Example 3.2.5 Find the general solution of

y00 + 2y0 + 10y = 0.

Answer: Ch. eq. is r2 + 2r + 10 = 0 =⇒ √ −2 ± 4 − 40 √ √ r = = −1 ± 1 − 10 = −1 ± −9 = −1 ± 3i. 1, 2 2

Since r1 6= r2 (actually r1 =r ¯2, i.e. they are a pair of complex conjugates), the general solution is

r1t r2t (−1+3i)t (−1−3i)t −t 3it −3it y(t) = c1e + c2e = c1e + c2e = e [c1e + c2e ].

Using Euler’s formula

e(−1+3i)t = e−t−3it = e−te3it = e−t[cos 3t + i sin 3t].

We now demonstrate that the two real-valued functions

(−1+3i)t −t (−1+3i)t −t y1(t) = Re{e } = e cos 3t and y2(t) = Im{e } = e sin 3t

are also solutions to the ODE and they are LI.

Let’s verify y1(t) only (the verification of y2(t) is very similar).

0  −t 0 −t −t −t y1(t) = e cos 3t = −e cos 3t − 3e sin 3t = −e [cos 3t + 3 sin 3t];

00 −t −t −t y1 (t) = e [cos 3t + 3 sin 3t] − e [−3 sin 3t + 9 cos 3t] = e [−8 cos 3t + 6 sin 3t]. Substitute into the ODE, we obtain

e−t[−8 cos 3t + 6 sin 3t] − 2e−t[cos 3t + 3 sin 3t] + 10e−t cos 3t = 0, which shows that y1(t) is indeed a real-valued solution. Similarly, y2(t) is also a solution. We shall demonstrate later that they are LI. Thus, the real-valued general solution is:

−t −t y(t) = c1e cos 3t + c2e sin 3t.

50 Theorem 3.3.1 If the characteristic equation of the ODE ay00 + by0 + cy = 0 (a, b, c are constants) yields a pair of complex conjugates r, r¯ = α ± βi (complex-valued roots alway occur in pairs of conjugates), then rt (α+βi)t rt¯ (α−βi)t yc(t) = e = e andy ¯c(t) = e = e form a fundamental set of complex-valued solutions (complex-valued solutions are also conjugates of each other). 1 1 y (t) = Re{y } = (y +y ¯ ) = eαt cos(βt) and y (t) = Im{y } = (y − y¯ ) = eαt sin(βt) 1 c 2 c c 2 c 2i c c form a fundamental set of real-valued solutions.

Proof: yc(t) andy ¯c(t) are obviously solutions to the ODE since r andr ¯ are roots of the character- istic equation. Later we shall demonstrate using Wronskian that they are indeed LI.

Since y1(t) and y2(t) are both linear combinations of yc(t) andy ¯c(t). Based on the Principle of Superposition, they must also be solutions of the ODE. We shall demonstrate later that they are LI.

51 3.3.6 One more example

Example 3.2.5 Solve the IVP  y00 + 4y0 + 13y = 0, y(0) = 2, y0(0) = −3.

Answer: Ch. eq. is r2 + 4r + 13 = 0 =⇒ √ −4 ± 16 − 52 √ √ r = = −2 ± −9 = −2 ± −9 = −2 ± 3i. 1, 2 2

Therefore, (−2+3i)t −2t 3it −2t yc(t) = e = e e = e [cos 3t + i sin 3t]. is the complex-valued solution. Thus,

−2t −2t y1(t) = Re{yc(t)} = e cos 3t, y2(t) = Im{yc(t)} = e sin 3t form a fundamental set. So, the real-valued general solution is

−2t −2t −2t y(t) = c1e cos 3t + c2e sin 3t = e [c1 cos 3t + c2 sin 3t].

Using initial condition y(0) = 2, we obtain c1 = 2. Note that,

0 −2t −2t y (t) = −2e [c1 cos 3t + c2 sin 3t] + e [−3c1 sin 3t + 3c2 cos 3t].

0 1 The initial condition y (0) = −3 yields −3 = −2c1 + 3c2 ⇒ c2 = 3 .

The solution to the IVP is 1 y(t) = e−2t[2 cos 3t + sin 3t]. 3

52 3.4 Applications: mechanical and electrical vibrations

3.4.1 Harmonic vibration of a spring-mass system in frictionless medium

Consider the spring-mass system in frictionless medium as shown in Fig. 8. u = 0 represents the equilibrium position where the spring length is equal to its unstressed natural length. Let the spring constant be k (> 0), which measures the hardness of the spring. Assume that the spring obeys Hook’s law: F = −ku, where u the displacement of the mass w.r.t. the equilibrium position. 1. Find the general solutions. (a) u(0) = u0, u(0) = 0 (initial displacement but no initial speed); 0 (b) u(0) = 0, u (0) = v0 (initial speed but no initial displacement); 0 (c) u(0) = u0, u (0) = v0 (both initial displacement and speed).

0 u(t)

m

Figure 8: Spring-mass system in frictionless medium giving rise to sustained harmonic oscillations.

Answer: Based on Newton’s second law, k mu00 = F =⇒ mu00 = −ku =⇒ u00 + u = 0 =⇒ u00 + ω2u = 0, m 0

q k where ω0 = m is often referred to as the intrinsic frequency of the system.

The characteristic equation is q 2 2 2 2 2 r + ω0 = 0 =⇒ r = −ω0 =⇒ r1, 2 = ± −ω0 = ±ω0i.

Thus, a complex-valued solution is:

ω0it yc(t) = e = cos(ω0t) + i sin(ω0t).

53 Therefore, y1(t) = Re{yc(t)} = cos(ω0t), y2(t) = Im{yc(t)} = sin(ω0t)

form a fundamental set of real-valued solutions. Thus,

y(t) = c1y1(t) + c2y2(t) = c1 cos(ω0t) + c2 sin(ω0t).

Notice that 0 y (t) = −c1ω0 sin(ω0t) + c2ω0 cos(ω0t).

For initial conditions (a):

0 y(0) = u0 =⇒ c1 = u0; y (0) = 0 =⇒ c2 = 0.

Thus, y(t) = u0 cos(ω0t).

For initial conditions (b):

0 v0 y(0) = 0 =⇒ c1 = 0; y (0) = v0 =⇒ c2 = . ω0

Thus, v0 y(t) = sin(ω0t). ω0

For initial conditions (c):

0 v0 y(0) = u0 =⇒ c1 = u0; y (0) = v0 =⇒ c2 = . ω0

54 Thus, v0 y(t) = u0 cos(ω0t) + sin(ω0t). ω0

Question: How does this solution relate to a single sin or cos function?

Using the following trig-identity

cos(α − β) = cos α cos β + sin α sin β, combined with the following triangle of the coefficients,

2 v 0 ω0 2 + u 0 v0 A = ω0 φ u0

Figure 9: Triangle of the coefficients.

we can turn the solution

 v0  v0 u0 ω0 y(t) = u0 cos(ω0t) + sin(ω0t) = A cos(ω0t) + sin(ω0t) ω0 A A

= A [cos(ω0t) cos φ + sin(ω0t) sin φ] = A cos(ω0t − φ),

where s  2 v0 2 v0 −1 ω0 −1 v0 A = u0 + , φ = tan = tan . ω0 u0 u0ω0

55 Here are a few important concepts related to harmonic oscillations:

• A = amplitude. −A ≤ y(t) ≤ A for all t.

• A depends on both initial displacement u0 and initial speed v0. If v0 = 0, A = u0; if u0 = 0, A = v0 . ω0 • φ is the initial phase, which is determined by initial conditions. p • The angular frequency (in rad/s) is: ω0 = k/m.

ω0 • The frequency (in Hz) is: f0 = 2π . 1 2π p m • Period (in s) is: T0 = = = 2π . f0 ω0 k

56 3.4.2 Spring-mass-damper system: a simple model of suspension systems

See Fig. 10. A mass m is supported by a Hookian spring with a spring constant k. The damper provides a damping force that is proportional to the speed with a damping constant γ. All constants are positive valued. At equilibrium, the length of the spring is shrunk by s, i.e. ks = mg. This equilibrium position is chosen to be y = 0.

1. Write down the ODE that describes the motion of the mass.

2. Find the general solution.

3. Characterize the properties of the motion under three damping conditions: (a) Over damped; (b) Critically damped; (c) Under damped.

y(t) m s=mg/k 0

Figure 10: Simplified quarter car model.

Answer: Based on Newton’s second law,

my00 = F =⇒ my00 = −mg − k(y − s) − γy0 =⇒ my00 = −ky − γy0, where condition sk = mg was used. This results in

my00 + γy0 + ky = 0, (49) which is a homogeneous, 2nd-order, linear ODE with constant coefficients.

The ch. eq. is given by mr2 + γr + k = 0,

57 which yields −γ ± pγ2 − 4mk γ h √ i r = = −1 ± δ , (50) 1, 2 2m 2m where 4mk δ = 1 − . γ2

(1) Over damped condition: When damping is big, γ2 > 4mk such that

4mk h √ i 0 < δ = 1 − < 1 =⇒ −1 ± δ < 0. γ2

Under this condition, r1 6= r2 and r1, r2 < 0. The general solution is

r1t r2t t−→∞ y(t) = c1e + c2e −→ 0, (51)

which means the displacement is damped to zero exponentially irrespective of initial conditions.

Figure 11: Over damped solutions for three different initial conditions.

58 (2) Critically damped condition: This happens when γ2 = 4mk such that δ = 0.

Now, we have repeated root for the ch. eq. γ r = r = r = − . 1 2 2m

Under this condition, the general solution is

rt − γ t t−→∞ y(t) = [c1 + c2t]e = [c1 + c2t]e 2m −→ 0. (52)

Now the decay to zero is often slower than a simple exponential function because of the term − γ t c2te 2m .

Figure 12: Critically damped solutions for three different initial conditions.

(3) Under damped condition: This occurs when γ2 < 4mk such that δ < 0. Now, the ch. eq. gives a pair of complex roots. γ h √ i γ h √ i γ r, r¯ = −1 ± δ = −1 ± i −δ = − ± ωi, 2m 2m 2m where s r r r γ √ γ 4mk k γ2 k γ2  γ2  ω = −δ = − 1 = − = 1 − = ω 1 − + ··· 2m 2m γ2 m 4m2 m 4mk 0 8mk

59 where r k ω ≡ 0 m is the intrinsic frequency of the harmonic oscillator for γ = 0 (i.e., in frictionless medium). Note that, ω < ω0. Now, the general solution is

− γ t − γ t y(t) = e 2m [c1 cos(ωt) + c2 sin(ωt)] = Ae 2m cos(ωt − φ), where q 2 2 −1 c2 A = c1 + c2, φ = tan . c1

When the long term behaviour is concerned,

− γ t t−→∞ y(t) = Ae 2m cos(ωt − φ) −→ 0.

where ω is referred to as the quasi-frequency since the vibration is not exactly periodic.

Figure 13: Under damped solution for one set of initial conditions.

Conclusion: In the presence of friction the motion of the mass will eventually stop under all con- ditions, but the approach to equilibrium is different. In under damped condition, the approach is oscillatory with exponentially decreasing amplitude.

60 Example 3.4.1: In a spring-mass-damper system, m = 2 kg. The spring is known to give a force of Fs = 3 N when stretched/compressed by l = 10 cm. The damper is known to provide a drag force of Fd = 3 N at a speed of vd = 5 m/s. Let y(t) be the displacement of the mass w.r.t. the equilibrium position at time t. Initial conditions are: y(0) = 5 cm, y0(0) = 10 cm/s. 1. Find y(t). 2. If the motion is under damped, find the ratio between the quasi-frequency of the motion and its intrinsic frequency, ω =? ω0

Answer: First, we need to unify the units by adopting the m − kg − s system. l = 0.1 m, y(0) = 0.05 m, y0(0) = 0.1 m/s.

The spring constant is obtained by solving Fs = kl, F 3 k = s = = 30 (N/m). l 0.1

The damping coefficient is obtained by solving Fd = γvd, F 3 γ = d = = 0.6 (sN/m). vd 5

The ODE that describes our spring-mass-damper system is my00 + γy0 + ky = 0 =⇒ 2y00 + 0.6y0 + 30y = 0.

Roots for the corresponding ch. eq. are: √ −0.6 ± 0.36 − 240 r , r = = −0.15 ± 3.87008i. 1 2 4 Thus, the quasi-frequency is ω = 3.87008. It is obviously under damped, with the following general solution −0.15t y(t) = e [c1 cos(3.87008t) + c2 sin(3.87008t)] .

Using initial condition, we obtain

0 y(0) = 0.05 =⇒ c1 = 0.05; y (0) = 0.1 =⇒ c2 = 0.02778.

Therefore, y(t) = e−0.15t [0.05 cos(3.87008t) + 0.2778 sin(3.87008t)] .

The ratio between the two frequencies is ω 3.87008 3.87008 3.87008 3.87008 = q = q = √ ≈ ≈ 0.99925. ω0 k 30 15 3.87298 m 2

61 3.4.3 Oscillations in a RLC circuit

A typical RLC circuit is composed of a resistor (R), an inductor (L), a capacitor (C) combined with a power source E(t) and a switch (see Fig. 14).

R L

C

E(t)

Figure 14: A typical RLC circuit.

Let Q(t) = the amount of electric charge (measured in units of Coulomb) on each plate of the capacitor at time t. Then, dQ I = dt (measured in units of Amperes) is the current that flows through the circuit.

Voltage drop across a resistor with resistance R (measured in units of Ohm) is dQ V = RI = R (Ohm0s law). R dt

Voltage drop across a capacitor with capacitance C (measured in units of Faraday) is Q Q VC = (Definition of capacitance : C = ). C VC

Voltage drop across an inductor with inductance L (measured in units of Henry) is dI d2Q V = L = L (Definition of inductance). L dt dt2

Kirchhoff’s 2nd law: In a closed RLC circuit, the impressed voltage is equal to the sum of voltage drops across all elements in the circuit.

Thus, 1 V + V + V = E(t) =⇒ LQ00 + RQ0 + Q = E(t). (53) L R C C

62 When the impressed voltage E(t) is turned to zero, the equation becomes homogeneous 1 LQ00 + RQ0 + Q = 0. (54) C

dQ 0 Interestingly, if we differentiate both sides w.r.t t and remembering that dt = Q = I, we obtain 1 LI00 + RI0 + I = 0. C Therefore, the current I(t) obeys the same ODE as the charge Q(t).

Mathematically, this equation is identical to that of the spring-mass-damper system. Now, • Charge/current plays the role of displacement: Q(t),I(t) ↔ y(t); • Inductor plays the role of the load/mass: L ↔ m; • Resistor plays the role of the damper (dissipation of energy): R ↔ γ;

1 • Capacitor plays the role of the spring (storage of energy): C ↔ k.

In the absence of resistor: R = 0, the circuit is reduced to an LC circuit which gives rise to harmonic oscillations 1 1 LQ00 + Q = 0 =⇒ Q00 + Q = 0 =⇒ Q00 + ω2Q = 0, C LC 0 where the intrinsic frequency is 1 ω0 = √ . (55) LC

In the presence of resistor: The ch. eq. yields the following roots q 2 4L " r # −R ± R − C R 4L r , r = = − 1 ± 1 − . (56) 1 2 2L 2L CR2

4L Over, critical, and under damped conditions can occur depending on magnitude of the term CR2 .

In under damped condition, the roots are " r # R 4L R r , r = − 1 ± i − 1 = − ± iω, 1 2 2L CR2 2L

where the quasi-frequency ω is r 1 CR2 CR2 ω = √ 1 − = ω0(1 − + ··· ). (57) LC 4L 8L

63 Example 3.4.2: Consider a RLC circuit with C = 10−5 F , R = 200 Ω, L = 0.5 H with initial −6 0 −4 conditions: Q(0) = Q0 = 10 C, Q (0) = I0 = −2 × 10 A.

1. Find ω0 (i.e. the vibration frequency when R = 0.) 2. Find Q(t), and determine its long time behaviour.

3. Determine if the system is over, critical, or under damped.

Answer:

1. 1 1 −1 ω0 = √ = √ ≈ 447.2 s LC 0.5 × 10−5

2 1 2. The roots to the ch. eq. Lr + Rr + C = 0 are q 2 4L −R ± R − C √ √ r , r = = −200 ± 40000 − 200000 = −200 ± −160000 = −200 ± 400i, 1 2 2L

where the quasi-freqyency ω = 400 < ω0. So, the general solution is

−200t Q(t) = e [c1 cos(400t) + c2 sin(400t)].

Using initial conditions,

−6 −6 0 −4 Q(0) = 10 =⇒ c1 = 10 ; Q (0) = −2 × 10 =⇒ c2 = 0.

Therefore, Q(t) = 10−6e−200t cos(400t) t−→→∞ 0.

3. The system is under damped.

64 3.5 Linear independence, Wronskian, and fundamental solutions

r1t r2t Theorem 3.5.1: If r1 6= r2, then y1(t) = e , y2(t) = e are two linearly independent functions.

Proof: The goal is to show that r1t r2t k1e + k2e = 0 is satisfied only when k1 = k2 = 0.

Pick two arbitrary points in t: t0 and t1 (t0 6= t1).

Substitute each value of t into the equation above:

 r1t0 r2t0 k1e + k2e = 0, r1t1 r2t1 k1e + k2e = 0.

Question: what are k1, k2 that satisfy both equations?

Turn this system of algebraic equations in matrix form:

 r1t0 r2t0      e e k1 0 ~ r1t1 r2t1 = =⇒ A~x = 0, (58) e e k2 0 where  r1t0 r2t0      e e k1 ~ 0 A = r1t1 r2t1 , ~x = , 0 = . e e k2 0

Based on 1. If det A 6= 0, then A is invertible, ~x = A−1~0 = ~0 is the only solutions. 2. If det A = 0, then A is not invertible, there exist infinitely many solutions ~x 6= ~0.

Let’s evaluate det A:

r1t0 r2t0 e e r t r t r t r t r t +r t r t +r t det A = = e 1 0 e 2 1 − e 2 0 e 1 1 = e 1 0 2 1 − e 2 0 1 1 er1t1 er2t1

= er1t0+r2t1 [1 − er2t0+r1t1−(r1t0+r2t1)] = er1t0+r2t1 [1 − e(r2−r1)(t0−t1)] 6= 0, because r1 6= r2, t0 6= t1. Therefore,  k   0  ~x = 1 = k2 0

r1t r2t is the only possible solution for arbitrary choices of t0 and t1 (t0 6= t1). Thus, e and e are LI provided r1 6= r2.

65 Theorem 3.5.2 Wronskian and LI: If f(t), g(t) are differentiable functions in an open interval I, the Wronskian of the two is defined by

f g 0 0 W [f, g](t) = = fg − f g. f 0 g0

If W [f, g](t) 6= 0 for some t = t0 ∈ I, then f and g are LI in I.

Often, if W [f, g](t) = 0 for every t ∈ I, then f and g are LD. This result should be used with caution although it applies to almost all cases that we encounter in this course. However, there has been controversy and counter examples on this result. For example, it was reported that Peano pointed out (1889) that f(t) = t2 and g(t) = |t|t are both differentiable. But

W [t2, |t|t] = t2(|t|t)0 − (t2)0|t|t = t2(2|t|) − 2t|t|t = 0 for all t!

It is true that they are LD on (−∞, 0) and (0, ∞) because they are constant multiples of each other. However, in any open interval containing t = 0, e.g. (−a, a)(a > 0), they are LI. A number of other conditions should be satisfied to ensure that vanishing Wronskian means linear dependence.

Proof: Start with the equation k1f + k2g = 0. Differentiate both sides, we obtain 0 0 k1f + k2g = 0. The two form a system of algebraic equations  k1f + k2g = 0, 0 0 k1f + k2g = 0.

Evaluate the of its coefficient matrix

f g 0 0 det A = = fg − f g = W [f, g](t). f 0 g0

Thus, W [f, g](t) 6= 0 for any one t = t0 ∈ I, k1 = k2 = 0 is the only solution. Then, f and g are LI in I.

00 0 rt Example 3.5.1: When repeated roots occur, the ODE ay +by +cy = 0 has two solutions y1 = e , rt y2 = te . Use Wronskian to show that they are LI.

Answer: 0 0 rt rt rt rt rt 2rt W [y1, y2](t) = y1y2 − y1y2 = e (e + rte ) − re te = e 6= 0.

Thus, y1 and y2 are LI.

66 Example 3.5.2: When complex-valued roots occur, the ODE ay00 +by0 +cy = 0 has two real-valued rt rt solutions y1 = e cos ωt, y2 = e sin ωt. Use Wronskian to show that they are LI.

Answer:

0 0 rt rt rt rt rt rt W [y1, y2](t) = y1y2 − y1y2 = e cos ωt[re sin ωt + ωe cos ωt] − e sin ωt[re cos ωt − ωe sin ωt]

= ωe2rt[cos2 ωt + sin2 ωt] = ωe2rt 6= 0 for all t.

Thus, y1 and y2 are LI.

67 Wronskian of two solutions of L[y] = 0 can be calculated BEFORE they are solved!

Theorem 3.5.3 (Abel’s theorem): If y1(t), y2(t) are two solutions of the following ODE

L[y] = y00 + p(t)y0 + q(t)y = 0,

where p(t), q(t) are continuous in an open interval I, then the Wronskian between the two is totally determined by p(t)(even before the solutions are found!)

− R p(t)dt W [y1, y2](t) = Ce ,

where C is a constant that depends on y1, y2 but not on t. If p(t) = p0 = const., then W [y1, y2](t) = −p0t Ce . In this case, only two possibilities can occur: If y1, y2 are two solutions of L[y] = 0 (where d2 d L = dt2 + p0 dt + q0 (p0, q0 are constants)), then (i) W [y1, y2](t) 6= 0 for all t (when they are LI); (ii) W [y1, y2](t) = 0 for all t (when they are LD). In this case, It is impossible for W [y1, y2](t) to be zero for some values of t but not for other values of t! W [y1, y2](t) 6= 0 when y1(t), y2(t) are LI and form a fundamental set of solutions.

Proof: 00 0 y1 is a solution =⇒ y1 + p(t)y1 + q(t)y1 = 0. (a) 00 0 y2 is a solution =⇒ y2 + p(t)y2 + q(t)y2 = 0. (b) 00 0 y1 × (b) =⇒ y1y2 + p(t)y1y2 + q(t)y1y2 = 0, (I) 00 0 (a) × y2 =⇒ y1 y2 + p(t)y1y2 + q(t)y1y2 = 0. (II)

Do subtraction (I) − (II):

00 00 0 0 [y1y2 − y1 y2] + p(t)[y1y2 − y1y2] = 0. (c)

Note that: 0 0 W ≡ W [y1, y2](t) = y1y2 − y1y2, 0 0 0 0 0 0 00 00 0 0 00 00 W = [y1y2 − y1y2] = y1y2 + y1y2 − y1 y2 − y1y2 = y1y2 − y1 y2.

Substitute into eq.(c), we obtain

dW W 0 + p(t)W = 0 =⇒ W 0 = −p(t)W =⇒ = −p(t)dt W

Z dW Z Z R = −p(t)dt =⇒ ln W = − p(t)dt + C =⇒ W = Ce− p(t)dt. W 1

68 Example 3.5.3: If p(t) is differentiable and p(t) > 0, then for two solutions y1(t), y2(t) of the following ODE [p(t)y0]0 + q(t)y = 0, the Wronskian C W [y , y ](t) = . 1 2 p(t) Answer: Rewrite the ODE into the ‘normal’ form

p0(t) q(t) [p(t)y0]0 + q(t)y = p(t)y00 + p0(t)y0 + q(t)y = 0 =⇒ y00 + y0 + y = 0. p(t) p(t)

Apply Abel’s theorem:

0 R p (t) dp − dt − R − ln p C C W [y , y ](t) = Ce p(t) = Ce p = Ce = = . 1 2 eln p p

Theorem 3.5.4 (Uniqueness of solution): Suppose that y1(t), y2(t) are solutions of

L[y] = y00 + p(t)y0 + q(t)y = 0, and that the Wronskian 0 0 W [y1, y2](t) = y1y2 − y1y2, is non-zero at t = t0 where the initial conditions

0 0 y(t0) = y0, y (t0) = y0 are assigned. There exists a unique choice of c1, c2 for which

y(t) = c1y1(t) + c2y2(t) is the unique solution of the IVP above.

Proof: Based on Principle of Superposition

y(t) = c1y1(t) + c2y2(t) is a solution of the ODE. To determine the values of c1, c2, we use ICs:

y(t0) = y0 =⇒ c1y1(t0) + c2y2(t0) = y0,

0 0 0 0 0 y (t0) = y0 =⇒ c1y1(t0) + c2y2(t0) = y0.

69 Turn this system in matrix form:       y1(t0) y2(t0) c1 y0 ~ 0 0 = 0 =⇒ A~x = b. y1(t0) y2(t0) c2 y0

Since y1(t0) y2(t0) det A = 0 0 = W [y1, y2](t0) 6= 0, y1(t0) y2(t0) there exists a unique solution ~x = A−1~b which can be expressed as

1 y0 y2(t0) 1 y1(t0) y0 c1 = 0 0 , c2 = 0 0 det A y0 y2(t0) det A y1(t0) y0 based on Cramer’s rule from linear algebra.

70 Example 3.5.4: For the following ODEs:

(a) y00 + ω2y = 0,

(b) y00 − ω2y = 0.

Find a fundamental set of real-valued solutions y1(t), y2(t) that satisfies

(i) y1(0) = 1, y2(0) = 0;

0 0 (ii) y1(0) = 0, y2(0) = 1.

Answer:

00 2 2 2 iωt (a) y + ω y = 0 =⇒ ch. eq. r + ω = 0 =⇒ r1, 2 = ±ωi =⇒ yc(t) = e = cos ωt + i sin ωt. Therefore, y1(t) = Re{yc(t)} = cos ωt, y2(t) = Im{yc(t)} = sin ωt 0 0 form a fundamental set. It is easy to verify that y1(0) = 1, y2(0) = 0, and y1(0) = 0, y2(0) = ω. 0 To make y2(0) = 1, we choose −1 y2(t) = ω sin ωt,

while leaving y1(t) as expressed above.

00 2 2 2 (b) y − ω y = 0 =⇒ ch. eq. r − ω = 0 =⇒ r1, 2 = ±ω. r1 6= r2 are both real. Therefore

ωt −ωt yi(t) = e , yii(t) = e

0 0 form a fundamental set. But yi(0) = yii(0) = 1, yi(0) = −yii(0) = ω. They do not satisfy the initial conditions listed above.

Introduce two new functions: hyperbolic and hyperbolic cosine 1 1 sinh ωt = [eωt − e−ωt], cosh ωt = [eωt + e−ωt]. (59) 2 2

Notice that both are linear combinations of yi(t) and yii(t).

We notice the striking similarity between these definitions and those of sine and cosine: 1 1 sin ωt = [eiωt − e−iωt], cos ωt = [eiωt + e−iωt]. 2i 2

71 1 x −x 1 x −x Figure 15: Graphs of sinh x = 2 (e − e ) (purple) and cosh x = 2 (e + e ) (green) .

Now, y1(t) = cosh ωt, y2(t) = sinh ωt also form a fundamental set since both are also solutions of the ODE based on the Principle of Superposition.

Catenary: The shape of the curve of cosh(ax) is often referred to as as catenary - the curve that an idealized hanging chain or cable assumes under its own weight when supported only at its ends. To learn more about catenary check here: http://en.wikipedia.org/wiki/Catenary.

Figure 16: A hanging chain with short links forms a catenary.

72 More similarities between hyperbolic trig and trig functions (not a complete list):

• sinh ωt is odd, cosh ωt is even. • sinh(0) = 0, cosh(0) = 1. • sinh0 ωt = ω cosh ωt , cosh0 ωt = ω sinh ωt (no change in sign!) • cosh2 ωt − sinh2 ωt = 1 (subtraction not addition!) • tanh ωt = sinh ωt/ cosh ωt.

For a fundamental set of y00 − ω2y = 0 that satisfies the above listed conditions, we choose

−1 y1(t) = cosh ωt, y2(t) = ω sinh ωt.

0 0 It is easy to check that y1(0) = 1, y2(0) = 0 and y1(0) = 0, y2(0) = 1.

73 Example 3.5.5: Some advantage of using the hyperbolic trig functions as fundamental set. For the ODE 4y00 − y = 0.

(a) Find the general solution expressed in terms of exponential functions.

(b) Find the general solution expressed in terms of hyperbolic trig functions obeying the conditions in Example 3.5.4.

(c) In each case, determine the constants by using the ICs: y(0) = 1, y0(0) = −1.

00 1 2 1 1 Answer: In ‘normal’ form, the ODE reads y − 4 y = 0 ⇒ ch. eq.: r − 4 = 0 ⇒ r1, r2 = ± 2 = ±ω. (a) The general solution expressed in terms of exponential functions:

1 t − 1 t y(t) = c1e 2 + c2e 2 . (a)

(b) The general solution expressed in terms of hyperbolic trig functions: 1 1 y(t) = c cosh(ωt) + c ω−1 sinh(ωt) = c cosh( t) + 2c sinh( t). (b) 1 2 1 2 2 2

(c) Using ICs in solution (a), we obtain 1 1 y(0) = 1 = c + c , y0(0) = −1 = c − c . 1 2 2 1 2 2

1 3 Solve this system, we obtain c1 = − 2 and c2 = 2 . Thus,

1 1 t 3 − 1 t y(t) = − e 2 + e 2 . (A) 2 2

Using ICs in solution (b), we obtain

0 y(0) = 1 = c1, y (0) = −1 = c2.

There is no need to solve an algebraic system for c1, c2! Therefore, 1 1 y(t) = cosh( t) − 2 sinh( t). (B) 2 2

It is easy to verify with a little bit algebra that (A) and (B) are identical but expressed in different forms.

74 Example 3.5.6: Solve the followin ODEs

(a) y00 + ω2y = 0,

(b) y00 − ω2y = 0, with the initial conditions: 0 y(t0) = A, y (t0) = B. Answer:

(a) The general solution expressed in terms of trig functions:

−1 y(t) = c1 cos ω(t − t0) + c2ω sin ω(t − t0), (a)

Using the ICs:

−1 0 y(t0) = c1 cos 0 + c2ω sin 0 = c1 = A, y (t0) = −ωc1 sin 0 + c2 cos 0 = c2 = B.

Therefore, −1 y(t) = A cos ω(t − t0) + Bω sin ω(t − t0).

(b) The general solution expressed in terms of hyperbolic trig functions:

−1 y(t) = c1 cosh ω(t − t0) + c2ω sinh ω(t − t0). (b)

Using the ICs

−1 0 y(t0) = c1 cosh 0 + c2ω sinh 0 = c1 = A, y (t0) = ωc1 sinh 0 + c2 cosh 0 = c2 = B.

Therefore, −1 y(t) = A cosh ω(t − t0) + Bω sinh ω(t − t0).

75 3.6 Nonhomogeneous, 2nd-order, linear ODEs

Nonhomogeneous linear 2nd-order ODEs of the form

L[y] = y00 + p(t)y0 + q(t)y = g(t), (60) where g(t) 6= 0 also occurs often in a wide variety of applied problems.

A model of suspension systems: When a car runs on bumpy roads, the suspension system undergoes a sustained oscillatory force. To model this situation, we consider a modified version of our quarter car model. See Fig. 17. For this system, the ODE becomes

00 0 my + γy + ky = Ff cos ωf t, (61) where Ff is the amplitude of the external forcing, ωf is the forcing frequency. Both Ff , ωf are supposed to be known constants.

ω f

y(t) m s=mg/k 0

Figure 17: Periodically forced spring-mass-damper system: a model of forced suspension systems.

76 A RLC circuit powered by an alternative voltage source: When a closed RCL circuit is powered by an alternative voltage source, See Fig. 18. For this system, the ODE becomes 1 LQ00 + RQ0 + Q = F cos ω t, (62) C f f where Ff is the amplitude of the external forcing, ωf is the forcing frequency. Both Ff , ωf are supposed to be known constants.

R L

C

ω E(t)=Ff cos f t

Figure 18: Periodically forced RLC circuit

77 Questions : How to solve these nonhomogeneous ODEs?

Theorem 3.6.1: If Y1 and Y2 are solutions of the nonhomogeneous ODE L[y] = g(t), then the difference between the two Y1 − Y2 is a solution of the homogeneous ODE L[y] = 0.

Y1 − Y2 = c1y1 + c2y2 where y1, y2 form a fundamental set of L[y] = 0, c1, c2 are constants.

Proof: Since L[Y1] = g(t), L[Y2] = g(t), and remember L is linear

L[Y1 − Y2] = L[Y1] − L[Y2] = g(t) − g(t) = 0.

This means that Y1 − Y2 is a solution of L[y] = 0. Any solution of L[y] = 0 can be expressed as

c1y1 + c2y2 provided y1, y2 form a fundamental set.

Theorem 3.6.2 Solution structure of L[y] = g(t): The general solution of L[y] = g(t) can be expressed in the following form

y(t) = c1y1 + c2y2 + Y (t) = yh(t) + yp(t) where y1, y2 form a fundamental set of L[y] = 0, c1, c2 are arbitrary constants, yh(t) = c1y1 + c2y2 is the general solution of the corresponding homogeneous ODE L[y] = 0 (h for homogeneous), yp(t) = Y (t) is one particular solution of L[y] = g(t)(p for particular).

Proof: Follow theorem 3.6.1, treating y(t) as Y1 and Y (t) as Y2.

Remark: The general solution of L[y] = g(t) is the sum of the general solution yh(t) of the ho- mogeneous ODE L[y] = 0 and a particular solution yp(t) of L[y] = g(t). We know how to solve yh(t).

78 Question: How to find one yp(t)? (Usually takes more time and effort to solve than yh(t)!).

3.6.1 Method 1: Undetermined coefficients

Basic idea: Based on the nature of g(t), we generate an educated guess of yp(t), leaving some constants to be determined by plugging it into the ODE.

Example 3.6.1: Find one particular solution yp(t) for

2y00 + 3y0 + y = t2.

2 Answer: For this example, g(t) = t is a 2nd degree polynomial. It is natural to assume that yp(t) is also a polynomial of degree 2: 2 yp(t) = At + Bt + C, where A, B, C are coefficients to be determined.

Notice that 0 00 yp(t) = 2At + B, yp (t) = 2A. 00 0 Substitute yp (t), yp(t), yp(t) into the ODE, we obtain

2(2A) + 3(2At + B) + At2 + Bt + C = t2 =⇒

At2 + (6A + B)t + (4A + 3B + C) = t2. Coefficients of equal power of t should be identical on both sides:

A = 1;

6A + B = 0 =⇒ B = −6A = −6; 4A + 3B + C = 0 =⇒ C = −4A − 3B = −4 + 18 = 14. Therefore, 2 yp(t) = t − 6t + 14, is one particular solution.

Example 3.6.2: Find one particular solution yp(t) for

2y00 + 3y0 + y = 3 sin t.

79 Answer: An educated guess is: yp(t) = A cos t + B sin t. Note that

0 yp(t) = −A sin t + B cos t,

00 yp (t) = −A cos t − B sin t.

00 0 Substitute yp (t), yp(t), yp(t) into the ODE:

lhs = 2(−A cos t − B sin t) + 3(−A sin t + B cos t) + A cos t + B sin t = (3B − A) cos t − (B + 3A) sin t

rhs = 3 sin t.

Coefficients on both sides must be identical: 9 3 3B − A = 0, −(B + 3A) = 3 =⇒ A = 3B = − ,B = − . 10 10 Therefore, 3 y (t) = − [3 cos t + sin t] . p 10

Example 3.6.3: Find the general solution for

2y00 + 3y0 + y = t2 + 3 sin t.

Answer: Observation: g(t) = g1(t) + g2(t), 2 with g1(t) = t and g2(t) = 3 sin t, each was solved separately in the previous two examples.

80 Theorem 3.6.3 Principle of Superposition: For the nonhomogeneous ODE

L[y] = y00 + p(t)y0 + q(t)y = g(t).

If g(t) = g1(t) + g2(t), and that L[yp1] = g1(t),L[yp2] = g2(t), then yp(t) = yp1(t) + yp2(t) is a particular solution of L[y] = g(t).

Proof: Since L is linear ⇒

L[yp] = L[yp1 + yp2] = L[yp1] + L[yp2] = g1(t) + g2(t) = g(t).

Back to Example 3.6.3: Based on the Principle of Superposition and results from the two previous examples, a particular solution is: 3 y (t) = y (t) + y (t) = t2 − 6t + 14 − [3 cos t + sin t] . p p1 p2 10

2 1 To find yh(t), we solve the ch. eq.: 2r + 3r + 1 = 0 ⇒ r1 = − 2 , r2 = −1. Thus,

− 1 t −t yh(t) = c1e 2 + c2e .

The general solution is

− 1 t −t 2 3 y(t) = y (t) + y (t) = c e 2 + c e + t − 6t + 14 − [3 cos t + sin t] . h p 1 2 10

Notice that − 1 t −t t→∞ yh(t) = c1e 2 + c2e −→ 0!

Therefore, 3 y(t) = y (t) + y (t) t−→→∞ y (t) = t2 − 6t + 14 − [3 cos t + sin t] . h p p 10

81 yp cannot be identical to either solution in the fundamental set:

Example 3.6.3: Find the general solution for

2y00 + 3y0 + y = e−t.

Answer: The homogeneous part is identical to the previous example. Thus,

− 1 t −t yh(t) = c1e 2 + c2e .

Since g(t) = e−t, it seems reasonable to assume

−t yp(t) = Ae .

−t It is not Ok here!!! Because Ae is already contained in the second term of yh(t).

In this case, a correct educated guess is

−t yp(t) = Ate .

Notice that 0 −t −t −t yp(t) = Ae − Ate = A(1 − t)e , 00 −t −t −t yp (t) = −Ae − A(1 − t)e = A(−2 + t)e .

00 0 Substitute yp (t), yp(t), yp(t) into the ODE:

lhs = 2A(−2 + t)e−t + 3A(1 − t)e−t + Ate−t = −Ae−t = e−t = rhs =⇒ A = −1.

−t Thus, yp(t) = −te and the general solution is

− 1 t −t −t y(t) = yh(t) + yp(t) = c1e 2 + c2e − te .

82 A list of frequently encountered g(t) and the educated guess of yp(t):

Table 1: Educated guess of yp(t) for L[y] = g(t). Here, s = 0, 1, or 2 is the integer that ensures no term in yp(t) is identical to either terms of yh(t).

g(t) yp(t)

n n−1 s n n−1 Pn(t) = a0t + a1t + ··· + an−1t + an t (A0t + A1t + ··· + An−1t + An)

αt s n n−1 αt Pn(t)e t (A0t + A1t + ··· + An−1t + An)e

αt αt s n n−1 Pn(t)e cos βt, Pn(t)e sin βt t [(A0t + A1t + ··· + An−1t + An) cos βt+ n n−1 αt (B0t + B1t + ··· + Bn−1t + Bn) sin βt]e

Example 3.6.4: Use the table above to determine the appropriate guess of yp(t) for the following ODE y00 + 2y0 + y = t2e−t.

2 2 Answer: The ch. eq. is: r + 2r + 1 = 0 ⇒ (r + 1) = 0 ⇒ r = r1 = r2 = −1 (repeated root!)

−t yh(t) = (c1 + c2t)e .

Based on the table, s 2 −t yp(t) = t (At + Bt + C)e .

To make sure that no term in yp(t) is identical to any term in yh(t),

2 2 −t s = 2 =⇒ yp(t) = t (At + Bt + C)e .

Now, calculating the coefficients A, B, C will be rather long and tedious.

83 Pros and cons of the method of undetermined coefficients:

• Straightforward, easy to understand.

• Principle of Superposition can be used to break it to smaller problems.

• Restricted to certain forms of g(t) as listed in Table 3.6.1. √ E.g., it does not apply easily to: y00 + 2y0 + y = te−t (A final exam problem in 2000).

• Does not apply to linear ODEs with varying coefficients y00 + p(t)y0 + q(t)y = g(t).

• Calculations are often long and tedious.

84 3.6.2 Method 2: Variation of parameters (Lagrange)

Basic idea: If y1(t), y2(t) form a fundamental set of the homogeneous ODE L[y] = 0, then

yh(t) = c1y1(t) + c2y2(t).

Lagrange suggested that a particular solution for the nonhomogeneous ODE L[y] = g(t) can always be expressed as yp(t) = u1(t)y1(t) + u2(t)y2(t)

which is obtained by allowing the parameters c1, c2 in yh(t) to vary as functions of t.

Theorem 3.6.4: Consider the linear, 2nd-order, nonhomogeneous ODE

L[y] = y00 + p(t)y0 + q(t)y = g(t),

where p(t), q(t), g(t) are continuous in an open interval I. y1(t), y2(t) form a fundamental set of the homogeneous ODE L[y] = 0, then one particular solution for L[y] = g(t) is

yp(t) = u1(t)y1(t) + u2(t)y2(t),

where Z Z y2(t)g(t) y1(t)g(t) u1(t) = − dt, u2(t) = dt, W [y1, y2](t) W [y1, y2](t) are calculated by excluding the integration constant. The general solution of L[y] = g(t) is y(t) = yh(t) + yp(t) = c1y1(t) + c2y2(t) + u1(t)y1(t) + u2(t)y2(t) = [c1 + u1(t)]y1(t) + [c2 + u2(t)]y2(t).

Proof: (Not required!) The goal is to solve for u1(t) and u2(t).

yp = u1y1 + u2y2 =⇒ 0 0 0 0 0 yp = u1y1 + u2y2 + u1y1 + u2y2 =⇒ 0 0 0 yp = u1y1 + u2y2,

if we force the following constraint on u1(t) and u2(t) such that

0 0 u1y1 + u2y2 = 0. (a) Now, 00 00 00 0 0 0 0 yp = u1y1 + u2y2 + u1y1 + u2y2.

00 0 Substitute yp , yp, yp into the L[y] = g(t) and reorganize and simplify the terms, we obtain

0 0 0 0 u1L[y1] + u2L[y2] + u1y1 + u2y2 = g(t).

85 Notice that L[y1] = 0 and L[y2] = 0 , we obtain

0 0 0 0 u1y1 + u2y2 = g(t). (b)

We now have the system of two equations

 0 0 u1y1 + u2y2 = 0, (a) 0 0 0 0 u1y1 + u2y2 = g(t). (b)

Turn this system of algebraic equations in matrix form:

   0    y1 y2 u1 0 ~ 0 0 0 = =⇒ A~x = b, (63) y1 y2 u2 g(t) where    0    y1 y2 u1 ~ 0 A = 0 0 , ~x = 0 , b = . y1 y2 u2 g(t)

Important note: Since the formula given in Theorem 3.6.4 was derived using the ODE of the “standard form” y00 + p(t)y0 + q(t)y = g(t), it is important to change your equation into this standard form before using this formula. Atually, it is always a good habit to change your ODE into this form before you try to solve it.

Since y1 y2 det A = 0 0 = W [y1, y2] 6= 0, y1 y2 there exists a unique solution (based on Cramer’s rule):

0 1 0 y2 y2g 0 1 y1 0 y1g u1 = 0 = − , u2 = 0 = . det A g y2 W [y1, y2] det A y1 g W [y1, y2]

Integrate both expressions to obtain Z Z y2g y1g u1 = − dt, u2 = dt. W [y1, y2] W [y1, y2] Since we only need one particular solution, we do not need to include the integration constant in these integrals.

86 Back to Example 3.6.4: Find the general solution for the following ODE.

y00 + 2y0 + y = t2e−t.

2 2 Answer: The ch. eq. is: r + 2r + 1 = 0 ⇒ (r + 1) = 0 ⇒ r = r1 = r2 = −1 (repeated root!)

−t yh(t) = (c1 + c2t)e .

−t −t Notice that y1(t) = e , y2(t) = te . The Wronskian

0 0 −t −t −t −t −2t W [y1, y2] = y1y2 − y1y2 = e (1 − t)e − (−e )te = e .

Based on the method of undetermined coefficient,

2 2 −t yp(t) = t (At + Bt + C)e .

Calculating these coefficients A, B, C will be rather long and tedious.

Now, let us use “variation of parameters”.

Z Z −t 2 −t Z y2g te t e 3 1 4 u1(t) = − dt = − −2t dt = − t dt = − t . W [y1, y2] e 4

Z Z −t 2 −t Z y1g e t e 2 1 3 u2(t) = dt = −2t dt = t dt = t . W [y1, y2] e 3

Thus, 1 1 1 1 1 y (t) = u y + u y = − t4e−t + t3(te−t) = − t4e−t = t4e−t. p 1 1 2 2 4 3 3 4 12

The general solution is 1 y(t) = y (t) + y (t) = [c + c t] e−t + t4e−t. h p 1 2 12

87 Example 3.6.5: Find the general solution for the following ODE (taken from 2000 final exam). √ y00 + 2y0 + y = te−t.

√ Answer: Because g(t) = te−t is not included in the in Table 3.6.1, we do not have an educated guess of yp(t). We use the “variation of parameters” method.

2 2 −t −t Ch. eq. r + 2r + 1 = 0 =⇒ (r + 1) = 0 =⇒ r1 = r2 = r = −1 =⇒ y1(t) = e , y2(t) = te .

−t yh(t) = (c1 + c2t)e .

The Wronskian is

0 0 −t −t −t −t −2t W [y1, y2] = y1y2 − y1y2 = e (1 − t)e − (−e )te = e .

Thus, √ Z Z −t −t Z y2g te te 3 2 5 2 2 u1(t) = − dt = − −2t dt = − t dt = − t . W [y1, y2] e 5 √ Z Z −t −t Z y1g e te 1 2 3 2 2 u2(t) = dt = −2t dt = t dt = t . W [y1, y2] e 3

Thus,   2 5 −t 2 3 −t 2 2 5 −t 4 5 −t y (t) = u y + u y = − t 2 e + t 2 (te ) = − t 2 e = t 2 e . p 1 1 2 2 5 3 3 5 15

The general solution is

−t 4 5 −t y(t) = y (t) + y (t) = [c + c t] e + t 2 e . h p 1 2 15

88 t Example 3.6.6: Given that y1(t) = t, y2(t) = te form a fundamental set of the homogeneous ODE corresponding to the nonhomgeneous ODE

t2y00 − t(t + 2)y0 + (t + 2)y = 2t3,

find the general solution to this nonhomgeneous ODE. (Note that for ODEs with non-constant coefficients, we do not yet know how to solve for y1(t), y2(t).)

Answer: First turn the equation into the ‘normal’ form t + 2 t + 2 y00 − y0 + y = 2t = g(t), (t > 0). t t2

The Wronskian t t te t t 2 t W [y1, y2] = = t(1 + t)e − te = t e . 1 (1 + t)et

Now, Z Z t Z y2g te (2t) u1 = − dt = − 2 t dt = − 2dt = −2t. W [y1, y2] t e Z Z Z y1g t(2t) −t −t u2 = dt = 2 t dt = 2e dt = −2e . W [y1, y2] t e

Thus, −t t 2 yp(t) = u1y1 + u2y2 = (−2t)t + (−2e )(te ) = −2t − 2t.

Therefore,

t 2 t 2 t 2 y(t) = yh(t) + yp(t) = c1t + c2te − 2t − 2t = (c1 − 2)t + c2e − 2t = c1t + c2te − 2t .

89 Example 3.6.7: For the nonhomgeneous ODE

t2y00 − 2ty0 + 2y = 4t2, (t > 0)

find its general solution given that y1(t) = t is one solution to the corresponding homogeneous ODE t2y00 − 2ty0 + 2y = 0.

Answer: First turn the equation into the ‘normal’ form 2 2 y00 − y0 + y = 4. t t2

2 Thus, p(t) = − t and g(t) = 4.

To find both yh(t) and yp(t), we need a second LI solution y2(t) for the homogeneous equation L[y] = 0.

To solve for y2(t): Method I: Abel’s theorem.

Assuming that y2(t) is LI of y1(t), we can use Abel’s theorem to calculate the Wronskian (by picking the constant C = 1):

R R 2 2 0 0 − p(t)dt t dt ln t 2 W [y1, y2] = y1y2 − y1y2 = e = e = e = t .

This yields the following 1st-order, linear ODE for y2: 1 ty0 − y = t2 =⇒ y0 − y = t. 2 2 2 t 2

R R 1 1 R p(t)dt − t dt R p(t)dt R The integrating factor is e = e = t , and R(t) = e tdt = dt = t + C = t. Thus,

− R p(t)dt 2 y2(t) = e [R(t) + C] = t[t + C] = t .

Therefore, 2 yh(t) = c1y1(t) + c2y2(t) = c1t + c2t .

The Wronskian obtained by using Abel’s theorem is indeed the one we are looking for

0 0 2 0 0 2 2 2 2 W [y1, y2] = y1y2 − y1y2 = t(t ) − (t) (t ) = 2t − t = t (> 0, since t > 0).

To find yp(t): we use “variation of parameters”. Let

yp(t) = u1(t)y1(t) + u2(t)y2(t),

90 where Z Z 2 Z gy2 4t u1(t) = − dt = − 2 dt = − 4dt = −4t, W [y1, y2] t Z Z Z gy1 4t 4 4 u2(t) = dt = 2 dt = dt = ln t . W [y1, y2] t t

Thus, 2 2 4 yp(t) = u1(t)y1(t) + u2(t)y2(t) = −4t + t ln t .

The general solution to the nonhomogeneous ODE is

2 2 2 4 2 2 4 y(t) = yh(t) + yp(t) = c1t + c2t − 4t + t ln t = c1t + c2t + t ln t .

To solve for y2(t): Method II: “reduction of order”. Let

y2(t) = u(t)y1(t).

0 0 0 00 00 0 0 00 y2 = u y1 + uy1, y2 = u y1 + 2u y1 + vy1 .

00 0 Substitute y2 , y2, y2 into the ODE L[y] = 0, we obtain

0 0 00 L[y2] = uL[y1] + u (py1 + 2y1) + u y1 = 0.

The first term is zero and the remaining terms give

0 0 0 py + 2y 0 py + 2y py + 2y u00 + 1 1 u0 = 0 −→v=u v0 + 1 1 v = 0 =⇒ v0 = − 1 1 v. y1 y1 y1

Separation of variables dv py + 2y0 Z dv Z py + 2y0 Z py + 2y0 = − 1 1 dt =⇒ = − 1 1 dt =⇒ ln v = − 1 1 dt. v y1 v y1 y1

Therefore,

 Z py + 2y0   Z py + 2y0  u0(t) = v(t) = Cexp − 1 1 dt C==1 exp − 1 1 dt =⇒ y1 y1

Z  Z py + 2y0  Z  Z  y0   u(t) = exp − 1 1 dt dt =⇒ u(t) = exp − p + 2 1 dt dt y1 y1

91 2 Substitute p(t) = − t and y1(t) = t into the formula,

Z  0  Z  0  Z Z y1 2 (t) −2 + 2 − p + 2 dt = − − + 2 dt = − dt = − 0dt = C1 =⇒ y1 t t t Z Z C1 C2=1,C3=0 u(t) = e dt = C2dt = C2t + C3 = t.

Therefore 2 y2(t) = u(t)y1(t) = t .

92 3.7 Applications to forced vibrations: beats and resonance

3.7.1 Forced vibration in the absence of damping: γ = 0 (idealized situation) ( q 00 00 2 k Ff my + ky = Ff cos(ωf t), ⇒ y + ω0y = F cos(ωf t), (ω0 = m ,F = m ) y(0) = 0, y0(0) = 0.

Case I: ωf 6= ω0. We know yh(t) = c1 cos(ω0t) + c2 sin(ω0t).

Since only even ordered derivatives occur on the lhs,

00 2 yp(t) = B cos(ωf t) =⇒ yp (t) = −Bωf cos(ωf t).

00 Substitute yp, yp into the ODE:

2 2 F −Bωf cos(ωf t) + Bω0 cos(ωf t) = F cos(ωf t) =⇒ B = 2 2 . ω0 − ωf

Therefore, the general solutions is F y(t) = yh(t) + yp(t) = c1 cos(ω0t) + c2 sin(ω0t) + 2 2 cos(ωf t). ω0 − ωf

Using initial conditions, F F y(0) = 0 = c1 + 2 2 =⇒ c1 = − 2 2 ; ω0 − ωf ω0 − ωf

0 y (0) = 0 = ω0c2 =⇒ c2 = 0.

Thus, F y(t) = 2 2 [cos(ωf t) − cos(ω0t)] . ω0 − ωf

Question: How to combine the sum of two trig functions with different frequencies into a product between two trig functions?

1 1 Let ω = (ω + ω ), ω = (ω − ω ); =⇒ ω = ω + ω , ω = ω − ω . + 2 0 f − 2 0 f 0 + − f + −

93 Using the trig identities cos(α ∓ β) = cos α cos β ± sin α sin β,

we obtain cos(ωf t) = cos(ω+ − ω−)t = cos ω+t cos ω−t + sin ω+t sin ω−t,

cos(ω0t) = cos(ω+ + ω−)t = cos ω+t cos ω−t − sin ω+t sin ω−t.

Therefore.

F 2F 2F ω0 + ωf ω0 − ωf y(t) = 2 2 [cos(ωf t) − cos(ω0t)] = 2 2 sin ω+t sin ω−t = 2 2 sin t sin t. ω0 − ωf ω0 − ωf ω0 − ωf 2 2

ω0+ωf Assuming thatω ¯ = 2 is the average between ω0 and ωf , we can write the solution in the following form

2F ω0 − ωf y(t) = A(t) sinωt, ¯ where A(t) = 2 2 sin t. ω0 − ωf 2

A(t) is the periodically modulated amplitude, thus y(t) shows the phenomenon of “beats” with a beat frequency ω − ω ω = 0 f . beat 2

Figure 19: Beats (amplitude modulation) of sin(20x) sin(x).

94 Case II: ωf = ω0 = ω. Again,

yh(t) = c1 cos(ωt) + c2 sin(ωt). but yp(t) = Bt sin ωt.

Notice that 00 2 yp (t) = B(2ω cos ωt − ω t sin ωt)

00 Substitute yp, yp into the ODE:

B(2ω cos ωt − ω2t sin ωt) + ω2Bt sin ωt = F cos(ωt), we obtain F F B = , =⇒ y (t) = t sin ωt. 2ω p 2ω

The general solution is F y(t) = y (t) + y (t) = c cos(ωt) + c sin(ωt) + t sin ωt. h p 1 2 2ω

Using initial conditions, y(0) = 0 = c1 =⇒ c1 = 0; 0 y (0) = 0 = ωc2 =⇒ c2 = 0.

Therefore, F y(t) = t sin ωt. 2ω

Resonance: The amplitude of this vibration increases to infinity as time approaches infinity.

Figure 20: Resonance in the absence of damping. f(x) = (x/2)sin(20x).

95 3.7.2 Forced vibration in the presence of damping: γ 6= 0

00 0 00 0 2 my + γy + ky = Ff cos(ωf t) =⇒ y + 2Γy + ω0y = F cos(ωf t), (64)

p where Γ = γ/(2m), ω0 = k/m, and F = Ff /m.

Characteristic equation:

2 2 r + 2Γr + ω0 = 0.

Consider under damped condition, q q 2 2 2 2 r1, r2 = −Γ ± Γ − ω0 = −Γ ± i ω0 − Γ = −Γ ± iω, where s q 2 2 2 Γ ω = ω0 − Γ = ω0 1 − 2 . ω0

Thus, −Γt t→∞ yh(t) = Ae cos(ωt − φ) −→ 0!

Therefore, t→∞ y(t) = yh(t) + yp(t) −→ yp(t),

which means that the long term behaviour is determined by yp(t).

−Γt Since the nonhomogeneous term g(t) = F cos(ωf t) (no exponential factor e !), we can safely assume

yp(t) = C cos(ωf t) + D sin(ωf t) = A cos(ωf t − φ), √ 2 2 −1 D where A = C + D , φ = tan C .

Plug yp(t) into the ODE and after lengthy calculations, we obtain

2 2 F (ω0 − ωf ) 2F Γωf C = 2 2 2 2 ,D = 2 2 2 2 . 4Γ ωf + (ω0 − ωf ) 4Γ ωf + (ω0 − ωf )

Now, substitute back the original model parameters, we obtain

2 Ff −1 γωf A = A(ωf ) = q , φ = tan 2 2 . 2 2 2 2 2 2 m(ω0 − ωf ) γ ωf + m (ω0 − ωf )

96 2 A(ω f ) γ=0

γ1 >γ2 >γ3 γ3

γ2

γ1 2 2 ωf 2 2 γ ωmax = ω − 0 2m2

2 Figure 21: Resonant amplitude (expressed as multiples of Ff ) as a function of forcing frequency ωf . 2 2 γ changes the steepness of the curve, steeper for smaller values of γ. When ωf = ωmax, maximum amplitude is achieved for that value of γ.

2 2 In Fig. 21, the amplitude of the vibration A(ωf ) is plotted as a function of ωf for four different 2 values of γ. The smaller the value of γ, the steeper the curve. The location of ωmax where the maximum amplitude is achieved also shift to the right as the value of γ decreases.

By requiring 2 2 2 2 0 dA Ff γ − 2m (ω0 − ωf ) A = 2 = − 3 = 0, dω 2 2 2 2 2 2 2 2 f (γ ωf + m (ω0 − ωf ) )

we find the maximum amplitude occurs when

γ2 ω2 = ω2 = ω2 − ≈ ω2 (if γ << 1!). f max 0 2m2 0

At this “resonant” frequency, the oscillation amplitude is

2 Ff Amax = A(ωmax) = q . 2 γ2 γ ω0 − 4m2

Conclusion: Resonance in forced vibration of a spring-mass-damper system can be understood completely by studying the properties of yp(t) of the solution. To avoid resonance, one needs to make the ωf as different from ω0 as possible or/and to make the damping as large as possible.

97 4 Systems of linear first-order ODEs

In this lecture, we study systems of linear, first-order ODEs with constant coefficients of the form

 0 y1 = a11y1 + a12y2 + b1(t), 0 (65) y2 = a21y1 + a22y2 + b2(t),

where y1(t), y2(t) are the two unknown functions, b1(t), b2(t) are known functions, aij (i, j = 1, 2) are constants. As long as a12 and a21 are not both zero, the two unknown functions are interdependent and cannot be solved independently.

Remarks:

(1) A second-order ODE ay00 + by0 + cy = g(t), (a 6= 0) can be reduced to a system of two first-order ODEs as follows  y0 = z, 0 c b 1 z = − a y − a z + a g(t),

which is a special case of eq.(65) where a11 = 0 and b1(t) = 0. Solving eq.(65) automatically solves ay00 + by0 + cy = g(t) as a special case.

(2) An n − th order linear ODE can be reduced to a system of n first order linear ODEs.

(3) Although many results obtained here can apply to systems of n (n > 2) first order ODEs, we shall focus mostly on a system of two ODEs as given in eq.(65).

dy R Definition of dt and ydt: To express eq.(65) in matrix form, we introduce the definition of the derivation and integration of a vector/matrix of functions. Let

 y (t)  y(t) = 1 . y2(t)

   0  0  0 dy d y1(t) y1(t) y1(t) Then, y = = = = 0 , dt dt y2(t) y2(t) y2(t) Z Z    R  y1(t) y1(t)dt and ydt = dt = R . y2(t) y2(t)dt

In these notes, we use the bold lower case letters for vectors and capital letters for matrices.

Therefore, in matrix form eq.(65) reads

 0        y1(t) a11 a12 y1(t) b1(t) 0 = + , y2(t) a21 a22 y2(t) b2(t) which simplifies to y0 = Ay + b, (66)

98 which is a nonhomogeneous system of linear, 1st-order ODEs with constant coefficients. Notice that

 a a   b (t)  A = 11 12 , b = 1 . a21 a22 b2(t)

When b = 0, the system becomes homogeneous

y0 = Ay.

99 4.1 Solving the homogeneous system y0 = Ay

Similar to the fact that the solution to the scalar ODE y0 = ay is y(t) = eaty(0), the solution to

y0 = Ay

can be generally expressed as y(t) = eAty(0), where ∞ n times 1 X tn z }| { eAt = 1 + At + A2t2 + ··· = An,An = AA ··· A. 2! n! n=0 This solution, being simple and beautiful, does not provide much help unless we can find a way to evaluate the infinite series of matrix products given by eAt in a finite form (we shall learn how to do that later!)

0 Theorem 5.1.1 Principle of Superposition: If y1(t), y2(t) are two solution of y = Ay, where A is n × n (n ≥ 2), then

y = c1y1 + c2y2, (c1, c2, are constants) is also a solution. If y1(t), y2(t) are linearly independent, then it is the general solution for the case when n = 2.

Proof: Notice that y0 = Ay is linear and homogeneous.

An educated guess of the solution: Based on a very similar argument as was given in Section 3.2, we look for solutions of the form

   λt    y1(t) v1e v1 λt λt y = = λt = e = ve , (67) y2(t) v2e v2

where v1, v2 are t-independent constants (i.e., v is a constant vector). Notice that both λ and v are to be determined.

Substitute it into the system y0 = Ay, we obtain

divide by eλt 0 veλt = Aveλt =⇒ v(λeλt) = Aveλt z}|{=⇒

Av = λv, (68) which defines the eigenvalue λ and eigenvector v of the matrix A.

100 0 Theorem 5.1.2: For a given system y = Ay, where A is 2 × 2. If λ1, λ2 are the two eigenvalues of A with corresponding eigenvectors v1, v2, then

λ1t λ2t y1 = v1e , y2 = v2e , are both solutions of the system. If λ1 6= λ2, then y1, y2 are linearly independent and form a fundamental set. The general solution is

λ1t λ2t y = c1y1 + c2y2 = c1v1e + c2v2e .

Proof: It follows from the argument outlined above and the fact about eigenvalues and eigenvectors in linear algebra. The linear independence shall be verified with the introduction of the Wronskian.

Remark: Solving the system y0 = Ay is reduced to solving Av = λv for the eigenvalues and eigenvectors of A. This result holds for a system of n (n > 2) equations where the matrix A is n × n.

Example 5.1.1: Find the general solution for the ODE y00 + 3y0 + 2y = 0 by solving the corre- sponding linear system.

Answer: Let z = y0 and turn the ODE into the following system

 y0 = z, z0 = −2y − 3z.

In matrix form, it reads

 y0   0 1   y  = , =⇒ y0 = Ay, z0 −2 −3 z where  0 1  A = . −2 −3

Based on Theorem 5.1.2, we know that the general solution is

λ1t λ2t y = c1v1e + c2v2e , where λ1, λ2 are the eigenvalues of A and v1, v2 are the corresponding eigenvectors.

Question: How to calculate eigenvalues and eigenvectors?

101  a a  Review of matrix algebra: Finding eigenvalues and eigenvectors of a matrix A = 11 12 ? a21 a22

(1) Starting with the equation that defines eigenvectors and eigenvalues

Av = λv =⇒ Av − λv = 0 =⇒ (A − λI)v = 0.

Remarks: (0) Basically both the eigenvalues and eigenvectors are solved by solving this algebraic equa- tion for non-zero v. (i) An eigenvector v is a non-zero vector that is invariant under the (multiplication) of the matrix A.(v invariant under A implies Av ∈ v.) (ii) An eigenvector v represents a whole line in the direction specified by v . Therefore, cv for any constant c 6= 0 represents the same eigenvector as v. (iii) The eigenvalue λ corresponding to the eigenvector v is a measure of the factor by which v is changed by the multiplication of A.

(2) Eigenvectors must be non-zero (while eigenvalues can be zero). For (A − λI)v = 0 to have non-zero solutions, det(A − λI) = 0, =⇒

a11 − λ a12 2 = (a11 −λ)(a22 −λ)−a12a21 = λ −(a11 +a22)λ+a11a22 −a12a21 = 0, =⇒ a21 a22 − λ λ2 − T rλ + Det = 0 (characteristic equation!)

where T r = trA = a11 + a22 is the trace (defined as the sum of the diagonal entries of A), Det = det A = a11a22 − a12a21.

2 (3) After solving λ −T rλ+Det = 0 for the two eigenvalues λ1, λ2, the corresponding eigenspaces or nullspaces give the corresponding eigenvectors,

vj = E(λj) = N (A − λjI) = ker(A − λjI), (j = 1, 2).

This is because solving (A−λI)v = 0 is finding any non-zero vector v such that (A−λI)v = 0. This is exactly the same problem as finding the kernel of (A − λI). We shall demonstrate below how ker(A − λI) is defined and calculated!

(4) An n × n can be expressed as a row of n column vectors as well as a column of n row vectors. Rules of hold for such expressions.

No proof is provided here but I provide an example to show why.

102 (i) Expressed as a row of column vectors:  1 1   1   1  A = = [c c ] , where c = , c = . 0 1 1 2 1 0 2 1 Thus,  2   2   1   1   5  A = [c c ] = 2c + 3c = 2 + 3 = . 3 1 2 3 1 2 0 1 3 Let’s us verify the result using the normal matrix multiplication:  2   1 1   2   (1)(2) + (1)(3)   5  A = = = . 3 0 1 3 (0)(2) + (1)(3) 3

(ii) Expressed as a column of row vectors:     1 1 r1 A = = , r1 = [1 1] , r2 = [0 1] . 0 1 r2 Thus,   r1 [3 4] A = [3 4] = 3r1 + 4r2 = 3 [1 1] + 4 [0 1] = [3 7] . r2 Let’s us verify the result using the normal matrix multiplication:  1 1  [3 4] A = [3 4] = [(3)(1) + (4)(0) (3)(1) + (4)(1)] = [3 7] . 0 1

(iii) Multiplication between matrices: let B be another 2 × 2 matrix, then     r1 r1B BA = B [c1 c2] = [Bc1 Bc2] , AB = B = . r2 r2B For example, let  1 3  B = . 2 4 Thus,  1 3   1 1   (1)(1) + (3)(0) (1)(1) + (3)(1)   1 4  BA = = = . 2 4 0 1 (2)(1) + (4)(0) (2)(1) + (4)(1) 2 6  1 1   1 3   (1)(1) + (1)(2) (1)(3) + (1)(4)   3 7  AB = = = . 0 1 2 4 (0)(1) + (1)(2) (0)(3) + (1)(4) 2 4 Let’s now use the previous results to do the same multiplication  1 3   1   1 3   1   1 4  BA = [Bc Bc ] = = . 1 2 2 4 0 2 4 1 2 6   1 3   [1 1]  r B  2 4  3 7  AB = 1 =   = . r B   1 3   2 4 2  [0 1]  2 4

103 (5) The kernel of a matrix B is defined as the collection of all vectors k such that

Bk = 0, (i.e., all vectors that are mapped to zero by B.)

It is also called the nullspace of B, denoted sometimes by N (B) and sometimes by ker(B).

(6) Theorem Rev1: The kernel of a matrix B is span by the linear relations between its column vectors.

Proof: Express an n × n matrix as a row of n columns (column vectors) B = [c1 c2 ··· cn]. Let   k1  k   2  k =  .  .  .  kn Therefore, any k in ker(B) must satisfy   k1  k   2  Bk = [c1 c2 ··· cn]  .  = k1c1 + k2c2 + ··· + kncn = 0.  .  kn

Any set of numbers {k1, k2, ··· , kn} that satisfies k1c1 + k2c2 + ··· + kncn = 0 is referred to as a linear relation of the set of vectors {c1, c2, ··· , cn}. Therefore, ker(B) contains all possible linear relations of the column vectors of B.

Example Rev1:

 1 2   0  ker = = 0, (no linear relation, columns are LI, matrix is invertible!). 3 4 0 | {z } 0c1+0c2=0

Remark: This situation never happens in calculating eigenvectors because for the eigenvec- tor problem (A − λI)v = 0, det(A − λI) = 0 which implies that the matrix A − λI can’t be invertible! Whenever you see this in your eigenvector calculation, something must be wrong!

Example Rev2:

 1 2   2  ker = , (Or any nonzero multiple of it. 1D!). 2 4 −1 | {z } 2c1−c2=0

104 Example Rev3:       1 0 0  0 0  ker  0 0 0  =  1  ,  0  , (2D! Infinitely many choices exist!). 1 0 0  0 1  | {z } 0c1+1c2+0c3=0 & 0c1+0c2+1c3=0

105  0 1  Back to Example 5.1.1: Since A = , we find T r = −3, Det = 2. The ch. eq. is −2 −3

2 λ + 3λ + 2 = (λ + 1)(λ + 2) = 0 =⇒ λ1 = −1, λ2 = −2.

For the eigenvectors,  1 1   1  v = E(λ ) = ker(A − λ I) = ker = . 1 1 1 −2 −2 −1 | {z } c1−c2=0  2 1   1  v = E(λ ) = ker(A − λ I) = ker = . 2 2 2 −2 −1 −2 | {z } c1−2c2=0

Therefore, the general solutions is  y   1   1  y = = c v eλ1t + c v eλ2t = c e−t + c e−2t. z 1 1 2 2 1 −1 2 −2

The first row gives the solution to the original second-order ODE, while the second row gives z = y0(t). Thus, −t −2t y(t) = c1e + c2e .

 1 1  Example 5.1.3: Find the general solution of the linear system y0 = Ay where A = . 4 1

Answer: T r = 2, Det = −3. Thus, ch. eq. is 2 λ − 2λ − 3 = (λ + 1)(λ − 3) = 0 =⇒ λ1 = −1, λ2 = 3.

For the eigenvectors,  2 1   1  v = E(λ ) = ker(A − λ I) = ker = . 1 1 1 4 2 −2 | {z } c1−2c2=0  −2 1   1  v = E(λ ) = ker(A − λ I) = ker = . 2 2 2 4 −2 2 | {z } c1+2c2=0

Therefore, the general solutions is  1   1  y = c v eλ1t + c v eλ2t = c e−t + c e3t. 1 1 2 2 1 −2 2 2

106 4.2 Phase space, vector field, solution trajectories

Given a homogeneous linear system

 0      0 y1(t) a11 a12 y1(t) y = Ay or 0 = . y2(t) a21 a22 y2(t)

If the coefficients aij, (i, j = 1, 2) are all constants, then the system is autonomous. Therefore, the vector field is uniquely defined in the state space y1 − y2 plane, also referred to as the phase space.

Example 5.2.1: Turn the 2nd-order ODE for harmonic oscillations y00 +y = 0 into a system of 1st- order ODEs. Then, sketch its slope field and trace out one solution starting from y(0) = 2, y0(0) = 0.

Answer: Let v(t) = y0(t). Then, the ODE is turned into the following system

 y0   0 1   y  = . v0 −1 0 v

v 2

1

y 0 1 2

Figure 22: Vector field (blue) of the system y0 = v, v0 = −y in the y−v phase space. One for y(0) = 2, y0(0) = 0 (red) is traced out. It is tangent to the vector field at every point of the phase space. Variable t is indirectly reflected in the (red) arrow direction traced out by the solution trajectory. The red dot represents the trivial solution y = v = 0.

107 Example 5.2.2: Sketch the vector field of the system y0 = Ay studied in Example 5.1.3, where  1 1  A = . In this phase space, clearly indicate the invariant sets (i.e. the eigenvector directions) 4 1 and draw the trajectory flows.

Remember that A has the two eigenvalues λ1 = −1 and λ2 = 3 with corresponding eigenvectors  1   1  v = , v = . 1 −2 2 2

v 1

0.8

0.6

0.4

0.2

0

-0.2

-0.4

-0.6

-0.8

-1 y -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

Figure 23: Vector field of the system given in Example 5.2.2. The two invariant sets v1 = [1 − 2], v2 = [1 2] are clearly boundaries where the trajectories can never cross. They divide the phase space into 4 distinct areas.

Definition of invariant set: A set of points S in the phase space of the system y0 = Ay is invariant, if for any initial condition y(0) ∈ S, y(t) stays in S for all t ∈ (−∞, ∞).

Remark: Solution trajectories in phase space can only approach an invariant set but can never cross it, making the invariant sets standout as important features of the of a linear system.

Theorem 5.2.1: If v1, v2 are eigenvectors of A corresponding to two distinct eigenvalues λ1 6= λ2, then they are both invariant sets of the system y0 = Ay.

Proof: The general solution of the system is

λ1t λ2t y(t) = c1v1e + c2v2e .

Let’s show that v1 is an invariant set and draw the same conclusion for v2. Substituting the following initial condition y0 = cv1 (c 6= 0 is a constant),

108 into the general solution, we obtain (notice that v1, v2 are linearly independent)

c1 = c, c2 = 0.

Therefore, the solution for this specific initial condition is

λ1t y(t) = cv1e , which stays in the direction specified by v1 for all t.

Furthermore, the above result shows that the flow direction on the invariant set depends on the sign λ1t of λ1. If λ1 < 0, y(t) = cv1e → 0, the time arrow is pointed to the origin; if λ1 > 0, however, λ1t y(t) = cv1e → (∞)cv1, the time arrow points away from the origin.

4.3 How does the IC determine the solution?

Example 5.3.1: Solve the IVP

 y0 = Ay,  1 1  where A = , y(0) = y0, 4 1 for the following initial conditions

 −1   2   1  (a) y = ; (b) y = ; (c) y = . 0 2 0 4 0 6

Answer: This system has already been solved in Example 5.1.3, where we found that λ1 = −1, λ2 = 3 and that  1   1  v = , v = . 1 −2 2 2

Therefore, the general solutions is

 1   1  y(t) = c v eλ1t + c v eλ2t = c e−t + c e3t. 1 1 2 2 1 −2 2 2

Using the IC(a), we obtain           1 1 1 1 c1 −1 y(0) = c1 + c2 = = =⇒ −2 2 −2 2 c2 2

 c   1 1 −1  −1  1 = . c2 −2 2 2

109 Now, we need to calculate the inverse of a 2 × 2 matrix.

Review: the inverse of a 2 × 2 matrix.

 a a −1 1  a −a  A−1 = 11 12 = 22 12 , (det A 6= 0). (69) a21 a22 det A −a21 a11

Using the formula given above, we obtain    −1           c1 1 1 −1 1 2 −1 −1 1 −4 −1 = = = = =⇒ c1 = −1, c2 = 0. c2 −2 2 2 4 2 1 2 4 0 0

Remark: Had we paid attention to IC(a), this result would have been expected since y0 =  −1  = (−1)v which means the system started from a point in the invariant set defined by 2 1 v1. It surely is expected to remain in it for all t. As a matter of fact, c1 = −1 is exactly the factor in the expression of y0 in terms of v1.

Now, before we use the IC(b) to solve for c1 and c2, let’s find out what is the relationship between y0 and the eigenvectors. We realize that  2  y = = 2v . 0 4 2

Thus, we expect that c1 = 0, c2 = 2 for this IC based on what we learned above. Let’s verify it using IC(b):           1 1 1 1 c1 2 y(0) = c1 + c2 = = =⇒ −2 2 −2 2 c2 4    −1           c1 1 1 2 1 2 −1 2 1 0 0 = = = = =⇒ c1 = 0, c2 = 2. c2 −2 2 4 4 2 1 4 4 8 2

Finally, for IC(c) we notice that

 1   1   1  y(0) = = (−1) + (2) = (−1)v + 2v . 6 −2 2 1 2

Therefore, we expect c1 = −1, c2 = 2 for this IC. Let verify it below:           1 1 1 1 c1 1 y(0) = c1 + c2 = = =⇒ −2 2 −2 2 c2 6

   −1           c1 1 1 1 1 2 −1 1 1 −4 −1 = = = = =⇒ c1 = −1, c2 = 2. c2 −2 2 6 4 2 1 6 4 8 2

110 Theorem 5.3.1: If v1, v2 are eigenvectors of A corresponding to two distinct eigenvalues λ1 6= λ2, then the solution to the IVP  y0 = Ay, y(0) = y0, is λ1t λ2t y(t) = m1v1e + m2v2e , where the constants m1, m2 are obtained by expressing the IC as a linear combination of v1, v2:

y0 = m1v1 + m2v2.

Proof: In the general solution λ1t λ2t y(t) = c1v1e + c2v2e , plug in t = 0, we obtain y(0) = c1v1 + c2v2.

111 4.4 Complex eigenvalues and repeated eigenvalues

 5 −6  Example 5.4.1: Find a fundamental set of the linear system y0 = Ay where A = . 3 −1

Answer: T r = 4, Det = 13. Thus, the ch. eq. is

λ2 − 4λ + 13 = (λ − 2)2 + 9 = 0 =⇒ λ, λ¯ = 2 ± 3i.

For λ = 2 + 3i,

r =(−1+i)r +r  3 − 3i −6  2 2 1  3 − 3i −6   1 + i  v = ker(A − (2 + 3i)I) = ker z}|{= ker = . 3 −3 − 3i 0 0 1 | {z } (1+i)c1+c2=0

For λ¯ = 2 − 3i, the corresponding eigenvector should also be the complex conjugate of v

 1 + i   1 − i  v = = . 1 1

Therefore, the complex-valued solution

 1 + i  y (t) = veλt = e(2+3i)t c 1

and its conjugate  1 − i  y (t) = veλt = e(2−3i)t c 1 form a set of complex-valued fundamental set.

Notice that  1 + i   1   1  v = = + i = v + i v , 1 1 0 r i where its real and imaginary parts are

 1   1  v = , v = . r 1 i 0

To find real-valued fundamental set, we express yc in terms of its real and imaginary parts:

 1 + i  y (t) = e(2−3i)t = (v + i v ) e2t(cos 3t + i sin 3t) c 1 r i

112 2t 2t = e [vr cos 3t − vi sin 3t] + ie [vr sin 3t + vi cos 3t] .

Therefore,

 cos 3t − sin 3t  y (t) = Re{y (t)} = e2t [v cos 3t − v sin 3t] = e2t , 1 c r i cos 3t

 sin 3t + cos 3t  y (t) = Im{y (t)} = e2t [v sin 3t + v cos 3t] = e2t 2 c r i sin 3t form a real-valued fundamental set.

Theorem 5.4.1: For the linear system y0 = Ay, if the ch. eq. λ2 − T rλ + Det = 0 yields a pair of complex roots λ, λ = α ± iβ with the corresponding eigenvectors v, v, then

λt λt yc(t) = ve and yc(t) = ve

form a pair of complex-valued fundamental set, while

αt y1(t) = Re{yc(t)} = e [vr cos βt − vi sin βt] and

αt y2(t) = Im{yc(t)} = e [vr sin βt + vi cos βt] form a pair of real-valued fundamental set, where

vr = Re{v}, vi = Im{v}

are, respectively, the real and imaginary parts of the complex-valued eigenvector v.

Proof: Since 1   1   y (t) = Re{y (t)} = y (t) + y (t) , y (t) = Im{y (t)} = y (t) − y (t) 1 c 2 c c 2 c 2i c c are both linear combinations of yc(t) and yc(t) which are known to be solutions of the linear system y0 = Ay, they must also be solutions.

It is straightforward to show that they are indeed linearly independent of each other by calculating the Wronskian of the two (will be introduced later!)

Example 5.4.2: Find both complex- and real-valued fundamental sets of the linear system y0 = Ay  1 2  where A = . Then, sketch the phase digram of the system. −4 −3

113 Answer: T r = −2, Det = 5. Thus, the ch. eq. is

λ2 + 2λ + 5 = (λ + 1)2 + 4 = 0 =⇒ λ, λ¯ = −1 ± 2i.

For λ = −1 + 2i,

r =(1+i)r +r  2 − 2i 2  2 1 2  2 − 2i 2   1  v = ker(A − (−1 + 2i)I) = ker z}|{= ker = . −4 −2 − 2i 0 0 −1 + i | {z } c1+(−1+i)c2=0

Thus,  1   0  v = v + iv = + i . r i −1 1

Therefore, the complex-valued fundamental set is

 1   1  y (t) = veλt = e(−1+2i)t, y (t) = veλt = e(−1−2i)t. c −1 + i c −1 − i

The real-valued fundamental set is  cos 2t  y (t) = Re{y (t)} = e−t [v cos 2t − v sin 2t] = e−t , 1 c r i − cos 2t − sin 2t

 sin 2t  y (t) = Im{y (t)} = e−t [v sin 2t + v cos 2t] = e−t . 2 c r i − sin 2t + cos 2t

1.5 y2

1

0.5

0

-0.5

-1

-1.5 y1 -1.5 -1 -0.5 0 0.5 1 1.5

Figure 24: Phase space diagram for the system in Example 5.4.2. In this case, the fundamental set does not distinguish themselves from other solution trajectories. All are spiralling into the origin as time evolves.

114  0 −1  Example 5.4.3: Find a fundamental set of the linear system y0 = Ay where A = . 1 −2 Then, sketch the phase digram of the system.

Answer: T r = −2, Det = 1. Thus, the ch. eq. is

2 2 λ + 2λ + 1 = (λ + 1) = 0 =⇒ λ1 = λ2 = −1 = λ.

For λ = −1,  1 −1   1  v = ker(A − (−1)I) = ker = . 1 −1 1 | {z } c1+c2=0

Thus, we got one solution  1  y (t) = veλt = e−t. 1 1

How to find a second solution? Let us try

λt y2(t) = vte .

Notice that 0 λt λt y2 = ve + λvte .

0 0 Substitute both y2 and y2 into the system y = Ay,

0 λt λt λt λt lhs = y2 = ve + λvte , while rhs = Ay2 = Avte = λvte .

λt It is obvious that lhs 6= rhs, the two differ by the term y1(t) = ve .

The correct guess is λt λt y2(t) = vte + ue , where the vector u is to be determined.

Notice that now 0 λt λt λt y2 = ve + λvte + λue .

0 0 Substitute both y2 and y2 into the system y = Ay,

0 λt λt λt λt λt λt λt lhs = y2 = ve + λvte + λue , while rhs = Ay2 = Avte + Aue = λvte + Aue .

115 By requiring lhs = rhs, we obtain (A − λI)u = v.

Since det(A − λI) = 0, there exist infinitely many solutions u 6= 0. Any one would make the solution work.

Back to Example 5.4.3,(A − λI)u = v leads to

 1 −1   u   1  1 = , 1 −1 u2 1 which results in the following       1 −1 1 r =r −r 1 −1 1 1 2 −→2 1 =⇒ u − u = 1 =⇒ u = . 1 −1 1 0 0 0 1 2 0

Therefore,  1   1   t + 1  y (t) = vteλt + ueλt = te−t + e−t = e−t. 2 1 0 t

3 y2

2

1

0

-1

-2

-3 y1 -3 -2 -1 0 1 2 3

Figure 25: Phase space diagram for the system in Example 5.4.3. The invariant set v = [1 1] separates the phase space into two regions.

Theorem 5.4.2: For the linear system y0 = Ay, if the ch. eq. λ2 − T rλ + Det = 0 yields repeated real root λ = λ1 = λ2 with the corresponding eigenvector v, then

λt λt λt λt y1(t) = ve and y2(t) = vte + ue = [vt + u] e form a fundamental set, where the constant vector u is any one of the infinitely many solutions of the algebraic equation (A − λI)u = v.

Proof: See arguments in Example 5.4.3. The linear independence of the two shall be discussed when the Wronskian is introduced.

116 4.5 Fundamental matrix and evaluation of eAt

Definition of fundamental matrix: If y1(t), y2(t) form a fundamental set for the linear system 0 y = Ay, then its fundamental matrix Y (t) is constructed by putting y1(t) in its first column and y2(t) in its second column. Y (t) = [y1(t) y2(t)] . (In other words, the fundamental matrix is a matrix whose columns are formed by the fundamental set!)

0 Theorem 5.5.1: Let y1(t), y2(t) be a fundamental set for the system y = Ay and Y (t) = [y1(t) y2(t)] be the fundamental matrix. Then the solution for the following IVP

 y0 = Ay, y(0) = y0, is At −1 y(t) = e y0 = Y (t)Y (0)y0. This expression implies that eAt = Y (t)Y −1(0).

Remark: Once the fundamental matrix is found, we can use this expression to evaluate eAt.

Proof: The general solution for the system y0 = Ay is     c1 c1 y(t) = c1y1(t) + c2y2(t) = [y1(t) y2(t)] = Y (t)c, where c = . c2 c2

Using the IC, we obtain

−1 y(0) = y0 = Y (0)c =⇒ c = Y (0) y0.

Substitute the expression of c into the general solution, we obtain

−1 y(t) = Y (t)c = Y (t)Y (0)y0.

Example 5.5.1: Solve the following IVP

 y0 = Ay, y(0) = y0,

117 where  1 1   1  A = , y = . 4 1 0 −1

Answer: Note that matrix A is identical to that in Example 5.3.1, where we have already solved the fundamental set  1   e−t   1   e3t  y (t) = e−t = , y (t) = e3t = . 1 −2 −2e−t 2 2 2e3t

Thus,  e−t e3t  Y (t) = [y (t) y (t)] = . 1 2 −2e−t 2e3t

Therefore,  e−t e3t   1 1 −1  1  y(t) = Y (t)Y −1(0)y = 0 −2e−t 2e3t −2 2 −1  e−t e3t  1  2 −1   1   e−t e3t  1  3  = = −2e−t 2e3t 4 2 1 −1 −2e−t 2e3t 4 1 3   1    3 −t 1 3t  1 −t 1 3t 4 e + 4 e = e + e = 3 −t 1 3t . 4 −2 4 2 − 2 e + 2 e

From the above expression, we also found that

 1 1    e−t e3t  1  2 −1  1  2e−t + 2e3t −e−t + e3t  eAt = exp t = = . 4 1 −2e−t 2e3t 4 2 1 4 −4e−t + 4e3t 2e−t + 2e3t

Example 5.5.2: Solve the following IVP

 y0 = Ay, y(0) = y0,

where  1 2   1  A = , y = . −4 −3 0 −1

Answer: Note that matrix A is identical to that in Example 5.4.2, where we have already solved the fundamental set  cos 2t   sin 2t  y (t) = e−t , y (t) = e−t . 1 − cos 2t − sin 2t 2 − sin 2t + cos 2t

118 Thus,  cos 2t sin 2t  Y (t) = [y (t) y (t)] = e−t , 1 2 − cos 2t − sin 2t − sin 2t + cos 2t and that  1 0  1  1 0   1 0  Y (0) = =⇒ Y (0)−1 = = . −1 1 1 1 1 1 1

Therefore,  1 0   1  y(t) = Y (t)Y −1(0)y = [y (t) y (t)] 0 1 2 1 1 −1  1   cos 2t  = [y (t) y (t)] = y (t) = e−t . 1 2 0 1 − cos 2t − sin 2t

Example 5.5.3: Solve the following IVP

 y0 = Ay, y(0) = y0, where  0 −1   1  A = , y = . 1 −2 0 −1

Answer: Note that matrix A is identical to that in Example 5.4.3, where we have already solved the fundamental set  1   t + 1  y (t) = e−t, y (t) = e−t. 1 1 2 t

Thus,  1 t + 1  Y (t) = [y (t) y (t)] = e−t , 1 2 1 t and that  1 1  1  0 −1   0 1  Y (0) = =⇒ Y (0)−1 = = . 1 0 (−1) −1 1 1 −1

Therefore,

 0 1   1   −1  y(t) = Y (t)Y −1(0)y = [y (t) y (t)] = [y (t) y (t)] = 0 1 2 1 −1 −1 1 2 2

 t + 1   1   2t + 1  = 2y (t) − y (t) = 2 e−t − e−t = e−t. 2 1 t 1 2t − 1

119 4.6 Wronskian and linear independence

Definition of Wronskian: For any two vector functions y1(t), y2(t) in 2D space, the Wronskian is defined as W [y1(t), y2(t)] = det [y1(t) y2(t)] .

If W [y1(t), y2(t)] 6= 0 in an open interval of t (it is still true if W [y1(t), y2(t)] = 0 for some but not all values of t in the interval), then y1(t), y2(t) are linearly independent.

It is straightforward to verify (an exercise for you) that for each fundamental matrix we obtained in previous examples det Y (t) 6= 0. Due to the result in Abel’s Theorem, det Y (t) 6= 0 for all values of t for linear systems ~y0 = A~y in which A is a constant matrix.

120 4.7 Nonhomogeneous linear systems

Theorem 5.7.1: For the following nonhomogeneous linear system

y0 = Ay + b, the general solution is

y(t) = yh(t) + yp(t) = Y (t)c + Y (t)u(t) = Y (t)[c + u(t)] . where  c  c = 1 is a vector of arbitrary constants, and c2 Z u(t) = Y (t)−1b(t)dt.

Proof: We only need to show that yp(t) = Y (t)u(t) for the vector of functions u(t) defined above.

Notice that 0 0 0 yp = Y (t)u(t) + Y (t)u (t).

0 Substitute yp(t) and yp (t) into the equation, we obtain lhs = Y 0(t)u(t) + Y (t)u0(t) = AY (t)u(t) + b = rhs which results in

Y 0(t)−AY (t)=0 or Y 0(t)=AY (t) (Y 0(t) − AY (t))u(t) + Y (t)u0(t) = b =⇒ Y (t)u0(t) = b.

Therefore, Z u0(t) = Y (t)−1b, =⇒ u(t) = Y (t)−1b(t)dt.

When deriving the previous result, we took the advantage of the fact that

Y 0(t) = AY (t) which implies that the fundamental matrix is also a solution of the linear system y’= Ay. This is because Y (t) = [y1(t) y2(t)] where both y1(t), y2(t) are solutions of the system, i.e.,

0 0 y1 = Ay1, y2 = Ay2.

Now,

0 0 0 0 Y (t) = [y1(t) y2(t)] = [y1 (t) y2 (t)] = [Ay1(t) Ay2(t)] = A [y1(t) y2(t)] = AY (t).

121 Example 5.7.1: Find the general solution for the nonhomogeneous linear system

y0 = Ay + b,

where  1 1   et  A = , b(t) = . 4 1 0

Answer: Note that matrix A is identical to that in Example 5.3.1, where we have already solved the fundamental set  1   e−t   1   e3t  y (t) = e−t = , y (t) = e3t = . 1 −2 −2e−t 2 2 2e3t

Thus,  e−t e3t  Y (t) = [y (t) y (t)] = , =⇒ det Y (t) = 4e2t. 1 2 −2e−t 2e3t

And that, 1  2e3t −e3t  1  2et −et  Y (t)−1 = = , =⇒ det Y (t) 2e−t e−t 4 2e−3t e−3t 1  2et −et   et  1  e2t  Y (t)−1b(t) = = . 4 2e−3t e−3t 0 2 e−2t

Therefore, Z Z 1  e2t  1  e2t  u(t) = Y (t)−1b(t)dt = dt = . 2 e−2t 4 −e−2t

Now,  e−t e3t  1  e2t  1  0   0  y (t) = Y (t)u(t) = = = et. p −2e−t 2e3t 4 −e−2t 4 −4et −1

The general solution is  1   1   0  y(t) = Y (t)c + y (t) = c e−t + c e3t + et. p 1 −2 2 2 −1

Example 5.7.2: Turn the nonhomogeneous second-order linear ODE y00 + y = cos t into a system of first-order ODEs. Then solve the system for y(t).

Answer: Introduce a new variable v(t) = y0(t), substitute into the equation we obtain

 y0(t) = v,  y0   0 1   y   0  =⇒ = + . v0(t) = −y + cos t v0 1 0 v cos t

122 Therefore, for our linear system  0 1   0  A = , b(t) = . −1 0 cos t

2 For this system, T r = 0, Det = 1 resulting in the ch. eq. λ + 1 = 0 ⇒ λ1, 2 = ±i.

 −i 1   1  v = ker(A − iI) = ker = . −1 −i i | {z } c1+ic2=0

The complex-valued solution is  1   cos t + i sin t   cos t   sin t  y (t) = veit = (cos t + i sin t) = = + i . c i i cos t − sin t − sin t cos t

Thus, a set of real-valued solutions are  cos t   sin t  y (t) = Re{y (t)} = , y (t) = Im{y (t)} = . 1 c − sin t 2 c cos t

The fundamental matrix is  cos t sin t  Y (t) = [y (t) y (t)] = , =⇒ det Y (t) = cos2 t + sin2 t = 1. 1 2 − sin t cos t

The inverse 1  cos t − sin t   cos t − sin t  Y (t)−1 = = . det Y (t) sin t cos t sin t cos t

Now,  cos t − sin t   0   − sin t cos t  1  − sin 2t  Y (t)−1b(t) = = = . sin t cos t cos t cos2 t 2 1 + cos 2t

Integrate it to obtain Z Z 1  − sin 2t  1  cos 2t  1  cos2 t − sin2 t  u(t) = Y (t)−1b(t)dt = dt = = . 2 1 + cos 2t 4 2t + sin 2t 4 2t + 2 sin t cos t

To get the particular solution  cos t sin t  1  cos2 t − sin2 t  1  cos t + 2t sin t  y (t) = Y (t)u(t) = = . p − sin t cos t 4 2t + 2 sin t cos t 4 sin t + 2t cos t

Take the result in the first row, we obtain 1 1 y(t) = c cos t + c sin t + (cos t + 2t sin t) = c cos t + c sin t + t sin t. 1 2 4 1 2 2

123 5 Nonlinear Systems

5.1 Some examples of nonlinear systems

E.g.1 The model of a . Consider the pendulum shown in the figure below. Assume that the mass of the rod is negligible. Based on Newton’s law

θ

m θ

mg

ma = F ⇒ mx00(t) = −mg sin θ(t) − cx0(t), where x(t) is a displacement of the mass in the direction perpendicular to the rod and c is the coefficient of the air friction. But x(t) = Lθ(t), where L is the length of the pendulum. Substitute x(t) = Lθ(t), x0(t) = Lθ0(t), x00(t) = Lθ00(t) into the equation, we obtain

mLθ00 = −mg sin θ − cLθ0 ⇒ θ00 = −ω2 sin θ − γθ0

where ω2 = g/L and γ = c/(mL). Introduce a new variable φ(t) = θ0(t), we obtain the following system of of two 1st-order ODEs

 θ0 = φ, (70) φ0 = −ω2 sin θ − γφ. The problem is that now, this system is not a linear system because of the occurrence of the nonlinear term sin θ.

E.g.2 A model of predator-prey interaction in population ecology. Consider an ecosystem that contains two major interacting animal species, for example lynx and hare in Canadian north or big fish and little fish in the Mediterranean Sea. Let x(t)=the size (i.e. the total number) of the prey population at time t; y(y)=the size (i.e. the total number) of the predator population at time t.

Now, the time evolution of the two populations can be modelled based on the following statements:

124 x’(t)=net natural birth rate (birth rate-death rate)-rate of deadly encounter with predator; y’(t)=net natural birth rate (birth rate-death rate)+rate of beneficiary encounter with prey.

It is assumed that, in the absence of the predator, the net natural birth rate of the prey is positive but the net natural birth rate of the predator is negative. Therefore, a simple model of predator-prey interaction, often called the Lotka-Volterra model, was proposed describe such kind of interaction between the two.

 x0 = ax − bxy, (71) y0 = cxy − dy, where a, b, c, d are all positive parameters. This is again a system of two 1st-order ODEs. However, this system is again nonlinear because of the appearance of the term xy which describes the probability of an encounter between a predator and a prey.

In this lecture, we will learn some skills often used in the study of nonlinear systems of 1st-order ODEs of the general form

 x0 = f(x, y), (72) y0 = g(x, y), where f(x, y), g(x, y) are differentiable functions of x and y that are nonlinear. We shall only study the case when f and g do not have explicit dependence on time t. Thus, we shall only study autonomous nonlinear systems of two nonlinear ODEs.

Remarks: Almost all systems of nonlinear ODEs cannot be solved in closed forms. Only in a few very special cases, one can solve them analytically in closed forms. The study of nonlinear ODEs is still the frontier in the study of differential equations and dynamical systems. The research remains hot and active even today and will likely remain active in the foreseeable future.

Question: If solutions can not be found, what can we do?

Answer: So far, we have tried the following approaches

(1) Qualitative methods such as phase-space analysis (partially covered here in this course).

(2) Approximation methods such as asymptotic methods (graduate level courses).

(3) Numerical and/or computational methods (widely used today in all areas).

125 5.2 Phase-plane analysis of a nonlinear system of two nonlinear ODEs

Let us introduce the basics of phase-plane analysis by using the following Lotka-Volterra model of predator-prey inteactions.

 x0 = x(a − y) = f(x, y), (73) y0 = sy(x − d) = g(x, y), where a, d, s > 0 are parameters.

Here are the goals that we try to achieve with the phase-plane analysis.

(1) Understanding the behaviour of the system near some special points of interest, typically the steady states.

(2) Using linearized approximation to sketch the phase portrait(s) of the system near the steady states (local phase portraits).

(3) Combining the phase portraits near different steady states to generate a global phase portrait and use it to predict the long term behaviour of the system, i.e. the state or states the system approaches to as t → ∞.

(4) Understanding the limitations of qualitative analysis.

126 1. Phase-space, nullclines, steady states, and vector field.

Def: Phase space. The space spanned by the unknown functions of the system. It is also referred to as the state space.

In the pendulum system, θ − φ is the phase space; in the predator-prey system x − y is the phase space.

Def: x-nullcline is the curve in phase space defined by x0 = f(x, y) = 0 on which the rate of change in x (i.e. x0) vanishes. Similarly, y-nullcline is the curve in phase space defined by y0 = g(x, y) = 0 on which the rate of change in y (i.e. y0) vanishes.

In (73), the x- and y-nullclines are given by

x-nullclines: x0 = f(x, y) = x(a − y) = 0 ⇒ x = 0, and y = a. (red in figure below.) y-nullclines: y0 = g(x, y) = sy(x − d) = 0 ⇒ y = 0, and x = d. (blue in figure below.)

y

a x’=0

y’=0 0 d x

x’=0 y’=0

Notice that The direction vectors on the x-nullclines are all vertical (because x0 = 0) and those on the y-nullclines are all horizontal (because y0 = 0).

127 Def: Steady state (Equilibrium, Critical point, Fixed point). A point in phase space where x0 = 0 = y0, i.e. the rates of change in both variables are zero. That is all points in the phase space (xs, ys) where x0 = f(x, y) = 0 and y0 = g(x, y) = 0.

By definition, these are the points of intersection between an x-nullcline and a y-nullcline! For the example above, (0, 0) and (d, a) are the two steady states.

Be careful: Point of intersection between two x-nullclines (or between two y-nullclines) is NOT a critical point! (Check the figure above!)

Def: Direction field. For an autonomous system, x0 = f(x, y) and y0 = g(x, y), the value of x0 and y0 is fixed at each point in the phase space. A simple vector addition between x0 and y0 at each point determines the direction and magnitude of the vector field at each point in phase space.

Often, we ignore the magnitude of these vectors and pay attention only to the direction of these vectors (i.e. the scaled direction field). Any solution trajectory in phase space must be tangent to the vector field at each point in the phase space!

2. Stability of a steady state and linear stability analysis.

Asymptotic stability: A steady state is asymptotically stable if all nearby phase trajectories will move closer to and eventually approach the state as t → ∞. A steady state is unstable if nearby trajectories move away from it in at least one direction.

In cases when the trajectories neither diverge nor approach a steady state (e.g. in the case of a centre), some use the word neutral others use the concept of (not asymptotic stability). But in our notes here, we often use the word stable to mean asymptotically stable. When we actually mean Lyapunov stable we would say that it is Lyapunov stable.

Linearization of nonlinear systems. To determine the stability of a steady state, sketching the vector field often is not enough. Also, the local behaviour (i.e. the behaviour in close neighbourhood) near a steady state of a nonlinear system is often qualitatively identical to that of a system that is a linear approximation of a nonlinear system. Therefore, a local phase-portrait of the linearized system often gives the correct portrait of the nonlinear system. Linearization helps both in determining the stability of a steady state and obtaining a local phase portrait of the nonlinear system.

128 Three goals of linearization and stability analysis:

• Determine the stability of a steady state.

• Characterize/classify the type of the fixed point.

• Sketch the local phase portrait(s) near the fixed point(s).

Let (xs, ys) be a steady state. Thus,

f(xs, ys) = 0,

g(xs, ys) = 0.

To study the behaviour near (xs, ys), we express the solutions as

x(t) = xs + α(t),

y(t) = ys + β(t), where (α(t), β(t)) (|α(t)|, |β(t)| << 1) measures the distance between (x(t), y(t)) and (xs, ys).

Substitute

x(t) = xs + α(t),

y(t) = ys + β(t), into the equation the differential equation, we obtain

2 2 x˙ =α ˙ = f(xs + α, ys + β) = f(xs, ys) + fx(xs, ys)α + fy(xs, ys)β + O(α , β ), ˙ 2 2 y˙ = β = g(xs + α, ys + β) = g(xs, ys) + gx(xs, ys)α + gy(xs, ys)β + O(α , β ).

Ignore the higher order terms in (α(t), β(t)), we obtain the follow system of linearized equations.

α˙ = fx(xs, ys)α + fy(xs, ys)β, ˙ β = gx(xs, ys)α + gy(xs, ys)β.

      α˙ fx fy α ˙ In matrix form = , ⇒ ~v = J(xs, ys)~v, β˙ gx gy β (xs, ys)  α  ∂f where ~v = and J(x , y ) is the Jacobian matrix evaluated at (x , y ). f = , f = β s s s s x ∂x y ∂f ∂g ∂g , g = , g = are the partial derivatives of the functions f(x, y) and g(x, y). ∂y x ∂x y ∂y

129 Now, let us carry out the linearization of the predator-prey example studied above, where f(x, y) = x(a − y), g(x, y) = sy(x − d). The Jacobian matrix is

 f f   a − y −x  J(x, y) = x y = . gx gy sy s(x − d)

For (xs, ys) = (0, 0),

 a 0  J(0, 0) = . 0 −sd

Thus,

 1   0  λ = a, ~v = ; λ = −sd, ~v = ⇒ saddle. 1 1 0 2 2 1

For (xs, ys) = (d, a),

 0 −d  J(d, a) = . as 0

Therefore, T r = 0 and Det = ads > 0.

√ √ λ1 = i ads; λ2 = −i ads ⇒ centre.

130 Local and Global Phase Portraits

Local phase portraits:

y y

x x

At (0, 0) At (d, a)

Global phase portrait:

y

a x’=0

0 d y’=0 x

x’=0 y’=0

131 Results obtained using a computer software

2 2 s=0.5, a=d=1 s=1, a=d=1

1.5 1.5

1 1 y y

0.5 0.5

0 0

-0.5 -0.5 -0.5 0 0.5 1 1.5 2 -0.5 0 0.5 1 1.5 2 x x

2 s=2, a=d=1

1.5

1 y

0.5

0

-0.5 -0.5 0 0.5 1 1.5 2 x

132 E.g.3 For the nonlinear system,  x0 = y2 − x, y0 = x2 − y. (a) Sketch the nullclines. Draw one arrow of the vector field in each distinct region of the phase space and on each distinct segment of the nullclines. Then, find all critical points and mark each by an open circle in the phase space. (b) Calculate the Jacobian matrix of the system. (c) Classify each critical point found in (a) and sketch a local phase portrait near each one. (d) Based on results above, sketch the global phase portrait. Predict the long term behaviour for two ICs: (i) (x(0), y(0)) = (0.5, 0.5); (ii) (x(0), y(0)) = (1.5, 1.5).

Answer: (a) The critical points are (0, 0) and (1, 1). Nullclines and direction arrows are all sketched below.

y y’=0

2

1

x 0 1 2

x’=0

(b)  f f   −1 2y  J(x, y) = x y = . gx gy 2x −1 (c) For (0, 0):  −1 0  J(0, 0) = . 0 −1

Thus, λ = λ1 = λ2 = −1 is repeated eigenvalue. Based on what we learned previously, (0, 0) is a stable node. However, this is a special case of stable node because of the repeated eigenvalue. We know that the corresponding eigenvalues are  1   0  ~v = , ~v = . 1 0 2 1

133 Therefore, this is a case when the algebraic multiplicity and geometric multiplicity are both equal to 2! Thus, we have repeated eigenvalue but we can find two linearly independent eigenvectors for the same eigenvalue. Actually, any nonzero vector is an eigenvector! This is because  0 0   a  E(λ) = ker(A − λI) = ker = , for any a, b that are not both zero! 0 0 b

Because all directions near (0, 0) is an eigenvector direction with λ = −1, no direction is faster or slower than the others. Thus, the trajectories are not curved but strait lines. This special case of a stable node is also called a stable star.

For (1, 1):  −1 2  J(1, 1) = . 2 −1

2 Thus, T r = −2, Det = −3. λ + 2λ − 3 = (λ − 1)(λ + 3) = 0 yields λ1 = 1 and λ2 = −3.

 −2 2   1   2 2   1  ~v = ker(A−λ I) = ker = , ~v = ker(A−λ I) = ker = . 1 1 2 −2 1 2 2 2 2 −1

Therefore, (1, 1) is a saddle point ~v2 is the stronger unstable direction. The local phase portraits are sketched below.

y y

x x

At (0, 0) At (1, 1)

134 (d) Global phase portrait is sketched below.

y y’=0

2

1

x 0 1 2

x’=0

The stable invariant set of the saddle point (green) serves as a separatrix that separates the phase space into two regions. Below it to the left, all trajectories will eventually approach the stable node (start) at (0, 0). Thus, for IC (x(0), y(0)) = (0.5, 0.5), (x(t), y(t)) → (0, 0) . Above it to the right, all trajectories will eventually approach infinity. Thus, (x(0), y(0)) = (1.5, 1.5), (x(t), y(t)) → (∞, ∞).

Below is the global phase portrait computed by a computer software. The sketch obtained above were done before we had a chance to see the computer generated portrait. Yet the similarity is striking!

135 E.g.4 A modified predator-prey interaction model in which the prey population is governed by a logistic growth model.  x0 = ax(1 − x) − xy, y0 = sy(x − d), (a, s > 0, 0 < d < 1 are parameter).

Nullclines, Steady States, and Vector Field x-nullclines: x = 0 and y = a(1 − x). y-nullclines: y = 0 and x = d.

There are 3 steady states (0,0), (1,0), and (d, a(1-d)). The vector field is given below

y 0

a

y’=0 0 d 1 x x’=0 x’=0 y’=0

(0,0), (1,0) seem to be saddles and (d, a(1-d)) a centre or a spiral.

Jacobian and Linear Stability Analysis

 a(1 − 2x) − y −x  J(x, y) = . sy s(x − d)

For (xs, ys) = (0, 0),

 a 0  J(0, 0) = . 0 −sd

136 Thus,

 1   0  λ = a, ~v = ; λ = −sd, ~v = ⇒ saddle. 1 1 0 2 2 1

For (xs, ys) = (1, 0),

 −a −1  J(1, 0) = . 0 s(1 − d)

Therefore, for 0 < d < 1

 1  λ = −a, ~v = ; λ = s(1 − d) > 0 ⇒ saddle. 1 1 0 2

For (xs, ys) = (d, a(1 − d)),

 −ad −d  J(d, a(1 − d)) = . sa(1 − d) 0

Therefore, T r = −ad < 0 and Det = ads(1 − d) > 0

T r2 a2d2 ∆ = − ads(1 − d) = − ads(1 − d) ⇒ 2 4 ad ∆ = [ad − 4s(1 − d)] 4 Therefore, if ∆ > 0, it is a stable node; if ∆ < 0, it is a stable spiral. When a << s, ∆ < 0 and (d, a(1 − d)) is a spiral.

137 Local and Global Phase Portraits in case ∆ < 0.

y y y

x x x

At (0, 0) At (1, 0) At (d, a(1−d))

y 0

a

y’=0 0 d 1 x x’=0 x’=0 y’=0

138 Results obtained using a computer software

2 s=25, a=2, d=0.5

1.5

y 1

0.5

0

-0.2 0 0.2 0.4 0.6 0.8 1 1.2 x

2

1.5 y(t)

1

0.5 x(t)

0

0 5 10 15 20 25 30 35 40

t

139 5.3 Classification and stability of isolated critical points

(1) Saddle: real λ1, λ2 6= 0 and λ1λ2 < 0 (real and of opposite signs) (i.e. Det < 0). Unstable!.

(2) Node: real λ1, λ2 6= 0 and λ1λ2 > 0 (real and of identical signs). Stable if λ1, λ2 < 0, unstable if λ1, λ2 > 0!

2 (3) Spiral/focus: When λ1, λ2 = T r/2 ± ωi are complex (i.e. Det > 0 and Det > (T r/2) ) and T r 6= 0. Stable if T r < 0, unstable if T r > 0. √ (4) Center: When λ1, λ2 = ±i Det, i.e. T r = 0 and Det > 0. Neutral.

2 (5) Stars, degenerate nodes: When λ1 = λ2 = T r/2 6= 0, i.e. Det = (T r/2) 6= 0. Stable if T r < 0, unstable if T r > 0.

Classification and stability in the Det − T r/2 plane

Since the roots of λ2 − T rλ + Det = 0 are s T r T r2 T r √ λ = ± − Det = ± ∆, 1,2 2 2 2

where T r = λ1 + λ2 and Det = λ1λ2.

Det Det ∆=(Tr/2) 2 − Det=0 Star, degenerate node λ1,2=Tr/2 λ ω λ ω 1,2=Tr/2 i 1,2=Tr/2 i Spiral Spiral Tr/2<0 Tr/2>0 stable unstable λ λ1,2<0, 1,2>0,

λ λ Center λ1 λ2 1 2 Node Node stable Tr unstable Tr ω 2 λ1,2= i λ =0, Tr 2 1,2 λ1,2 0 λ λ 1 2 <0 Saddle

ω= −∆ non−isolated fixed points

140 5.4 Conservative systems that can be solved analytically in closed forms

A can be defined as a 2nd-order ODE

x00 + f(x) = 0 (74)

where x = x(t) and f(x) is usually a nonlinear function of x. Such an equation typically arises when describing the Newtonian motion of a mass in the absence of friction and other dissipative forces. In this case, x(t) describes the location of the mass and x00(t) is the acceleration. Examples of such motions include the movement of planet under the influence of the gravitational force of the sun. Or an electrically charged particle moving in a frictionless medium under the influence of an electric potential. In case of such kind of Newtonian motion, Newton’s law yields

dV (x) ma = F ⇒ mx00 = − . dx

dV (x) R Assuming that m = 1 and dx = f(x) , one obtains equation (74). Here, V (x) = f(x)dx is often referred to as the potential function.

0 dV (x) Multiply both sides of (74) by x and express f(x) by dx , we obtain

dV (x) 1 0 1 x0x00 + x0 = 0 ⇒ (x0)2 + V (x) = 0 ⇒ (x0)2 + V (x) = C, dx 2 2

0 1 0 2 where E(x, x ) = 2 (x ) + V (x) and C is an arbitrary constant. E is referred to as the energy in . So, the energy is conserved. This is why such a system is called a conservative system. In this system, 1 Z E = (x0)2 + V (x) = C, (V (x) = f(x)dx) 2 gives all possible solutions of the system in x vs x0 space, which is actually the phase space of the corresponding system of 1st-order ODEs given below

 x0 = y, (75) y0 = −f(x).

141 E.g.5 Pendulum in frictionless medium. In absence of friction, γ = 0 in (70) we previously developed for the motion of a pendulum. In this case, the equation becomes g θ00 + ω2 sin θ = 0, (ω2 = ). L Or equivalently, the following system of 1st-order ODEs

 θ0 = φ, φ0 = −ω2 sin θ.

Based on the definition above, this is a conservative system of the form θ00 + f(θ) = 0. Therefore, the total energy 1 E = (θ0)2 + V (θ) 2 must be conserved, where Z V (θ) = ω2 sin θdθ = −ω2 cos θ.

Therefore, all solutions are expressed as 1 1 (θ0)2 + V (θ) = (θ0)2 − ω2 cos θ = C, 2 2 where C is an arbitrary constant.

0 Using the initial condition θ(0) = θ0, θ (0) = 0, we found

2 C = −ω cos θ0.

Substitute into the solution, we obtain

0 p θ = φ = ±ω cos θ − cos θ0.

Question: How do these solutions look like in the phase space (i.e. θ − φ space)?

Answer: Phase-space analysis. In the absence of a graph plotting software, we show how to sketch the phase portrait of these solutions using phase-space analysis.

142 Consider the system

 θ0 = φ, 0 2 2 g φ = −ω sin θ, (ω = L .)

There is only one θ−nullcline, i.e. φ = 0.

φ−nullclines are given by sin θ = 0, thus θ = 0, ±π, ±π + 2πn (n is any integer). Thus, there are infinitely many φ−nullclines that are evenly distributed in the horizontal axis. If we focus on the interval −π ≤ θ ≤ π, then θ = 0, ±π. Thus, there are 3 critical points in this interval: (0, 0) and (±π, 0).

Nullclines, critical points, and vector field are sketched as follows.

φ

2

θ ’ = 0 θ −2π −π 0 π 2π

−2

φ ’ = 0 φ ’ = 0 φ ’ = 0 φ ’ = 0 φ ’ = 0

The Jacobian is

 0 1  J(θ, φ) = . −ω2 cos θ 0

Thus,

 0 1  J(0, 0) = ⇒ λ2 + ω2 = 0 ⇒ λ = ±ωi, centre! −ω2 0 1,2

 0 1  J(±π, 0) = ⇒ λ2 − ω2 = 0 ⇒ λ = ±ω, saddle! ω2 0 1,2

The global phase portrait is

143 φ

2

θ

−2π −π 0 π 2π θ ’ = 0

−2

φ ’ = 0 φ ’ = 0 φ ’ = 0 φ ’ = 0 φ ’ = 0

144 E.g.6 Consider the conservative Newtonian motion in double-well potential is described by x00 = 3 dV (x) 3 x4 x2 x − x in which dx = −(x − x ), thus V (x) = 4 − 2 whose graph has the double-well shape as in the figure below.

The ODE can be transformed into the following system of nonlinear ODEs  x0 = y, y0 = x − x3. Sketch the phase portrait of representative solution curves in the phase space.

Answer: Based on the result discussed above, 1 1 x4 x2 E = x0 + V (x) = y2 + − = C 2 2 4 2 gives all solutions curves of the system. One needs a computer to help plot these curves. However, using phase-plane techniques, we can generate a sketch of the portrait. x-nullcline is y = 0 which is the horizontal axis; y-nullclines are x = −1, 0, 1 and the . Thus, there are 3 critical points: (0, 0), (±1, 0). Nullclines, critical points, and vector field are sketched in the figure below.

y

1

x’=0 x −2 −1 0 1 2

−1

y’=0y’=0 y’=0

The Jacobian matrix is  0 1  J(x, y) = . 1 − 3x2 0

145 For (0, 0):

 0 1  J(0, 0) = ⇒ T r = 0, Det = −1 ⇒ λ2 − 1 = 0 1 0

which yields two eigenvalues λ1 = −1, λ2 = 1. This is a saddle point. The corresponding eigenvec- tors are

 1 1   1   −1 1   1  ~v = ker(A − λ I) = ker = , ~v = ker(A − λ I) = ker = . 1 1 1 1 −1 2 2 1 −1 1

For (±1, 0):

 0 1  J(±1, 0) = ⇒ T r = 0, Det = 2 ⇒ λ2 + 2 = 0 −2 0 √ which yields two eigenvalues λ1, 2 = ±i 2. These two critical points are centres. The local phase portraits are given below

y y

x x

At (0, 0) At ( 1, 1)

The solution curve that goes through (0, 0) is given by

1 x4 x2 y2 + − = 0 2 4 2 √ which crosses the x-axis at 3 points: x = 0 and x = ± 2. Combining all the results above, one can sketch the following global phase portrait.

y

1

x’=0 x −2 −1 0 1 2

−1

y’=0y’=0 y’=0

146 6 Laplace Transform

6.1 Introduction - What? Why? How?

• Laplace transform (LT) is an alternative method for solving linear ODEs with constant coef- ficients.

• LT is a linear integral operation that turns an ODE into an algebraic equation.

• After solving the transformed unknown function, an inverse transform is required to obtain the desired solution.

• Pros:

(i) ODE solved together with ICs, no extra step required for finding the integration constants.

(ii) For a nonhomogeneous ODE, no need to solve yh(t) and yp(t) separately, both are solved in one step.

(iii) Particularly good when the nonhomogeneuos term g(t) is piecewise continuous, useful in engineering.

(iv) Allows the introduction of more advanced techniques like “transfer function”, ...

• Cons:

The inverse Laplace transform is often technically challenging.

6.2 Definition and calculating the transforms using the definition

Definition: Let f(t) be defined on [0, ∞) and s be a real number, then Z ∞ F (s) ≡ L[f(t)] ≡ e−stf(t) dt. (76) 0 is defined as the Laplace transform (LT) of f(t) for all values of s such that the improper integral converges. The two functions f(t) ↔ F (s) form a Lapace transform pair, i.e. F (s) is the LT of f(t) and f(t) is the inverse LT of F (s).

147 Remarks:

1. LT is an integral operator. The transform of f(t) is F (s) which is a function of s:

F (s) = L[f(t)] ⇔ f(t) = L−1[F (s)]

where L−1 represents the inverse Laplace transform.

2. LT is defined by an improper integral - a definite integral with one or both limits being unbounded. By definition,

Z ∞ Z T e−stf(t) dt ≡ lim e−stf(t)dt 0 T →∞ 0 if the limit exists (i.e. if it converges).

3. The fact the limits of this integral is between 0 and ∞ indicates that LT emphasizes the behaviour of f(t) in the future but ignores its behaviour in the past - the values of f(t) for t < 0 plays no role in its LT.

Example 4.2.1: For f(t) = 1, find F (s).

Z ∞ " T # −st 1 −st F (s) = L[f(t)] = L[1] = e (1)dt = lim − e T →∞ 0 s t=0  1  1 , if s > 0; = lim − (e−sT − 1) = s T →∞ s diverges, if s < 0.

Therefore, 1 L[1] = , (s > 0). s

Example 4.2.2: For f(t) = t, find F (s).

∞  1 Z integration by parts , if s > 0; F (s) = L[f(t)] = L[t] = e−sttdt = s2 0 diverges, if s < 0.

Therefore, 1 L[t] = , (s > 0). s2

148 Example 4.2.3: For f(t) = eat, find F (s).

Z ∞ Z ∞ ∞  1 at −st at −(s−a)t 1 −(s−a)t , if s > a; F (s) = L[e ] = e e dt = e dt = − e = s−a 0 0 s − a t=0 diverges, if s < a.

Therefore, 1 L[eat] = , (s > a). s − a

Table 2: Laplace transforms we calculated using the definition.

f(t) = L−1[F (s)] F (s) = L[f(t)]

1 1 s , s > 0

1 t s2 , s > 0

at 1 e s−a , s > a

ω sin(ωt) s2+ω2 , s > 0

s cos(ωt) s2+ω2 , s > 0

Example 4.2.4: For f(t) = cos ωt, find F (s).

Z ∞ Z ∞  −st 1  −st ∞ −st 0 F (s) = L[cos ωt] = e cos ωtdt = − e cos ωt t=0 − e (cos ωt) dt 0 s 0 1  Z ∞  1  Z ∞  s>=0 − −1 + ω e−st sin ωtdt = 1 − ω e−st sin ωtdt s 0 s 0  Z ∞  1 ω −st ∞ −st s>0 1 h ω i = 1 + e sin ωt t=0 − ω e cos ωtdt = 1 + (−ωF (s)) s s 0 s s

Now, solve this equation for F (s), we obtain s L[cos ωt] = , (s > 0). s2 + ω2

149 Similarly, for f(t) = sin ωt

ω L[sin ωt] = , (s > 0). s2 + ω2

6.3 Use a table to find Laplace transforms and the inverse

Laplace transforms and their inverses have been calculated for all frequently encountered functions. Very often, we simply need to use a table to find the transforms that we need. The table below contains most LTs that we need for the purpose of this course. More detailed forms can be found if needed. For example, based on this table we find that

3! 6 L[t3] = = , (s > 0). s4 s4

 2s    1 0 L−1 = L−1 − = −(−t) sin t = t sin t. (s2 + 1)2 s2 + 1

150 Table 3: Elementary Laplace Transforms. f(t) = L−1[F (s)] F (s) = L[f(t)]

1 1 s , s > 0

at 1 e s−a , s > a

n n! t , n ≥ 0 sn+1 , s > 0

ω sin(ωt) s2+ω2 , s > 0

s cos(ωt) s2+ω2 , s > 0

ω sinh(ωt) s2−ω2 , s > |ω|

s cosh(ωt) s2−ω2 , s > |ω|

at ω e sin(ωt) (s−a)2+ω2 , s > a

at s−a e cos(ωt) (s−a)2+ω2 , s > a

n at n! t e , n ≥ 0 (s−a)n+1 , s > a eatf(t) F (s − a)

(−t)nf(t) F (n)(s)

R t F (s) 0 f(τ)dτ s f (n)(t) snF (s) − sn−1f(0) − · · · − f (n−1)(0)

e−τs u(t − τ) s , τ > 0, s > 0

−τs u(t − τ)f(t − τ) e F (s), τ > 0, s > s0

δ(t − τ) e−τs, τ > 0

1 s f(at) a F ( a ), a > 0, s > as0 f(t) ∗ g(t) F (s)G(s), s > s0

151 6.4 More techniques involved in calculating Laplace transforms

Theorem 4.4.1 Laplace transform is linear: Suppose L[f1(t)] and L[f2(t)] are defined for s > αj, (j = 1, 2). Let s0 = max{α1, α2} and let c1, c2 be constants. Then,

L[c1f1 + c2f2] = c1L[f1] + c2L[f2], for s > s0.

Proof: Z ∞ Z ∞ by def −st −st −st L[c1f1 + c2f2] = e [c1f1 + c2f2]dt = [c1e f1 + c2e f2]dt 0 0 Z ∞ Z ∞ −st −st = c1 e f1dt + c2 e f2dt = c1L[f1] + c2L[f2]. 0 0

Remark: Laplace transform is linear because integration is linear.

Example 4.4.1: Use theorem 4.4.1 and the fact L[eat] = 1/(s − a), (s > a), calculate L[cosh ωt] and L[sinh ωt].

Answer: 1 1 1  1 1  s L[cosh ωt] = L[ (eωt + e−ωt)] = L[eωt] + L[e−ωt] = + = , (s > |ω|). 2 2 2 s − ω s + ω s2 − ω2

Similarly, 1 1 1  1 1  ω L[sinh ωt] = L[ (eωt − e−ωt)] = L[eωt] − L[e−ωt] = − = , (s > |ω|). 2 2 2 s − ω s + ω s2 − ω2

at Theorem 4.4.2 First shifting theorem: If F (s) = L[f] for s > s0, then F (s − a) = L[e f] for s > s0 + a.

Proof: Z ∞ Z ∞ F (s − a) by definition= e−(s−a)tf(t)dt = e−st eatf(t) dt by definition= L[eatf]. 0 0

n n! at n Example 4.4.2: Use the first shifting theorem and the fact L[t ] = sn+1 = F (s), calculate L[e t ]. n! L[eattn] = F (s − a) = , (s > a). (s − a)n+1

s Example 4.4.3: Use the first shifting theorem and the fact F (s) = L[cos ωt] = s2+ω2 , calculate L[eat cos ωt]. s − a L[eat cos ωt] = F (s − a) = , (s > a). (s − a)2 + ω2

152 6.5 Existence of Laplace transform

Definition of jump discontinuity: If f(t) is discontinuous at t0 but

+ − f(t0 ) − f(t0 ) is finite, then f(t) has a jump discontinuity at t = t0.

f(t)

+ f( t 0 )

− f( t 0 )

t

t1 t0

Figure 26: f(t) has a jump discontinuity at t0 but not at t1.

Definition of piecewise continuity: f(t) is piecewise continuous

(i) in [0,T ], if f(0), f(T ) are both finite, and that f(t) has a finite number of jump discontinuities in this interval;

(ii) in [0, ∞), if it is piecewise continuous in [0,T ] for all T > 0.

f(t)

t 0 T

g(t)

Figure 27: In [0,T ], f(t) is piecewise continuous although it has several jump discontinuities. g(t) is not although it has no discontinuities at all. But its value at t = 0 is not finite.

153 Definition of exponential order: f(t) is of exponential order s0 as t → ∞, if

|f(t)| ≤ Kes0t, for t > M, where K, M > 0, s0,K,M are real numbers.

Remark: f(t) is of exponential order s0 simply means that f(t) cannot approach infinity faster than the exponential function es0t as t → ∞.

Theroem 4.4.3 Existence of LT: If f(t) is piecewise continuous in [0, ∞) and of exponential order s0, then F (s) = L[f(t)] exists for s > s0.

Proof: Read Boyce and DiPrima textbook.

Example 4.5.1: Find the LT of the following piecewise continuous function

 1, if 0 ≤ t < 4; f(t) = t, if 4 ≤ t.

f(t)

4 1 0 4 t

Figure 28:

Answer: Z ∞ Z 4 Z ∞ −st −st −st L[f(t)] = e f(t)dt = e (1)dt + e tdt = I1 + I2. 0 0 4 Z 4 4 −4s −st 1 −st 1 − e I1 = e dt = − e = , (s 6= 0). 0 s 0 s Z ∞ Z ∞ Z ∞ −st t=u+4 −s(u+4) −4s −su I2 = e tdt = e (u + 4)d(u + 4) = e e (u + 4)du 4 0 0 Z ∞ Z ∞  Z ∞ Z ∞  = e−4s e−suudu + 4 e−sudu u==t e−4s e−sttdt + 4 e−stdt 0 0 0 0  1 4 = e−4s (L[t] + 4L[1]) = e−4s + , (s > 0). s2 s

154 Therefore,

1 − e−4s  1 4 1 e−4s e−4s L[f(t)] = I + I = + e−4s + = + + 3 , (s > 0). 1 2 s s2 s s s2 s

Remark: We shall demonstrate later that, using unit step functions, we can make calculating the LT of piecewise continuous functions much easier.

6.6 Laplace transform of derivatives

Theroem 4.5.1: Suppose f(t) and f 0(t) are continuous in [0, ∞) and are of exponential order 00 0 00 s0, and that f (t) is piecewise continuous in [0, ∞). Then, f, f , f have Laplace transform for s > s0, L[f 0] = sL[f] − f(0); L[f 00] = s2L[f] − f 0(0) − sf(0). Notice that the initial conditions f(0), f 0(0) naturally show up in the LTs of derivatives.

Proof:

∞ ∞ ∞ Z df =f 0 or df=f 0dt Z R R Z 0 by definition −st 0 dt −st udv=uv− vdu −st ∞ −st L[f ] = e f dt = e df = e f(t) 0 − f(t)d(e ) 0 0 0 Z ∞ Z ∞ = −f(0) − f(t)(−s)e−stdt = s f(t)e−stdt − f(0) = sL[f] − f(0). 0 0

Now, let g(t) = f 0(t).

g(t)=f0(t) L[f 00] = L[g0] use prev=. formula sL[g] − g(0) = sL[f 0] − f 0(0)

use prev. formula= again s (sL[f] − f(0)) − f 0(0) = s2L[f] − sf(0) − f 0(0).

6.7 Use Laplace transform to solve IVPs

Example 4.6.1: Use Laplace transform to solve the following IVP:

 y0 − ay = 0, y(0) = y0.

155 Answer: Apply LT to both sides of the ODE y L[y0]−aL[y] = 0 ⇒ sL[y]−y(0)−aL[y] = 0 ⇒ sY (s)−y −aY (s) = 0 ⇒ Y (s) = 0 . 0 s − a

Now, 1 eat↔ 1 y(t) = L−1[Y (s)] = y L−1[ ] =s−a y eat. 0 s − a 0

Example 4.6.2: Use Laplace transform to solve the following nonhomogeneous IVP. (Note this is identical to forced vibration in the absence of damping!)

 00 2 y + ω0y = F cos(ωt), (ω 6= ω0) y(0) = 0, y0(0) = 0.

Answer: Apply LT to both sides of the ODE F s L[y00] + ω2L[y] = F L[cos(ωt)] ⇒ s2L[y] − sy(0) − y0(0) + ω2L[y] = 0 0 s2 + ω2

2 2 F s F s ⇒ (s + ω0)Y (s) = 2 2 ⇒ Y (s) = 2 2 2 2 s + ω (s + ω )(s + ω0)

partial fractions F  s s  =⇒ Y (s) = 2 2 2 2 − 2 2 . ω0 − ω s + ω s + ω0

Now,   −1 F −1 s −1 s F y(t) = L [Y (s)] = 2 2 L [ 2 2 ] − L [ 2 2 ] = 2 2 [cos ωt − cos ω0t] , ω0 − ω s + ω s + ω0 ω0 − ω where the fact L−1 is a linear operator was used. Note that this IVP consisting of a nonhomoeneous ODE and two ICs is solved directly using Laplace transform method. No need to find yh(t) and yp(t) sparately, no need to determine the integration constants.

Definition of inverse Laplace transform L−1:

1 Z γ+iT f(t) ≡ L−1[F (s)] = lim estF (s)ds, 2πi T →∞ γ−iT where the integration is done along the vertical line Re(s) = γ in the complex plane such that γ is greater than the real part of all singularities of F(s). Since L−1 is also an integral operator, it is also linear as can be proofed in a similar way as in Theorem 4.4.1. Therefore,

−1 −1 −1 L [c1F1(s) + c2F2(s)] = c1L [F1] + c2L [F2].

156 Remark: We almost never use this definition to calculate L−1[F (s)]. Such a path integral in com- plex plane is beyond most students in second year. Since each time we calculate one L[f(t)] = F (s), it establishes a pairwise relationship between f(t) and F (s). We then can use the result for finding f(t) given F (s) as well as finding F (s) given f(t).

6.7.1 Solving IVPs involving extensive partial fractions

Example 4.7.1: Use Laplace transform solve

 y00 − 6y0 + 5y = 3e2t, y(0) = 2, y0(0) = 3.

Answer: Laplace transform both sides of the ODE and let Y (s) = L[y]:

L[3e2t] 00 0 L[y ] L[y ] z }| { z }| { z }| { 3 s2Y − sy − y0 −6 (sY − y ) +5Y = =⇒ 0 0 0 s − 2

00 0 g(t) y −6y +5y ICs 3 z }| { z }|3 { s2Y − 2s − 3 − 6sY + 12 + 5Y = =⇒ (s2 − 6s + 5)Y = 2zs}|− 9{ + . s − 2 s − 2

Notice that s2 − 6s + 5 = (s − 1)(s − 5), we obtain 3 2s − 9 3 (s − 1)(s − 5)Y = 2s − 9 + =⇒ Y (s) = + . s − 2 (s − 1)(s − 5) (s − 1)(s − 5)(s − 2)

A little bit of algebra allows us to combine the two terms into the following one rational function (s − 3)(2s − 7) Y (s) = . (s − 1)(s − 2)(s − 5)

It was relatively easy for us to solve for Y (s) but the solution we are looking for is

y(t) = L−1[Y (s)].

Unless we can find a way to break Y (s) into partial fractions, we do not know L−1[Y (s)] =?

Our goal is to achieve the following: (s − 3)(2s − 7) A B C Y (s) = = + + , (s − 1)(s − 2)(s − 5) s − 1 s − 2 s − 5

157 where the constants A, B, C can be determined by Heaviside’s method:

(s − 3)(2s − 7) (−2)(−5) 10 A = (s − 1)Y (s)|s=1 = = = = 2.5. (s − 2)(s − 5) s=1 (−1)(−4) 4

(s − 3)(2s − 7) (−1)(−3) 3 B = (s − 2)Y (s)|s=2 = = = − = −1. (s − 1)(s − 5) s=2 (1)(−3) 3

(s − 3)(2s − 7) (2)(3) 6 C = (s − 5)Y (s)|s=5 = = = = 0.5. (s − 1)(s − 2) s=5 (4)(3) 12

Thus, 2.5 (−1) 0.5 Y (s) = + + s − 1 s − 2 s − 5

Therefore,

 2.5 (−1) 0.5   1   1   1  y(t) = L−1[Y (s)] = L−1 + + = 2.5L−1 −L−1 +0.5L−1 s − 1 s − 2 s − 5 s − 1 s − 2 s − 5

= 2.5et − e2t + 0.5e5t.

Theorem 4.7.1: Suppose that

P (s) Y (s) = , (s − s1)(s − s2) ··· (s − sn)

where the degree of P (s) is smaller than n and s1, s2, ··· , sn are distinct numbers, then A A A Y (s) = 1 + 2 + ··· + n , s − s1 s − s2 s − sn where A = (s − s )Y (s)| , (for all j = 1, 2, ··· , n). j j s=sj

Proof:

A1 Aj−1 Aj+1 An (s − sj)Y (s) = (s − sj) + ··· + (s − sj) + Aj + (s − sj) + ··· + (s − sj) . s − s1 s − sj−1 s − sj+1 s − sn

158 Since all sj are distinct, only in the j − th term, this multiplicative factor cancels the denominator leaving Aj by itself. Use sigma sum notation n X Ak (s − sj)Y (s) = Aj + (s − sj) . s − sk k=1, k6=j

When s = sj, the second term of the rhs vanishes, thus

A = (s − s )Y (s)| . j j s=sj

6.7.2 Solving general IVPs involving a linear ODE with constant coefficients

Theorem 4.7.2: Consider  ay00 + by0 + cy = g(t), 0 0 y(0) = y0, y (0) = y0.

Laplace transform both sides of the ODE and let Y (s) = L[y], G(s) = L[g]:

L[y00] L[y0] z 2 }| 0 { z }| { a (s Y − sy0 − y0) +b (sY − y0) +cY = G =⇒

ay00+by0+cy ICs g(t) 2 0 z 2 }| { z }| {0 z}|{ as Y − ay0s − ay0 + bsY − by0 + cY = G =⇒ (as + bs + c)Y = (as + b)y0 + ay0 + G.

Therefore, yh with ICs yp z }| { z }| { (as + b)y + ay0 + G(s) (as + b)y + ay0 G(s) Y (s) = 0 0 = 0 0 + . as2 + bs + c as2 + bs + c as2 + bs + c

Example 4.7.2: Solve the following IVP  y00 + 3y0 + 2y = e−3t, y(0) = 0, y0(0) = 1.

Answer: Notice that as2 + bs + c = s2 + 3s + 2 = (s + 1)(s + 2) and that 1 G(s) = L[g] = L[e−3t] = . s + 3

Based on Theorem 4.7.2: 1 1 Y (s) = + . (s + 1)(s + 2) (s + 1)(s + 2)(s + 3)

159 Using Heaviside’s method 1 1 1 1 1 1 1 3 1 1 1 1 Y (s) = − + − + = − 2 + . s + 1 s + 2 2 s + 1 s + 2 2 s + 3 2 s + 1 s + 2 2 s + 3

Therefore, 3 1 1 1 1 3 1 y(t) = L−1[Y (s)] = L−1[ ] − 2L−1[ ] + L−1[ ] = e−t − 2e−2t + e−3t. 2 s + 1 s + 2 2 s + 3 2 2

Remark: Heaviside’s method applies because in this example the ch. eq. as2 + bs + c = 0 gives two distinct real roots, and that g(t) is not identical to either of the homogeneous solutions.

Example 4.7.3: Solve the following IVP

 y00 + 2y0 + y = t, y(0) = 0, y0(0) = 1.

Answer: Notice that as2 + bs + c = s2 + 2s + 1 = (s + 1)2 and that 1 G(s) = L[g] = L[t] = . s2

Based on Theorem 4.7.2: 1 1 Y (s) = + . (s + 1)2 s2(s + 1)2

Now, the inverse of first term can be readily solved but Heaviside’s method does not apply to the second term. Notice that 1 1 1 2s 1 1 1 1 1  = − − = − − 2 − − s2(s + 1)2 s2 (s + 1)2 s2(s + 1)2 s2 (s + 1)2 s s + 1 (s + 1)2

Thus 1 1 1 1 Y (s) = − 2 + 2 + 2 . s2 s s + 1 (s + 1)2

Therefore, y(t) = L−1[Y (s)] = t − 2 + 2e−t + 2te−t.

Remarks: • Heaviside’s method does not apply because in this example the ch. eq. as2 + bs + c = 0 gives two repeated real roots.

160 • We shall demonstrate later that using the convolution theorem, we can calculate the inverse LT of this kind without having to solve the partial fractions.

Example 4.7.4: Solve the following IVP

 y00 + 2y0 + 2y = 2, y(0) = 0, y0(0) = 1.

Answer: Notice that as2 + bs + c = s2 + 2s + 2 = (s + 1)2 + 1 and that 2 G(s) = L[g] = L[1] = . s

Based on Theorem 4.7.2: 1 2 Y (s) = + . (s + 1)2 + 1 s[(s + 1)2 + 1]

Now, the inverse of first term can be readily solved but Heaviside’s method does not apply to the second term. Notice that 2 A B(s + 1) + C = − , s[(s + 1)2 + 1] s (s + 1)2 + 1 where A = B = C = 1.

Thus, 1 s + 1 Y (s) = − . s (s + 1)2 + 1

Therefore, y(t) = L−1[Y (s)] = 1 − e−t cos t.

Remarks:

• Heaviside’s method does not apply because in this example the ch. eq. as2 + bs + c = 0 gives two complex roots, −α ± iβ. In this case, as2 + bs + c = (s + α)2 + β2.

• We shall demonstrate later that using the convolution theorem, we can calculate the inverse LT of this kind without having to solve the partial fractions.

161 6.7.3 Some inverse LTs where Heaviside’s method fails to apply

Example 4.7.5: Find y(t) = L−1[Y (s)] for

8 − (s + 2)(4s + 10) Y (s) = . (s + 1)(s + 2)2

Answer: In this case A B C Y (s) = + + , s + 1 s + 2 (s + 2)2

where 8 − (s + 2)(4s + 10) A = (s + 1)Y (s)|s=−1 = 2 = 8 − (1)(6) = 2. (s + 2) s=−1

2 8 − (s + 2)(4s + 10) 8 − (0)(2) C = (s + 2) Y (s) s=−2 = = = −8. s + 1 s=−2 (−1)

B has to be calculated separately using the fact

2 B 8 2(s + 2)2 + B(s + 1)(s + 2) − 8(s + 1) 8 − (s + 2)(4s + 10) Y (s) = + − = = =⇒ s + 1 s + 2 (s + 2)2 (s + 1)(s + 2)2 (s + 1)(s + 2)2

2(s + 2)2 + B(s + 1)(s + 2) − 8(s + 1) = 8 − (s + 2)(4s + 10) =s=0⇒ 8 + 2B − 8 = 8 − (2)(10) =⇒ 2B = −12 =⇒ B = −6.

Therefore 2 6 8 y(t) = L−1[Y (s)] = L−1[ ] − L−1[ ] − L−1[ ] s + 1 s + 2 (s + 2)2 = 2e−t − 6e−2t − 8te−2t.

Example 4.7.6: Find y(t) = L−1[Y (s)] for

s2 − 5s + 7 Y (s) = . (s + 2)3

Answer: In this case A B C Y (s) = + + , s + 2 (s + 2)2 (s + 2)3 where 3 2 C = (s + 2) Y (s) s=−2 = s − 5s + 7 s=−2 = 4 + 10 + 7 = 21.

A, B cannot be determined this way.

162 An alternative way is to express the numerator as a polynomial of (s + 2):

s2 − 5s + 7 = [(s + 2) − 2]2 + 5[(s + 2) − 2] + 7 = (s + 2)2 − 9(s + 2) + 21.

Now substitute back into Y (s):

s2 − 5s + 7 (s + 2)2 − 9(s + 2) + 21 1 9 21 Y (s) = = = − + . (s + 2)3 (s + 2)3 s + 2 (s + 2)2 (s + 2)3

Therefore, A = 1, B = −9, and C = 21.

Therefore 1 9 21 y(t) = L−1[Y (s)] = L−1[ ] − L−1[ ] + L−1[ ] s + 2 (s + 2)2 (s + 2)3 21 = e−2t − 9te−2t + t2e−2t. 2

Example 4.7.1: Find y(t) = L−1[Y (s)] for

1 − s(5 + 3s) Y (s) = . s[(s + 1)2 + 1]

Answer: Our goal is

1 − s(5 + 3s) A B(s + 1) + C A[(s + 1)2 + 1] + Bs(s + 1) + Cs Y (s) = = + = . s[(s + 1)2 + 1] s (s + 1)2 + 1 s[(s + 1)2 + 1]

Equating the numerators on both sides, we obtain

1 − s(5 + 3s) = A[(s + 1)2 + 1] + Bs(s + 1) + Cs.

Now, 1 s = 0, =⇒ 2A = 1 =⇒ A = . 2 5 s = −1, =⇒ A − C = 3 =⇒ C = − . 2 7 s = 1, =⇒ 5A + 2B + C = −7 =⇒ B = − . 2

Thus, 1 − 7 (s + 1) − 5 1 1 7 s + 1 5 1 Y (s) = 2 + 2 2 = − − . s (s + 1)2 + 1 2 s 2 (s + 1)2 + 1 2 (s + 1)2 + 1

163 Therefore 1 1 7 s + 1 5 1 y(t) = L−1[Y (s)] = L−1[ ] − L−1[ ] − L−1[ ] 2 s 2 (s + 1)2 + 1 2 (s + 1)2 + 1 1 7 5 = − e−t cos t − e−t sin t. 2 2 2

Example 4.7.8: Find y(t) = L−1[Y (s)] for 6 + 3s Y (s) = . (s2 + 1)(s2 + 4)

Answer: Our goal is  A B  Y (s) = (6 + 3s) − . s2 + 1 s2 + 4

1 In this example it is easy to find that A = B = 3 . Thus, 1  1 1   1 1  Y (s) = (6 + 3s) − = (2 + s) − . 3 s2 + 1 s2 + 4 s2 + 1 s2 + 4

Therefore  2 2   s s  y(t) = L−1[Y (s)] = L−1 − + L−1 − s2 + 1 s2 + 4 s2 + 1 s2 + 4 = 2 sin t − sin 2t + cos t − cos 2t.

164 6.8 Unit step/Heaviside function

Unit step (Heaviside) function is a function whose value steps up by a unit at t = 0 from 0 to 1. It is defined as  0, t < 0; u(t) = (77) 1, t ≥ 0. u(t) u(t−τ )

1 1

0 t 0 τ t

Figure 29: Heaviside function u(t) and shifted Heaviside function u(t − τ).

A shifted unit step function is a function whose value steps up by a unit at t = τ from 0 to 1 (τ > 0).  0, t < τ; u(t − τ) = (78) 1, t ≥ τ.

6.8.1 Laplace transform of u(t) and u(t − τ)

Based on definition, Z ∞ Z ∞ 1 L[u(t)] = e−stu(t) dt = e−st dt = L[1] = , (s > 0). 0 0 s Z ∞ Z ∞ Z ∞ Z ∞ e−sτ L[u(t−τ)] = e−stu(t−τ) dt = e−st dt = e−s(t+τ) d(t+τ) = e−sτ e−stdt = , (s > 0). 0 τ 0 0 s

Second Shifting Theorem: Suppose that τ > 0 and F (s) = L[f(t)] exists for s > s0. Then, −sτ L[u(t − τ)f(t − τ)] = e F (s), (s > s0).

Proof: Based on definition Z ∞ Z ∞ L[u(t − τ)f(t − τ)] = e−stu(t − τ)f(t − τ)dt = e−stf(t − τ)dt 0 τ Z ∞ Z ∞ = e−s(t+τ)f(t + τ − τ)d(t + τ) = e−sτ e−stf(t)dt = e−sτ F (s). 0 0

165 6.8.2 Expressing piecewise continuous function in terms of u(t − τ)

Consider the following piecewise continuous function

 f (t), if 0 ≤ t < τ; f(t) = 0 f1(t), if τ ≤ t.

f(t) f1 (t)

f0 (t)

0 τ t

Figure 30: Piecewise continuous function differentially defined on two intervals [0, τ) and [τ, ∞).

Using unit step function u(t − τ), we can express this function in the following form  f0(t), if 0 ≤ t < τ; f(t) = f0(t) + u(t − τ)(f1(t) − f0(t)) = f0(t) + f1(t) − f0(t) = f1(t), if τ ≤ t.

Example 4.8.1: Express the following function in terms of unit step function, then calculate its LT.  2t + 1, if 0 ≤ t < 2; f(t) = 3t, if 2 ≤ t.

Answer: f(t) = f0(t) + u(t − 2)(f1(t) − f0(t)) = 2t + 1 + u(t − 2)(3t − (2t + 1)) = 2t + 1 + u(t − 2)(t − 2 + 1) = 2t + 1 + u(t − 2)(t − 2) + u(t − 2).

The LT is 2 1 1 1 L[f(t)] = L[2t + 1] + L[u(t − 2)(t − 2)] + L[u(t − 2)(1)] = + + e−2s + e−2s . s2 s s2 s

166 Back to Example 4.5.1: Find the LT of the following piecewise continuous function  1, if 0 ≤ t < 4; f(t) = t, if 4 ≥ t.

f(t)

4 1 0 4 t

Figure 31: A piecewise continuous function.

Answer:

f(t) = f0(t) + u(t − 4)(f1(t) − f0(t)) = 1 + u(t − 4)(t − 1) = 1 + u(t − 4)(t − 4) + u(t − 4)(3).

The LT is 1 e−4s e−4s L[f(t)] = L[1] + L[u(t − 4)(t − 4)] + 3L[u(t − 4)] = + + 3 . s s2 s

Example 4.8.2: Express the following function in terms of unit step function, then calculate its LT.  sin t, if 0 ≤ t < π; f(t) = 0, if π ≤ t.

f(t) f0 (t)=sin t

f1 (t)=0 0 π t

Figure 32: A sine function with only half a cycle.

Answer:

f(t) = f0(t) + u(t − π)(f1(t) − f0(t)) = sin t + u(t − π)(0 − sin t) = sin t − u(t − π) sin t.

167 Notice that sin t = sin(t − π + π) = sin(t − π) cos π + cos(t − π) sin π = − sin(t − π).

We now have f(t) = sin t − u(t − π) sin t = sin t + u(t − π) sin(t − π).

The LT is 1 1 1 L[f(t)] = L[sin t] + L[u(t − π) sin(t − π)] = + e−πs = (1 + e−πs) . s2 + 1 s2 + 1 s2 + 1

6.8.3 Solving nonhomogeneous ODEs with piecewise continuous forcing

Example 4.8.3: Use Laplace transform to solve the following IVP  y00 + 4y = g(t), y(0) = 0, y0(0) = 1, where g(t) is defined as  sin t, if 0 ≤ t < π; g(t) = 0, if π ≤ t, which is identical to that defined Example 4.8.2.

Answer: Based on the results obtained in Example 4.8.2, 1 G(s) = L[g(t)] = (1 + e−πs) . s2 + 1

Based on Theorem 4.7.2:

yh with ICs yp z }| { z }| { (as + b)y + ay0 + G(s) (as + b)y + ay0 G(s) Y (s) = 0 0 = 0 0 + . as2 + bs + c as2 + bs + c as2 + bs + c

Substitute the ICs and the expression for G(s) into this equation, we obtain 1 G(s) 1 1 + e−πs Y (s) = + = + . s2 + 4 s2 + 4 s2 + 4 (s2 + 1)(s2 + 4)

Notice that 1 1  1 1  = − . (s2 + 1)(s2 + 4) 3 s2 + 1 s2 + 4

168 Plug it back, 1 1  1 1  e−πs  1 1  Y (s) = + − + − s2 + 4 3 s2 + 1 s2 + 4 3 s2 + 1 s2 + 4 1 2 1 1 e−πs  2 2  = + + − 3 s2 + 4 3 s2 + 1 6 s2 + 1 s2 + 4

Do the inverse transform term by term, we obtain 1 1 1 1 y(t) = L[Y (s)] = sin(2t) + sin t + u(t − π) sin(t − π) − u(t − π) sin(2(t − π)). 3 3 3 6

169 6.9 Laplace transform of integrals and inverse transform of derivatives

6.9.1 Transform of integrals. Let L[f(t)] = F (s). Thus,

Z t  F (s) L f(τ)dτ = . 0 s

Proof. Let A(t) be the anti-derivative of f(t) such that A0(t) = f(t) and that A(0) = 0. Thus,

Z t t f(τ)dτ = A(τ)|0 = A(t) − A(0) = A(t) ⇒ 0

Z t  Z ∞ −1 Z ∞ L f(τ)dτ = L [A(t)] = e−stA(t)dt = A(t)d e−st 0 0 s 0

 Z ∞  Z ∞ Z ∞ −1 −st ∞ −st 1 −st 0 1 −st F (s) = A(t)e |0 − e dA(t) = e A (t)dt = e f(t)dt = . s 0 s 0 s 0 s

 1  E.g. Find L−1 . We can use the Laplace transform pair in the opposite direction. s(s2 + 4) Ans:

    Z t −1 1 1 −1 1 2 1 −1 t 1 L 2 = L 2 2 = sin(2τ)dτ = cos(2τ)|0 = [1 − cos(2t)]. s(s + 4) 2 s s + 2 2 0 4 4

6.9.2 Inverse transform of derivatives.

Let L[f(t)] = F (s). Thus,

L [(−t)f(t)] = F 0(s) or L−1 [F 0(s)] = (−t)f(t).

170 −1 h 2s i E.g. Calculate L (s2+1)2 .

Ans:

 2s    1 0  1 0 L−1 = L−1 − = −L−1 = − [(−t) sin t] = t sin t. (s2 + 1)2 s2 + 1 s2 + 1

More generally, we have

L [(−t)nf(t)] = F (n)(s) or L−1 F (n)(s) = (−t)nf(t).

171 6.10 Impulse/Dirac delta function

Let’s define a square-wave function centred at t = 0 with unit area under it.  1 , if |t| < a, I (t) = 2a a 0, if |t| ≥ a, where a > 0.

1 2a

−a a

1 Figure 33: An impulse of width 2a and height 2a for 0 < a << 1.

Notice that Z ∞ Z a 1 The area under the curve = Ia(t)dt = dt = 1. −∞ −a 2a

A Dirac delta/impulse function is defined by making such a function infinitely high and in- finitely narrow such that the area under the curve remains one.  ∞, if t = 0, δ(t) ≡ lim Ia(t) = (79) a→0 0, elsewhere.

Important properties of an impulse function: (1) Area under the curve is equal to 1. Z ∞ Z ∞ Z a Z a 1 δ(t)dt = lim Ia(t)dt = lim Ia(t)dt = lim dt = lim 1 = 1. −∞ −∞ a→0 a→0 −a a→0 −a 2a a→0

(2) Can be shifted to give δ(t − τ)  ∞, if t = τ, δ(t − τ) ≡ lim Ia(t − τ) = a→0 0, elsewhere, which also has an area of 1 under it. Z ∞ Z τ+a 1 Z τ+a 1 δ(t − τ)dt = lim dt = lim dt = 1. −∞ τ−a a→0 2a a→0 τ−a 2a

172 (3) Z ∞ δ(t − τ)f(t)dt = f(τ), (f(t) is continuous). −∞ Proof: Z ∞ Z τ+a 1 1 Z τ+a δ(t − τ)f(t)dt = lim f(t)dt = lim f(t)dt −∞ τ−a a→0 2a a→0 2a τ−a F 0(t)=f(t) or F (t)=R f(t)dt 1 z}|{= lim [F (τ + a) − F (τ − a)] a→0 2a 1 = lim [F (τ + a) − F (τ) + F (τ) − F (τ − a)] a→0 2a 1 F (τ + a) − F (τ) F (τ) − F (τ − a) 1 = lim + = [F 0(τ) + F 0(τ)] = f(τ). 2 a→0 a a 2 (4) u0(t − τ) = δ(t − τ).

Proof: It is easy to show that u0(t − τ) satisfies all the properties of δ(t − τ) listed above.

(5) Any function centred at t = 0 with a unit area under it approaches a Dirac delta function when its height approaches infinity and width approaches zero. For example, when a Gaussian function becomes infinitely high and infinitely narrow, it becomes a Dirac delta function.

2 1 − (t−τ) δ(t − τ) = lim √ e 2σ2 . σ→0 2πσ2

Laplace transform of δ(t − τ): Z ∞ L[δ(t − τ)] = e−stδ(t − τ)dt = e−sτ , L[δ(t)] = e0 = 1. 0

Transfer function: Consider the following IVP  ay00 + by0 + cy = δ(t), y(0) = 0, y0(0) = 0.

Apply Laplace transform to both sides, 1 (as2 + bs + c)Y (s) = 1, =⇒ Y (s) = ≡ H(s), as2 + bs + c

173 where H(s) is referred to as the transfer function. h(t) = L−1[H(s)] is the solution to the IVP above.

Theorem 4.7.2: Can now be restated as follows. For  ay00 + by0 + cy = g(t), 0 0 y(0) = y0, y (0) = y0, after applying LT to both sides, we obtain

ay00+by0+cy ICs g(t) z 2 }| { z }| {0 z}|{ (as + bs + c)Y = (as + b)y0 + ay0 + G(s)

which leads to

 ICs g(t)   ICs g(t)  1 z }| { z}|{ z }| { z}|{ Y (s) = (as + b)y + ay0 + G(s) = H(s) (as + b)y + ay0 + G(s) as2 + bs + c  0 0   0 0 

0 = H(s)[(as + b)y0 + ay0] + H(s)G(s), where the first terms gives the solution to the homogenenous ODEs with the given ICs, the second gives one particular solution to the nonhomogeneous ODE with zero/trivial ICs.

6.11 Convolution product

Definition of convolution: Suppose that f(t), g(t), h(t) are continuous function and c is a constant, convolution product is defined as

Z t Z t f(t) ∗ g(t) ≡ f(τ)g(t − τ)dτ = f(t − τ)g(τ)dτ. 0 0 Convolution obeys the following rules:

(i) f ∗ g = g ∗ f, (commutative);

(ii) f ∗ (g + h) = f ∗ g + f ∗ h, (distributive);

(iii) f ∗ (g ∗ h) = (f ∗ g) ∗ h, (associative);

(iv) c(f ∗ g) = (cf) ∗ g = f ∗ (cg);

(v) f ∗ 0 = 0 ∗ f = 0.

174 Theorem 4.10.1 Laplace transform of convolution product:

If F (s) = L[f(t)] and G(s) = L[g(t)] both exist for s > a ≥ 0, then for

h(t) = f(t) ∗ g(t),H(s) = L[h(t)] = L[f(t) ∗ g(t)] = L[f(t)]L[g(t)] = F (s)G(s), (s > a).

Therefore, f(t) ∗ g(t) ↔ F (s)G(s) form a Laplace transform pair.

Proof: See textbooks.

Remark: The LT transform of the convolution product f ∗ g is the product of the respective transforms F (s)G(s), the inverse transform of the product F (s)G(s) is the convolution product of the respective inverses f ∗ g. Besides many other uses of this theorem, it definitely makes many tough inverse LTs easier to calculate.

1 1 1 1 s 0 Example 4.10.1: Given that H(s) = (s2+1)2 (the partial fraction (s2+1)2 = 2 [ s2+1 + s2+1 ] is not easy to figure out), find L−1[H(s)] using the convolution product.

Answer: Z t −1 −1 1 1 −1 1 −1 1 L [H(s)] = L [ 2 2 ] = L [ 2 ] ∗ L [ 2 ] = sin t ∗ sin t = sin τ sin(t − τ)dτ s + 1 s + 1 s + 1 s + 1 0 Notice that

sin(t − τ) = sin t cos τ − cos t sin τ. Now the above convolution becomes

Z t Z t 1 1 1 sin t ∗ sin t = sin t sin τ cos τdτ − cos t sin2 τdτ = sin3 t − t cos t + cos t sin 2t. 0 0 2 2 4

Further simplification might be possible using trig identities (exercise for you). This is the solution of the following IVP:  y00 + y = sin t, y(0) = 0, y0(0) = 0, where the forcing term resonates with the intrinsic harmonic oscillations.

Remark: Many inverse Laplace transforms that were difficult to solve using partial fractions can be solved with convolution product. The trade off is to calculate the convolution integral which could be challenging for some problems.

175 −1 h 1 i Example 4.10.2: Use convolution product to solve for L (s+1)2(s−1) .

Answer: The partial fraction for this function is

1 1  1 s + 3  1 1 1 2 Y (s) = = − = [ − − ] (s + 1)2(s − 1) 4 s − 1 (s + 1)2 4 s − 1 s + 1 (s + 1)2

which is not really easy for some students. Now, using convoltion

Z t Z t −1 −1 1 −1 1 −t t −τ t−τ t −2τ y(t) = L [Y (s)] = L [ 2 ] ∗ L [ ] = te ∗ e = τe e dτ = e τe dτ (s + 1) s − 1 0 0

integration by parts 1  1 1 1 z}|{= − et te−2t + e−2t − = et − e−t − 2te−t . 2 2 2 4

Remark: In this question, the convolution integral is not difficult at all. Whether you choose partial fractions or convolution is your own choice based on your preferences.

Example 4.10.3: Solve the following IVP for any function g(t) whose LT G(s) = L[g(t)] exists.

 y00 + y = g(t) y(0) = 3, y0(0) = −1.

Answer: Based on Theorem 4.7.2: 3s − 1 1 Y (s) = H(s)[(as + b)y + ay0 ] + H(s)G(s) = + G(s). 0 0 s2 + 1 s2 + 1

Therefore, the solution is

IC-related z }| { y(t) = L−1[Y (s)] = 3 cos t − sin t +g(t) ∗ sin t.

Remark: Now, changing the forcing term does not change the parts of the solution that is related to the ICs. For any given g(t), we just need to calculate the corresponding convolution integral to get the answer.

176