MAT 275: Modern Differential Equations Lecture Notes

Jeremiah Jones Contents

1 First-Order Equations 3 1.1 Introduction ...... 3 1.1.1 Definition of a Differential Equation ...... 3 1.1.2 Differential Equations as Physical Laws ...... 3 1.1.3 Differential Equations as Models ...... 5 1.1.4 Solutions to Some Differential Equations ...... 5 1.1.5 Verifying Solutions ...... 7 1.1.6 Classifying Differential Equations ...... 8 1.1.7 Equilibrium Solutions and Asymptotic Behavior ...... 9 1.2 Separable Equations ...... 9 1.3 First Order Linear Equations ...... 13 1.4 Modeling with First-Order Equations ...... 17 1.4.1 Radioactive Decay ...... 17 1.4.2 Newton’s Law of Cooling ...... 18 1.4.3 Solution Mixing ...... 19 1.4.4 Population Dynamics ...... 21 1.5 Exact Equations ...... 22 1.5.1 Partial Derivatives ...... 23 1.5.2 Differentials ...... 24 1.5.3 Exactness Criteria ...... 24 1.5.4 Solving Exact Equations ...... 26 1.5.5 Exact Integrating Factors ...... 28 1.6 Numerical Methods ...... 30 1.6.1 Forward Euler Method ...... 31 1.6.2 ...... 32 1.6.3 The Improved Euler Method ...... 34

2 Second-Order Equations 36 2.1 Introduction to second-order linear equations ...... 36 2.2 Second-order linear homogeneous differential equations with constant coefficients . . 36 2.2.1 Fundamental Solutions ...... 37 2.2.2 Forming a General Solution ...... 38 2.2.3 Examples ...... 38 2.3 Solutions of second-order linear equations, linear independence and the . 41 2.3.1 Operator Notation ...... 41 2.3.2 Existence of a unique solution ...... 42 2.3.3 Constant Solutions ...... 43

1 2.3.4 Linear Superposition and Linear Independence ...... 43 2.3.5 Complex Solutions ...... 44 2.3.6 Converting to a system of first-order equations ...... 45 2.4 Complex roots of the characteristic equation ...... 46 2.4.1 Euler’s Formula ...... 47 2.4.2 The General Solution ...... 49 2.4.3 Examples ...... 50 2.5 Repeated roots of the characteristic equation ...... 52 2.5.1 Reduction of order ...... 52 2.5.2 Finding the second solution ...... 53 2.5.3 Examples ...... 54 2.6 Summary of the Characteristic Solutions ...... 55 2.7 Higher-order equations ...... 56 2.7.1 Examples ...... 56 2.8 Non-homogeneous second-order linear differential equations with constant coefficients 57 2.8.1 The Particular Solution ...... 58 2.8.2 Method of Undetermined Coefficients ...... 59 2.9 The Mass-Spring System ...... 65 2.9.1 Undamped Free Oscillations ...... 67 2.9.2 Damped Free Oscillations ...... 69 2.10 LRC Series Circuits ...... 71 2.11 Forced Oscillations ...... 72 2.11.1 Forced Oscillations with damping ...... 73 2.11.2 Forced oscillations with no damping ...... 75 2.11.3 Beat Phenomenon ...... 77 2.11.4 LRC Series Circuits ...... 77 2.12 The Nonlinear Pendulum ...... 78

3 Laplace Transforms 80 3.1 Introduction ...... 80 3.1.1 Integral Transforms ...... 80 3.1.2 The Laplace Transform Definition ...... 81 3.1.3 Examples ...... 81 3.1.4 Properties of the Laplace Transform ...... 82 3.1.5 Further Examples ...... 84 3.1.6 Inversion of the Laplace Transform ...... 85 3.1.7 Table of Results ...... 88 3.2 Solving IVPs with Laplace Transforms ...... 89 3.3 Laplace Transforms of Piecewise Functions ...... 94 3.3.1 Step Functions and Piecewise Functions ...... 94 3.3.2 IVPs with Piecewise Functions ...... 97 3.4 The Impulse Function and its Laplace Transform ...... 102 3.4.1 Definition of the Impulse Function ...... 102 3.4.2 IVPs with Impulse Functions ...... 104 3.5 The Convolution Formula ...... 107

2 Chapter 1

First-Order Equations

1.1 Introduction

1.1.1 Definition of a Differential Equation A differential equation is an equation that involves a function y(x) and some of its derivatives. The order of a differential equation is the highest derivative that appears in the equation. Some examples of differential equations are

y0 + 2xy − 1 = 0 y0 − 3y = 0 1 yy0 − = 0 x y00 − 3y2 + ex = 0 y00 + 4 sin(y) = 0

Each of the above equations gives some relationship between a function y(x) and its derivatives. Solving a differential equation consists of finding all of the functions y that satisfy the equation. In general, differential equations have infinitely many solutions and extra information, referred to as initial conditions, is required in order to find a unique solution. This is related to the fact that integrating a function always results in adding an arbitrary constant. Initial conditions tell us the value of the function or one of its derivatives at a certain point. A differential equation together with initial conditions is called an initial value problem. The general form of an nth order differential equation can be stated as

F (x, y, y0, y00, ..., y(n)) = 0.

Each of the examples stated earlier are written in this form. The order of a differential equation is equal to the number of initial conditions needed to determine a unique solution. For example, first order equation require one initial condition, second order equations require two, etc.

1.1.2 Differential Equations as Physical Laws Differential equations are important to scientists and engineers because physical laws usually take the form of a differential equation. Some examples are Newton’s laws of motion, conservation of

3 mass, momentum and energy, Newton’s law of cooling, Kepler’s laws of planetary motion, etc. We will take a look at some of these more closely throughout the course.

Newton’s 2nd Law

Let y(t) denotes the position of an object with mass m at time t and F denote the total force acting on it. Then Newton’s second law takes the form a 2nd order differential equation for y(t):

F = ma(t) = mv0(t) = my00(t).

This is usually referred to as the equation of motion. In general, the force F can be a function of y and t.

Example 1.1.1. For the case of a falling object with no air resistance, F = mg, which results in Z 0 0 mv = mg ⇒ v = g ⇒ v(t) = gdt = v0 + gt

Z 1 y(t) = v(t)dt = gt2 + v t + y 2 0 0 where v0 and y0 are the initial velocity and initial height.

Example 1.1.2. Now consider a falling object with air resistance, i.e., a drag force, that is directly proportional to the velocity. There are two forces acting on the mass: gravity and drag. Assuming that down is the positive direction, the total force would be F = mg − γv where g = 9.8m/s2 is the acceleration due to gravity and γ is the drag coefficient. Newton’s 2nd law then tells us

mg − γv = mv0(t).

Newton’s Law of Cooling

Let y(t) denote the temperature of an object that is placed in a surrounding at temperature T . Then Newton’s Law of Cooling gives us a differential equation for y(t):

dy = k(T − y) dt where k > 0 is a constant called the heat transfer coefficient. The value of the constant k is determined by the thermal properties of the object. Note that if the object is hotter than its surroundings then y > T ⇒ T − y < 0 ⇒ y0 < 0. In other words, y is decreasing (giving off heat to the surroundings). On the other hand, if y is colder than T , then y0 > 0 and y is increasing. In either case, the object eventually comes into thermal equilibrium with the surroundings, i.e., y(t) → T as t → ∞.

4 1.1.3 Differential Equations as Models In the last two examples, we were given problems that have physical laws that govern them but when studying more complicated systems, we must use mathematical models. A mathematical model is a set of equations that attempts to describe a system. Modeling usually relies on logic, intuition and empirical data. For example, if we wanted to do a mathematical study of population growth, there are no physical laws we can use so we must develop a model.

The Logistic Model

One particular model for population growth is called the logistic model and takes the form of the differential equation  y  y0 = ry 1 − K where y(t) is the population at time t , r is the growth rate and K is the maximum number of individuals the population can sustain. We will study this model in depth later in the course.

1.1.4 Solutions to Some Differential Equations The easiest type of differential equations are explicit equations where y0(x) or y00(x) is given ex- plicitly in terms of x. You have already encountered these in I and they only involve integration.

Example 1.1.3. Solve the differential equation dy = x2 − ex dx Solution: Multiplying through by dx and integrating each side results in Z Z 1 dy = x2 − ex dx ⇒ y + C = x3 − ex + C . 1 3 2 Therefore, we can state the final solution as 1 y(x) = x3 − ex + C − C . 3 2 1

If we define C = C2 − C1, then we have 1 y(x) = x3 − ex + C. 3 As a general rule, we can always combine two constants this way so whenever integrating both sides of an equation, we only need to add a constant to one side. Notice that since C can have any value, we have infinitely many solutions.

Example 1.1.4. Solve the differential equation

y0 = y.

5 Solution: First rewrite the equation in differential form as dy = y. dx Multiplying each side by dx and dividing each side by y gives dy = dx. y Now that we have separated the x and y expressions on each side of the equation, we can integrate each side to obtain Z dy Z = dx ⇒ ln |y| = x + C. y Solving for |y| gives |y| = ex+C = exeC . Since ex is always positive, we can drop the absolute value bars. Defining A = eC , we then get the general solution y(x) = Aex. How can we verify the solution is correct? It should satisfy y0 = y, i.e., y should equal its own derivative. Indeed this is the case since d (Aex) = Aex. dx Example 1.1.5. Solve the differential equation for the velocity of a falling object dv m = mg − γv dt and describe its asymptotic behavior. Assume the object starts from rest.

Solution: Dividing through m gives dv γ = g − v. dt m We can rearrange this equation as dv γ = dt. g − m v Integrating each side gives Z dv Z m γ γ = dt ⇒ − ln |g − v| = t + C. g − m v γ m γ Solving for |g − m v| gives γ − γ (t+C) |g − v| = e m m Again, we can drop the absolute value bars since the right side is always positive. Now we solve for v(t) to get m  − γ (t+C) v(t) = g − e m . γ

6 We can write this as m  − γ t v(t) = g − Ae m γ − γ C where A = e m . Since the object starts from rest, we know that v satisfies the initional condition v(0) = 0, which we can use to solve for A. Plugging in t = 0 gives us m v(0) = (g − A) = 0 ⇒ A = g. γ Therefore the unique solution is mg  − γ t v(t) = 1 − e m . γ − γ t Now, what happens as t → ∞? Since γ, m > 0 we see that e m → 0 as t → ∞ and all we are left with is the first term. This is defined as the terminal velocity v∞: mg v∞ = lim v(t) = . t→∞ γ Gravity causes acceleration but since the drag is proportional to the velocity, the object can only speed up so much until eventually the drag and gravity forces balance out, at which time the object has reached terminal velocity and will remain there for the duration of the fall.

1.1.5 Verifying Solutions Verifying that a function is a solution of a differential equation is a straightforward task that only involves computing derivatives and plugging them into the equation to see if its satisfied.

Example 1.1.6. Verify that y = 3x + x2 is a solution of xy0 − y = x2.

Solution: Compute the derivative y0 = 3 + 2x and plug it in to the left side equation

xy0 − y = x(3 + 2x) − (3x + x2) = 3x + 2x2 − 3x − x2 = x2.

Since this matches the right side of the differential equation, y is a solution. Example 1.1.7. Verify that y = t−2 is a solution of t2y00 + 5ty0 + 4y = 0.

Solution: Compute the first and second derivative y0 = −2t−3, y00 = 6t−4. Plugging everything into the left side of the equation gives

t2(6t−4) + 5t(−2t−3) + 4t−2 = 6t−2 − 10t−2 + 4t−2 = 0 so y is a solution. Example 1.1.8. Verify that y = A cos(kt) + B sin(kt) is the solution to y00 + k2y = 0. Find A and B with the initial conditions y(0) = 1 and y0(0) = 2.

Solution: The first derivative of y is

y0 = −Ak sin(kt) + Bk cos(kt).

7 The second derivative is

y00 = −Ak2 cos(kt) − Bk2 sin(kt) = −k2(A cos(kt) + B sin(kt)) = −k2y.

Therefore y00 + k2y = 0. Now applying the initial conditions gives us

y(0) = A cos(0) + B sin(0) = A = 1 and y0(0) = −Ak sin(0) + Bk cos(0) = Bk = 2 ⇒ B = 2/k.

1.1.6 Classifying Differential Equations There are many ways to classify differential equations. As we go on through the class, we’ll learn different methods for handling different types of differential equations. Therefore it is important to learn how to recognize and classify properties of a differential equation so that we apply the correct solution method. One of the most important properties is the order of an equation: the highest derivative appearing in the equation. Another important property to recognize in an equation is whether it is linear or nonlinear. Recall the general definition of a differential equation

F (x, y, y0, y00, ..., y(n)) = 0.

A differential equation is linear if F is a linear function with respect to y and all of its derivatives. The general form of a linear equation is

0 00 (n) a0(x)y(x) + a1(x)y (x) + a2(x)y (x) + ... + an(x)y (x) + f(x) = 0.

Any equation that can not be stated in this form are nonlinear. For example, consider the initial examples used:

y0 + 2xy − 1 = 0 y0 − 3y = 0 1 yy0 − = 0 x y00 − 3y2 + ex = 0 y00 + 4 sin(y) = 0.

The first two equations are linear but the last three are nonlinear. Linear equations are generally easier to understand and are always guaranteed to have well-defined solutions. Nonlinear equations, on the other hand, are much more difficult and are not always guaranteed to to have solutions.

8 1.1.7 Equilibrium Solutions and Asymptotic Behavior As we have already seen, unique solutions to differential equations depend on the initial condition. In other words, for every initial condition, we get a different solution. We may ask if there are any specific initial conditions that result in certain types of solutions. The simplest type of function is a constant function so it is natural to ask if a differential equation has any constant solutions, which we refer to as equilibrium solutions. The terminology comes from the idea that constant physical systems are in a state of equilibrium with their surroundings. Let us consider differential equations of the form y0(t) = f(y). In order for a solution to be constant, we must have y0 = 0 so the equilibrium solutions are the values of y for which y0 = f(y) = 0, i.e., they are the roots of the function f.

Example 1.1.9. Find the equilibrium solutions of the equation y0 = y(1 − y2).

Solution: For this problem, f(y) = y(1 − y2) = y(1 − y)(1 + y). Setting f(y) = 0 gives three equilibrium solutions: y = −1, 0, 1. These are the initial conditions that will result in constant solutions. Example 1.1.10. Find the equilibrium solutions for the velocity of a falling object.

γ Solution: For this problem, f(v) = g − m v. Setting f(v) = 0, we get one equilibrium solu- mg tions v∞ = γ , the terminal velocity. This makes sense because the terminal velocity is the largest velocity possible so any object which starts at that velocity will stay there. Another thing to notice about the solution is that v → v∞ as t → ∞, regardless of what the initial condition is. This is an example of a stable equilibrium solution, since it “attracts” other solutions. Example 1.1.11. Classify the stability of the equilibrium solutions of y0 = y(1 − y2).

Solutions: Plot f(y) and draw phase line diagram and the flow diagram. Show that y = 0 is unstable and y = ±1 are stable. Example 1.1.12. Find and classify the equilibrium solutions for y0 = y2.

Solutions: Clearly, y = 0 is the only equilibrium solution but something new happens when we try to determine it’s stability. We see that y0 > 0 for both y < 0 and y > 0. This means that it attracts solutions with negative initial conditions but repels solutions with a positive initial condition. In other words, it is stable in one direction and unstable in the other. An equilibrium solution with this property is called semi-stable.

1.2 Separable Equations

So far, all of the differential equations we’ve seen are examples of separable equations. This means that we’ve been able to separate the expressions involving x and y on each side of the equation, which allows us to integrate each side. All separable equations can be written in the form dy M(x) = . dx N(y)

9 We can rearrange this equation to be

N(y)dy = M(x)dx and integrate each side to get Z Z N(y)dy = M(x)dx which we write as Q(y) = P (x) + C where Q(y) is the anti-derivative of N(y) and P (x) is the anti-derivative of M(x), both of which neglect the constant of integration. Now there are two possibilities: either we can solve for y (Q is an invertible function) or we can not solve for y (Q is not an invertible function). If Q is invertible than we can formally state the solution as

y(x) = Q−1(P (x) + C).

A solution of this form is called explicit because we can write y as a function of x. If Q is not invertible, then we must settle for an implicit solution of the form

F (x, y) = C.

Comparing this with our general expression above, we see that the implicit solution is

Q(y) − P (x) = C.

Each value of C represents a different curve in the (x, y) plane, along which the differential equation is satisfied. These are called the integral curves of the differential equation. Given the general initial condition, y(x0) = y0, the value of C is simply

C = Q(y0) − P (x0). A general procedure for solving a separable equation can be outlined as: 1. Get the equation in separable form: N(y)dy = M(x)dx. 2. Integrate each side to get the equation: Q(y) = P (x) + C.

3. Solve for C if given an initial condition: C = Q(y0) − P (x0). 4. If possible, algebraically solve for y to get y as a function of x. If y can not be solved for, state the implicit solution as: Q(y) − P (x) = C. Note 1: Implicit solutions generally do not appear in physical problems. In most physical prob- lems, the independent variable represents time and the dependent variable represents some physical quantity as a function of time and it doesn’t make sense for a physical quantity to have two dif- ferent values at the same time!

Note 2: In general, the domain of the solution to a nonlinear separable equation may be re- stricted and it may depend on the initial condition. We will look at some example of when this occurs.

10 dy Example 1.2.1. Solve sin(y) dx = −1/x with the initial condition y(1) = π.

Solution: We first write the equation in separable form as dx sin(y)dy = − . x Integrating each side gives

− cos(y) = − ln |x| ⇒ cos(y) = ln |x| + C.

It is often convenient to apply the initial condition before solving for y. If we apply the initial condition now, we get cos(π) = ln(1) + C ⇒ C = −1. Formally, we can solve for y to get the final solution

y(x) = cos−1(ln |x| − 1).

dy y Example 1.2.2. Solve dx = xe with the initial condition y(0) = y0.

Solution: We first write the equation in separable form as

e−ydy = xdx.

Integrating each side gives 1 −e−y = x2 + C. 2 Since the exponential function is invertible, we can solve for y to get

 1  y(x) = − ln − x2 − C . 2

Applying the initial condition gives

−y0 y(0) = − ln(−C) = y0 ⇒ C = −e so the final solution is  1  y(x) = − ln − x2 + e−y0 . 2 Let us now consider the domain of the solution. In order for the solution to be defined, the expression inside the log must be positive so √ 1 2 −y 1 2 −y − x + e 0 > 0 ⇒ x < e 0 ⇒ |x| < 2e−y0 . 2 2 √ √ Therefore the domain is the open interval (− 2e−y0 , 2e−y0 ). This example demonstrates that the domain of a solution may depend on the initial condition.

11 dy 1 Example 1.2.3. Solve dx (2x + 1) = y+ey .

Solution: We first write in separable form as 1 (y + ey)dy = dx. 2x + 1 Integrating each side gives 1 1 y2 + ey = ln |2x + 1| + C. 2 2 This is an example of an equation that can not be solved for y so we must state the solution in implicit form as 1 1 F (x, y) = y2 + ey − ln |2x + 1| = C. 2 2 Example 1.2.4. Show that the integral curves of yy0 + x = 0 are circles centered at the origin.

Solution: We first write in separable form as

ydy = −xdx.

Integrating each side gives 1 1 y2 = − x2 + C. 2 2 Multiplying through by 2, we get x2 + y2 = 2C. Note that the solution is only defined for C ≥ 0. Setting 2C = R2 for some R, we get

x2 + y2 = R2 which is the equation of a circle of radius R, centered at the origin.

dy 1 Example 1.2.5. Solve dx = 2y with the initial condition y(0) = y0.

Solution: We first write in separable form as

2ydy = dx.

Integrating each side gives y2 = x + C. Applying the initial condition, we get 2 y0 = C. Therefore the implicit solution, with this value of C, can be stated as

2 2 F (x, y) = y − x = y0.

Can we solve for y in this equation? If we try, we get q 2 y(x) = ± x + y0

12 which actually defines two possible solutions: q q 2 2 y+(x) = x + y0 or y−(x) = − x + y0.

Notice that y+(x) ≥ 0 and y−(x) ≤ 0 therefore we can determine which solution is the right one to choose by just looking at the sign of y0. If y0 > 0, then y+(x) is the solution and if y0 < 0 then y−(x) is the solution. If y0 = 0, then y+ and y− can both be solutions, so we can only state this implicitly as y2 − x = 0. For any of the possible cases, the domain is always restricted. To get a 2 2 real-valued solution, we must have x + y0 ≥ 0 so the domain is the interval [−y0, ∞).

dy x Example 1.2.6. Find the solution of dx = y−1 that passes through the point (0, 4).

Solution: We first write the equation in separable form as

(y − 1)dy = xdx.

Integrating each side gives 1 1 y2 − y = x2 + C. 2 2 To apply the initial condition, we plug in x = 0 and y = 4 to get 1 42 − 4 = C ⇒ C = 4. 2 Therefore we have 1 1 y2 − y = x2 + 4. 2 2 Multiplying the equation by 2 and moving everything to the left side gives

y2 − 2y − 8 − x2 = 0.

This is a valid for for an implicit solution but we want to try to solve for y. This is achieved by using the quadratic formula for y to get 1   1√ √ y(x) = 2 ± p4 − 4(−x2 − 8) = 1 ± 36 + 4x2 = 1 ± 9 + x2. 2 2 We now determine the plus or minus sign by considering the initial condition: √ y(0) = 1 ± 9 = 1 ± 3 = 4 which is satisfied only if we use the + sign. Therefore we can state the final solution as √ y(x) = 1 + 9 + x2.

1.3 First Order Linear Equations

The general form of a first order linear differential equation is

a(t)y(t) + b(t)y0(t) = c(t).

13 Note that the equation is called linear because it is linear with respect to y and y0 but not necessarily with respect to t. Note that we can divide this equation by a(t) to obtain a simplified form

y0(t) + p(t)y(t) = g(t) where p = b/a and g = c/a. We have not yet encountered a differential equation with this form and will need a new technique to solve it. We proceed by multiplying the equation by some unknown function µ(t), which we call an . The resulting equation is

µ(t)y0(t) + µ(t)p(t)y(t) = µ(t)g(t).

We now want to ask: can we find a function µ(t) such that the RHS can be factored into (µy)0? Using the definition of the product rule, we have

(µy)0 = µy0 + µ0y.

Comparing this with the differential equation, we see that it can be satisfied if µ(t) satisfies the differential equation µ0(t) = p(t)µ(t). We can solve this by writing it as dµ = p(t)dt µ and integrating both sides to get Z ln |µ| = p(t)dt + C.

Since we are not concerned with the initial conditions for µ, we take C = 0. Solving for µ(t) gives

R µ(t) = e p(t)dt

Now that we have function a function µ that factors the differential equation into a product, we can write it as d (µ(t)y(t)) = µ(t)g(t). dt Multiplying by dt and integrating, we get Z Z d(µ(t)y(t)) = µ(t)g(t)dt

Z µ(t)y(t) = µ(t)g(t)dt + C

1 Z  y(t) = µ(t)g(t)dt + C . µ(t) We may summarize the steps to solving a linear equation as follows:

1. Calculate the function P (t) = R p(t)dt

2. Set µ(t) = eP (t)

3. Calculate the function Q(t) = R µ(t)g(t)dt

14 4. If applicable, solve for C with an initial condition.

1 −P (t) 5. Set y(t) = µ(t) (Q(t) + C) = e (Q(t) + C)

Consider the general initial condition y(t0) = y0. Plugging this into the equation gives

y(t0) = y0 = (Q(t0) + C)/µ(t0) ⇒ C = µ(t0)y0 − Q(t0). Example 1.3.1. Solve the equation y0 + 2y = t, y(0) = 4.

Solution: For this problem, p(t) = 2 so its anti-derivative is P (t) = 2t and µ(t) = e2t. Now we compute Z Q(t) = te2tdt which requires using integration by parts. Doing so, we get 1 1 1 Q(t) = te2t − e2t = e2t(t − 1). 2 2 2 2·0 1 0 1 9 Solving for the initial condition gives C = e · 4 − 2 e (0 − 1) = 4 + 2 = 2 . Therefore the final solution is 1 9 1 y(t) = e−2t e2t(t − 1) + = t − 1 + 9e−2t 2 2 2

0 1 2 Example 1.3.2. Solve the initial value problem: y + t y = 1 − t , y(1) = 1, assuming the domain is [1, ∞).

Solution: For this problem, p(t) = 1/t so its anti-derivative is P (t) = ln |t| and µ(t) = |t|. Since we are assuming that t ≥ 1, we can drop the absolute value bars to get µ(t) = t. Now we compute Z 1 1 Q(t) = t(1 − t2)dt = t2 − t4. 2 4 Therefore the general solution is 1 1 1  y(t) = t2 − t4 + C t 2 4 Applying the initial condition gives 1 1 3 y(1) = − + C = 1 ⇒ C = 2 4 4 so the final solution is 1 1 1  1 1 1 y(t) = t2 − t4 + frac14 = t − t3 + . t 2 4 2 4 4t Example 1.3.3. Find the general solution to y0 + 3y = t + e−2t.

Solution: For this problem, p(t) = 3 so its anti-derivative is P (t) = 3t and µ(t) = e3t. Now we compute Z Z Z Q(t) = e3t(t + e−2t)dt = te3tdt + etdt.

15 The second integral is easy but the first requires using integration by parts. Using u = t and dv = e3t, we get Z 1 Z 1 1 1 te3tdt = te3t − e3tdt = te3t − e3t 3 3 3 9 Therefore 1 1 Q(t) = te3t − e3t + et 3 9 so the general solution is 1 1 1  1 1 y(t) = te3t − e3t + et + C = t − + e−2t + Ce−3t. e3t 3 9 3 9

Example 1.3.4. Find the general solution to ty0 + 2y = sin(t).

0 2 sin(t) Solution: First we must divide through by t to get the equation in the proper form: y + t y = t . 2 2 2 2 Now we have, p(t) = t so its anti-derivative is P (t) = 2 ln |t| = ln(|t| ) = ln(t ) and µ(t) = t . Now we compute Z sin(t) Z Q(t) = t2 dt = t sin(t)dt. t Again, this integral requires using integration by parts. Using u = t and dv = sin(t), we get Z Z t sin(t)dt = −t cos(t) + cos(t)dt = −t cos(t) + sin(t)

Therefore Q(t) = −t cos(t) + sin(t) so the general solution is 1 1 1 C y(t) = (−t cos(t) + sin(t) + C) = − cos(t) + sin(t) + . t2 t t2 t2 Example 1.3.5. Find the solution to y0 + 2y = e−2t with y(1) = 0.

Solution: For this problem, p(t) = 2 so its anti-derivative is P (t) = 2t and µ(t) = e2t. Now we compute Z Z 1 Q(t) = e2tte−2tdt = tdt = t2 2 So the general solutions i 1 1  1  y(t) = t2 + C = e−2t t2 + C . e2t 2 2 Applying the initial condition results in 1 1 y(1) = e−2( + C) = 0 ⇒ C = − 2 2 so the solution is 1 1 1 y(t) = e−2t t2 − = e−2t(t2 − 1). 2 2 2

16 1.4 Modeling with First-Order Equations

In this section, we will discuss some aspects of modeling with first-order differential equations and go over some examples of common models. In a physical model, we are usually interested in how a specific physical quantity (y) varies as a function of time (t). Most first order equations in physical applications have the general form dy = f(t, y) dt where the function f describes the rate at which y is changing.

A general strategy for modeling problems is given below.

1. Identify the independent variable (usually time) and the dependent variable (some physical quantity) and assign symbols to them.

2. Using some physical law, determine the form of the function f to get a differential equation.

3. Translate any extra information you are given into an initial condition.

4. Solve the initial value problem.

5. Interpret the solution in the context of the physical problem and check that it makes physical sense. For example, if y(t) represents the mass of some substance, it should always be positive and finite for any t.

It is important to keep in mind that mathematical models, even though they’re usually based on physical laws, are not perfect. Most real-world problems are far too complex to try to analyze exactly so we often make simplifying assumptions to obtain an idealized version of reality that is susceptible to mathematical analysis. How to make these assumptions while still ending up with a reasonable and useful model has always been a challenge to mathematical modelers.

Physical models often involve constant parameters that are used to quantify physical properties of the system under study. In practice, these parameters are usually determined experimentally. Many of the modeling problems we’ll study will involve parameters that may or may not be spec- ified in the problem statement. Sometimes the parameter values are not given explicitly but we are given some extra piece of information that allows us to determine their values.

1.4.1 Radioactive Decay Many elements are chemically unstable and tend to decay into lighter elements over time. The rate at which they decay is usually proportional to the current mass of the element. For example, consider a rock with mass U0 grams that starts off as pure uranium. Over time, the uranium will decay into lead at a rate proportional to the mass of uranium in the rock. Let U(t) be the mass of uranium in the rock at time t in millions of years. The initial value problem that describes this process is dU = −kU, U(0) = U dt 0

17 where k > 0 is the decay rate of uranium. The negative sign on the right hand side comes from the fact that U(t) is a decreasing function. The solution to this equation is

−kt U(t) = U0e .

Let’s check to see if it makes sense. Clearly, the initial condition U(0) = U0 is satisfied. We also see that U(t) is a strictly decreasing function and that U → 0 as t → ∞, both of which make physical sense. One important property of a radioactive element is its half-time, denoted by t1/2, which is the time that it takes to decay to half of its original mass. To find the half time, we just set 1 U(t) = U 2 0 and solve for t: 1 1 U(t) = U e−kt = U ⇒ e−kt = ⇒ −kt = ln(1/2). 0 2 0 2 Therefore, the half-time is ln(1/2) ln(2) t = − = . 1/2 k k Suppose that we don’t know the decay rate but we do know that is started off with 100 grams of uranium and there were 8 grams of left after 107 years. Keeping in mind our units, we get the extra condition U(10) = 8 which allows us to solve for k: 1 U(10) = 100e−10k = 8 ⇒ k = − ln(8/100) ≈ 0.2526 10 1.4.2 Newton’s Law of Cooling

Suppose we place an object with an initial temperature y0 in a surrounding medium with temper- ature T . Assume temperature is measured in degrees Celsius and time is measured in hours. The rate at which the object absorbs or emits heat with the surroundings is known to be proportional to the difference between the temperature of the surroundings and the temperature of the object. The initial value problem for the temperature of the object is stated mathematically as dy = k(T − y), y(0) = y dt 0 where k > 0 is the thermal conductivity of the object, which quantifies how efficiently the object and the surrounding medium transfer heat between them. One important assumption used by Newton’s Law of Cooling is that the surroundings is much larger than the object so that heat given off by the object has no effect on the surrounding temperature.

Before solving this equation, lets check to see if it makes physical sense. First, we notice that y = T is the only equilibrium solution. We should also predict that it is stable since all objects should eventually come into thermal equilibrium with their surroundings. If y > T , then y0 < 0 and the object’s temperature is decreasing. On the other hand, if y < T , then y0 > 0 and the object’s temperature is increasing. In either case, all solutions approach the equilibrium y = T so it is stable, as expected. We can say quite confidently then that

lim y(t) = T, t→∞

18 for all solutions, regardless of the initial condition. Now let’s proceed with the solution to the differential equation. Putting it in separable form, we get dy Z dy Z = kdt ⇒ = kdt ⇒ − ln |T − y| = kt + C. (T − y) T − y

Solving for y, we get y(t) = T − Ae−kt. Applying the initial condition gives

y(0) = T − A = y0 ⇒ A = T − y0 so the solution is −kt y(t) = T − (T − y0)e . The parameters for this equation are T and k and we may need to solve for one or both of them based on some other given information. As an example, let’s say y(0) = 80 degrees and T = 20 degrees. Then the solution is y(t) = 20 + 60e−kt. Suppose we are told that after 4 hours for the object is one degree hotter than the surroundings. Then we get the equation for k:

y(8) = 20 + 60e−4k = 21 ⇒ e−4k = 1/60 ⇒ k = − ln(1/60)/4 = 1.0236.

1.4.3 Solution Mixing

Consider a tank that contains a salt-water solution with V liters of water and Q0 grams of salt. The initial concentration is thus C0 = Q0/V , measured in units of grams of salt/liter. At time t = 0, a solution with concentration Cin starts to be pumped into the tank at a rate of r liters/minute. The tank is also leaking solution out of a nozzle at the bottom at the same rate r liters/minute. Assume that the solution mixes uniformly and instantaneously. We want to know the mass of salt Q(t) in the tank at any given time. The physical law that we use to model this situation is the conservation of mass, which states that the rate at which the mass is changing is the rate at which it is coming in minus the rate at which it is leaking out. Mathematically we write this as dQ = rate in − rate out dt which is the general form of a conservation law. Since the incoming solution has a constant concentration, we have rate in = rCin.

This can be checked by looking at the units of measure: r has units of liters/minute and Cin has units of grams of salt/liter so rCin has units of grams of salt/minute, which is the correct unit for dQ dt . What about the outgoing rate? This is more complicated because the solution that is leaking out of the tank has a salt concentration that is not constant, it is a function of time. Let’s call it Cout(t). Since we are told that the solution leaks out with the same rate r, we have

rate out = rCout(t).

19 In general, a concentration is the mass of salt divided by the volume of solution. The mass of salt in the tank at any time is Q(t). Since this solution is being pumped in and out at the same rate, the total volume of solution never changes, therefore it is just the initial volume V . This gives Q(t) C(t) = . V Putting everything together, we get the initial value problem for Q: dQ Q(t) = rC − rC (t) = rC − r ,Q(0) = Q . dt in out in V 0

Notice that there is one equilibrium solution: Q = VCin, which we should expect to be stable. At the beginning, the tank has some initial concentration C0, but as time goes on, all of that solution will be leaked out and eventually the tank will only contain the solution that is pumped in, which has a constant concentration. Since the volume of solution always remains constant, we expect that the mass of salt will approach the equilibrium Q∞ = VCin. Now let’s solve this equation. First we notice that is has the general form y0 = a − by, which is the same form as the model from Newton’s Law of Cooling. The solution to this equation is a a  y(t) = − − y e−bt b b 0 where y0 = y(0). For this particular example, a = rCin and b = r/V so a/b = VCin and the solution is thus −rt/V Q(t) = VCin − (VCin − Q0)e . There are many different forms that these mixing problems can take. Let’s now consider an example where the volume of solution is not constant, but varies with time. Suppose that the tank initially contains 20 liters of solution with a concentration of 2 grams of salt/liter. Therefore the initial mass of salt is Q(0) = 20 · 2 = 40 grams. The incoming solution has a concentration of 4 grams of salt/liter and is being pumped in at a rate of 8 liters/minute. The solution leaks out of the tank at a rate of 3 liters/minute. The general equation to model this problem is dQ = r C − r C (t) = 32 − 3C (t),Q(0) = 40. dt in in out out out

In general, Cout(t) = Q(t)/V (t) so we have to find V (t), the volume of solution as a function of time. This volume would be the initial volume plus the amount of solution that has been pumped in by time t minus the amount of solution that has been pumped out by time t, which is V (t) = 20 + 8t − 3t = 20 + 5t. Therefore, the initial value problem takes the form dQ Q(t) = 32 − 3 ,Q(0) = 40. dt 20 + 5t Rearranging this equation, we see that it has the general form of a first-order linear equation dQ 3 + Q = 32 dt 20 + 5t with p(t) = 3/(20 + 5t) and g(t) = 32. Integrating p(t), we get Z 3 3 dt = ln |20 + 5t| = ln((20 + 5t)3/5) 20 + 5t 5

20 so the integrating factor is µ(t) = (20 + 5t)3/5. Now we compute Z Z 32 5 µ(t)g(t)dt = 32(20 + 5t)3/5dt = (20 + 5t)8/5 = 4(20 + 5t)8/5. 5 8 Therefore the solution is Q(t) = (20 + 5t)−3/5(4(20 + 5t)8/5 + C) = 4(20 + 5t) + C(20 + 5t)−3/5. Applying the initial condition, we get Q(0) = 80 + C(20)−3/5 = 40 ⇒ C ≈ −241 so the final solution is Q(t) = 4(20 + 5t) − 241(20 + 5t)−3/5. What happens as t → ∞? We also get Q → ∞, which is obviously not a realistic solution since there is a finite amount of salt on earth! However, we should have expected this because the solution is being pumped in faster than it is leaked out, which implicitly assumes that the tank is infinitely large. In reality, the tank would eventually fill up and overflow, which would increase the rate at which the solution is leaked out. This is an example of where a simple model breaks down and requires a more sophisticated model. We can fix this by making two adjustments to the model. First, let’s say that the volume of the tank is Vtank = 40 liters. When will the tank become full? Setting V (t) = 20 + 5t = 40 and solving for t, we get t = 4. Therefore we modify the volume function to be  20 + 5t if t ≤ 4 V (t) = . Vtank if t > 4

Next, we require rout to be a function of t as follows:  3 if 20 + 5t ≤ Vtank rout(t) = . rin if 20 + 5t > Vtank

The form for rout can be deduced by considering the fact that once the tank is full, the volume of solution will no longer change so rout = rin. Once this adjustment is made, we should expect that Q → CinVtank = 160 as t → ∞ since all the initial solution will eventually be drained out and the entire tank will be filled with the incoming solution. While this model is more realistic, it is more difficult to solve by hand.

1.4.4 Population Dynamics Another area in which differential equations are used as models is population dynamics, the science of predicting the behavior of populations. Let’s consider a population with y0 initial individuals. We want to come up with a differential equation that models how the population will grow. One reasonable assumption is that the rate at which the population grows is proportional to the population itself. This would result in the equation dy = ky, y(0) = y dt 0 21 which as the solution kt y(t) = y0e where k is the reproduction rate. However, there is a problem with this model: the population just grows exponentially which is not realistic. In reality, any specific habitat can only sustain so many individuals. If the habitat is overpopulated, there will not be enough resources for everyone, which will cause many to die, which in turn affects the reproduction rate. So how can we fix the model? Instead of assuming a constant reproduction rate, let’s assume that the rate can depend on the population, which gives us a general differential equation of the form dy = k(y)y, y(0) = y . dt 0 Now all the modeling goes into how we specify the function k(y), which is usually done through a combination of empirical data and intuition. A simple but effective model is the logistic model, which uses k(y) = r(1 − y/K) where r is called the intrinsic growth rate and K is called the carrying capacity. The intrinsic growth rate represent the average rate at which any individual reproduces and the carrying capacity represents the maximum number of individuals that the habit can sustain. These parameters are usually determined experimentally and incorporate many aspects of the habitat and population, like raw resource scarcity, food production, sexual activity, etc. In full form, the logistic model is dy = ry(1 − y/K). dt Notice that there are two equilibrium solutions: y = 0, which is unstable and y = K, which is stable. So, if y0 < K, the population will increase up to the carrying capacity and if y0 > K, then it will decrease to the carrying capacity. We can also add an extra term to the logistic model to represent periodic harvesting, i.e., fluctuations in the population based on resource availability. One way to model this would be dy = ry(1 − y/K) + sin(πt/p) dt where p represents the period of time between the harvests (the good times). One limitation of the logistic model is that it does not include catastrophic random events that can dramatically change the population or even result in extinction. More advanced population models use stochastic differential equations that include random effects. In reality, the dynamics of population growth are so complex and depend on so many inter-related factors that it is impossible to come up with a model that can make very accurate predictions. However, we can usually use models to extract some useful information about how the population changes in an average way.

1.5 Exact Equations

In this section, we will study how to solve a specific type of differential equation, called an exact equation. However, the solution technique will require a new concept called a partial derivative, which is a subject of multi-variable calculus.

22 1.5.1 Partial Derivatives Consider a function of two variables, f(x, y). How can we extend the idea of a derivative to a function with more than one variable? A partial derivative of f is defined as the derivative with respect to one of the variables while all other variables are treated as constants. For a function of two variables, there are two possible partial derivatives: ∂f ∂f and . ∂x ∂y df Note that this is similar to the differential notation dx from single-variable calculus, but we use the symbol ∂ instead of d to emphasize that it is a partial derivative. Another common notation for partial derivatives is to just write the function symbol f and use subscripts of x or y to denote partial differentiation, such as ∂f ∂f f = , f = . x ∂x y ∂y The technical definition of a partial derivative is very similar to the definition of an ordinary derivative: ∂f f(x + h, y) − f(x, y) ∂f f(x, y + h) − f(x, y) = lim , = lim ∂x h→0 h ∂y h→0 h √ Example 1.5.1. Compute the partial derivatives of the function f(x, y) = x/ y.

Solution: First we write the function as f(x, y) = xy−1/2. To compute the partial derivative with respect to x, we treat y as a constant and get ∂f = y−1/2. ∂x Likewise, for the partial derivative with respect to y, we treat x as a constant and get ∂f 1 = − xy−3/2. ∂y 2 Example 1.5.2. Compute the partial derivatives of the function f(x, y) = x2y3 sin(2y) + y − x .

Solution: The partial derivative with respect to x is ∂f = 2xy3 sin(2y) − 1. ∂x For the partial derivative with respect to y, we have to use the product rule: ∂f = 3x2y2 sin(2y) + 2x2y3 cos(2y) + 1. ∂y Example 1.5.3. Compute the partial derivatives of the function f(x, y) = xye−x2−y2 .

Solution: Using the product rule, the partial derivative with respect to x is

∂f 2 2 2 2 2 2 = ye−x −y − 2x2ye−x −y = (1 − 2x2)ye−x −y . ∂x Likewise, the partial derivative with respect to y is

∂f 2 2 2 2 2 2 = xe−x −y − 2xy2e−x −y = (1 − 2y2)xe−x −y . ∂y

23 Example 1.5.4. Compute the partial derivatives of the function f(x, y) = (x2 + 3y2)−1 .

Solution: The partial derivative with respect to x is ∂f = −(x2 + 3y2)−2(2x) = −2x(x2 + y2)−2. ∂x Likewise, the partial derivative with respect to y is ∂f = −2(x2 + 3y2)−2(6y) = −12y(x2 + 3y2)−2. ∂y What about second derivatives? For a function of two variables, there are actually four possible second partial derivatives: ∂ ∂f  ∂ ∂f  f = , f = xx ∂x ∂x yy ∂y ∂y

∂ ∂f  ∂ ∂f  f = , f = . xy ∂x ∂y yx ∂y ∂x However, one important property of partial derivatives is that they can be applied in any order, therefore the two mixed second partial derivatives are always equal:

fxy = fyx.

1.5.2 Differentials The concept of a differential can also be extended to functions of multiple variables. For a function of one variable, y = f(x), we interpret the differential dy = f 0(x)dx as the amount that the function rises between x and x + dx. Likewise, for a multi-variable function z = f(x, y), we interpret the differential dz as the amount that the function rises between the points (x, y) and (x + dx, y + dy). In order to pick up the contributions from both x and y, the differential is defined as ∂f ∂f dz = dx + dy. ∂x ∂y The first term represents the change in z in the x direction and the second term represents the change in z in the y direction.

1.5.3 Exactness Criteria Now suppose we have a differential equation of the form

M(x, y)dx + N(x, y)dy = 0.

In general, such an equation would usually be impossible to solve. However, if the equation is exact, than it is possible to get at least an implicit solution. A differentiation equation of this form is exact if there exists some function φ(x, y) such that ∂φ ∂φ = M(x, y) and = N(x, y). ∂x ∂y

24 Assuming that such a function does exist, then we can plug these formulas into the differential equation to get ∂φ ∂φ dx + dy = 0. ∂x ∂y Notice that this is exactly the differential of φ so we have

dφ = 0 which means that φ(x, y) must be a constant and therefore

φ(x, y) = C is an implicit solution to the differential equation. However, finding this function may involve a good deal of work so it would be helpful to have a method of determining if an equation is exact or not before we attempt to find a solution. Let us assume that the equation is exact. Using the fact that mixed second partial derivatives can be done in either order, we know that

∂ ∂φ ∂ ∂φ = . ∂x ∂y ∂y ∂x

Now using the fact that ∂φ ∂φ = M(x, y) and = N(x, y). ∂x ∂y we get the condition ∂N ∂M = . ∂x ∂y Therefore a differential equation of the form

M(x, y)dx + N(x, y)dy = 0 is exact if and only if M and N satisfy the relation ∂N ∂M = ∂x ∂y or in subscript notation Nx = My. Note that this is an equation that involves partial derivatives and is therefore referred to as a partial differential equation (PDE), as opposed to an ordinary differential equation (ODE) that only involve single-variable functions and derivatives. This class is all about ODEs but there are many physical laws and models that take the form of PDEs, which you will most likely learn about in future classes.

25 1.5.4 Solving Exact Equations Example 1.5.5. Determine if the differential equation is exact or not. If so, find an implicit solution in the form φ(x, y) = C.

dy (9x2 + y − 1) + (x − 4y) = 0 dx Solution: At first, this does not appear to have the correct form of an exact equation but if we multiply through by dx, we get

(9x2 + y − 1)dx + (x − 4y)dy = 0 which has the correct form with M(x, y) = 9x2 +y −1 and N(x, y) = x−4y. To check if it’s exact, we compute Nx = 1 and My = 1 so Nx = My and the equation is exact. To find the function φ(x, y), we begin by setting ∂φ = M(x, y) = 9x2 + y − 1. ∂x Integrating with respect to x and treating y as a constant, we get

φ(x, y) = 3x3 + xy − x + G(y).

Notice that instead of adding a constant, we added G(y), an arbitrary function of y. This is because we integrated with respect to x and any function of y is constant with respect to x. This can be seen by taking the partial derivative with respect to x of the above equation: we would still get φx = M(x, y), no matter what G is because Gx = 0. To solve for G(y), we set ∂φ = N(x, y) ⇒ x + G0(y) = x − 4y ⇒ G0(y) = −4y. ∂y

Integrating the last equation and neglecting the constant of integration, we get G(y) = −2y2. Note that when solving for φ(x, y), we do not need to include any constants since φ can be shifted by an constant and still be a solution. Therefore, we have

φ(x, y) = 3x3 + xy − x − 2y2 = C is the implicit solution.

Example 1.5.6. Determine if the differential equation is exact or not. If so, find the implicit solution that passes through the point (1, 3).

(y/x + 6x)dx + (ln(x) + 5)dy = 0.

Solution: For this problem , we have Nx = 1/x and My = 1/x so the equation is exact. Now we set ∂φ = M(x, y) = y/x + 6x ∂x and integrate each side with respect to x to obtain

φ(x, y) = y ln(x) + 3x2 + G(y).

26 Now we set φy = N(x, y) to get 0 φy = ln(x) + G (y) = ln(x) + 5 which gives us the equation G0(y) = 5 so G(y) = 5y. Therefore, the implicit solution is φ(x, y) = y ln(x) + 3x2 + 5y = C. Applying the initial condition gives φ(1, 3) = 3 ln(1) + 3(1)2 + 5(3) = 18 = C. Therefore the implicit solution is φ(x, y) = y ln(x) + 3x2 + 5y = 18. Example 1.5.7. Determine if the differential equation is exact or not. If so, find the explicit solution that passes through the point (−3, 1).

(2xy2 + 2y)dx + (2x2y + 2x)dy = 0.

Solution: For this problem , we have Nx = 4xy + 2 and My = 4xy + 2 so the equation is exact. Now we set ∂φ = M(x, y) = 2xy2 + 2y ∂x and integrate each side with respect to x to obtain φ(x, y) = x2y2 + 2xy + G(y).

Now we set φy = N(x, y) to get 2 2 φy = 2x y + 2x + G(y) = 2x y + 2x which gives us the equation G0(y) = 0 so G(y) = 0. Therefore, the implicit solution is φ(x, y) = x2y2 + 2xy = C. Applying the initial condition gives φ(−3, 1) = (−3)2(1)2 + 2(−3)(1) = 3 = C. Therefore the implicit solution is φ(x, y) = x2y2 + 2xy = 3. To get the explicit solution, we solve for y using the quadratic formula: √ −2x ± 4x2 + 12x2 −2x ± 4x x2y2 + 2xy − 3 = 0 ⇒ y(x) = = . 2x2 2x2 There are now two possible solutions (one with the plus sign and one with the minus sign): 1 3 y (x) = or y (x) = − . + x − x

To determine which one is correct, we check the initial condition and see that y+(−3) = −1/3 and y−(−3) = 1 so y−(x) is the correct one and the explicit solution is thus 3 y(x) = − . x

27 The steps to solving an exact equation can be summarized as

1. Put the equation in the form M(x, y)dx + N(x, y)dy = 0.

2. Make sure its exact by checking if Nx = My.

∂φ 3. Set ∂x = M(x, y) and integrate each side with respect to x to get Z φ(x, y) = M(x, y)dx + G(y).

∂φ 4. Using φ from the previous step, set ∂y = N(x, y) to get a differential equation for G of the form G0(y) = p(y).

5. Integrate the differential equation for G to get Z G(y) = p(y)dy.

6. Plug G(y) into the formula for φ and define φ(x, y) = C as the implicit solution.

7. If applicable, apply an initial condition to solve for C. If the initial condition is y(x0) = y0, then C = φ(x0, y0).

1.5.5 Exact Integrating Factors It is sometimes possible to use the integrating factor technique to transform an inexact equation into an exact one. Consider the differential equation dy M(x, y) + N(x, y) = 0 dx and suppose we multiply through by some unknown integrating factor µ(x, y) to get

dy µ(x, y)M(x, y) + µ(x, y)N(x, y) = 0. dx This equation can be made exact if we can find an integrating factor such that ∂ ∂ (µM) = (µN). ∂y ∂x

Unfortunately, there is no systematic method for finding such a function µ(x, y), which can make it quite difficult. However, one special case is if the integrating factor is only a function of one variable. To demonstrate this, let’s assume µ is only a function of x. Then the above PDE becomes dµ µM = N + µN y dx x which can be rearranged as dµ M − N = y x µ. dx N

28 dµ My−Nx Since dx must be a function of x only, we get the condition that N must only depend on x. Therefore, we can only use the integrating factor µ(x) if ∂ M − N  y x = 0. ∂y N Assuming this condition is satisfied, we end up with a separable equation for µ(x). Once we have found µ(x), we can solve the original problem by multiplying through by µ(x) and applying the method for exact equations already discussed. We could instead look for an integrating factor that is only a function of y which results in the equation dµ N − M = x y µ dy M and therefore requires the condition that ∂ N − M  x y = 0. ∂x M Example 1.5.8. Show that differential equation (x + 2) sin(y)dx + x cos(y)dy = 0 is not exact but can be made so by using an integrating factor that only depends of x. Find the integrating factor and show that the equation becomes exact after multiplying it by the integrating factor.

Solution: The equation is not exact because Nx = cos(y) but My = (x + 2) cos(y). However, we notice that M − N (x + 2) cos(y) − cos(y) x + 1 1 y x = = = 1 + N x cos(y) x x only depends on x so we may use an integrating factor that is a function of x. To find the integrating factor, we must solve the equation dµ  1  = 1 + µ. dx x Putting it in separable form gives dµ  1  = 1 + dx. µ x Integrating both sides results in ln |µ| = x + ln(x). and solving for µ, we get µ(x) = ex+ln x = exeln(x) = xex. Multiplying the equation through by µ(x), we get xex(x + 2) sin(y)dx + x2ex cos(y)dy = 0. Now we have x 2 x x Nx = (2xe + x e ) cos(y) = (2 + x)xe cos(y) and x My = xe (x + 2) cos(y) so Nx = My and the equation is now exact.

29 1.6 Numerical Methods

All of the first-order differential equations we have looked at so far can be solved symbolically using standard techniques. However, in practice, we often encounter differential equations for which it is impossible to to find an exact solution and we must therefore resort to a numerical method to find an approximate solution. For example, consider the equation dy = y + sin(y). dt Although this equation is separable, it requires us to compute the integral Z 1 dy y + sin(y) which does not have a known solution. In this section, we will cover some of the most basic nu- merical methods, known as Euler methods.

Consider the problem of finding a numerical solution of the initial value problem dy = f(t, y), y(a) = y , a ≤ t ≤ b. dt 0 The first step to approaching this problem is to define a finite set of t-values where we will approx- imate the solution. Suppose we divide the interval [a, b] into M sub-intervals of equal width. This defines an equally-spaced sequence of M + 1 t-values: (t0, t1, ..., tM ), referred to as a grid, that are all separated by a spacing of b − a h = . M Therefore the grid points are (t0, t1, ..., tM ) = (a, a + h, a + 2h, ..., b). In general, the nth grid point is tn = a + hn, n = 0, 1, ..., M. These are the points at which we will approximate the solution of the differential equation. The numerical solution is a sequence of M + 1 values (y0, y1, ..., yM ) with yn ≈ y(tn).

Since we always start with an initial condition, the value of y0 is always exact but y1, ..., yM will be numerically approximated. The error of the numerical method at the nth grid point is defined as en = |y(tn) − yn| where y(tn) is the exact solution. For most problems, we can’t compute the error because we don’t know the exact solution. However, we often apply numerical methods to problems that can be solved exactly so we can learn about how the error behaves. Any acceptable numerical method must have the property that en → 0 as M → ∞. Note that when M → ∞, h → 0. In other words, as we increase the number of grid points, the grid spacing goes to zero and the finite grid becomes a continuous interval.

Now that we have set the problem up and know what our goal is, we need a method for ap- proximating the solution. In order to do so, we need a way of approximating a derivative. There are several possible ways of doing this, some better than others, and each method of approxima- tion defines a unique numerical method. In these notes, we’ll consider a few different derivative approximations and the numerical methods they give rise to.

30 1.6.1 Forward Euler Method Recall the technical definition of a derivative: dy y(t + h) − y(t) = lim . dt h→0 h If the grid spacing h is relatively small, then the derivative can be approximated as dy y(t + h) − y(t) ≈ . dt h

Since tn + h = tn+1, we therefore approximate the derivative at the nth grid point as dy  y(t + h) − y(t) y − y = = n+1 n dt n h h The differential equation tells us that dy/dt = f(t, y), so we can approximate the differential equation at every grid point as y − y n+1 n = f(t , y ). h n n

Solving for yn+1, gives us the equation

yn+1 = yn + hf(tn, yn) which defines the Euler method, or more specifically, the forward Euler method. The above equa- tion is an example of a recursion relation for the sequence (y0, y1, ..., yM ). A recursion relation gives a formula for an element of a sequence in terms of previous elements. Notice that the formula for yn+1 can be computed strictly in terms of the previous value, yn. In other words, if we know the solution at any given grid point n, we can find the solution at the next grid point, n + 1. Methods of this type are referred to as explicit methods. Since we always start with an initial condition y0, we can compute y1. With y1, we can compute y2 and so on, all the way to the final point yM . The Euler method has been observed to produce errors that are proportional to the grid spacing and this can be proved rigorously using a expansion. In other words if we were to plot the error at a given point for several values of h, we would observe that en ≈ Ch for some constant C. Therefore, we should expect the error in a numerical solution using Euler’s method to be around the same order of magnitude as the grid spacing.

Example 1.6.1. Approximate the values of the solution to the initial value problem dy = 2t − 5y, y(0) = 1 dt in the interval [0, 1] using the Euler method with M = 2 subintervals.

Solution: For this problem, a = 0, b = 1 and M = 2 so h = (1 − 0)/2 = 1/2 and there are 3 grid points: (t0, t1, t2) = (0, 1/2, 1). We need to compute the numerical solution values (y0, y1, y2). We already know that y0 = 1 so using the Euler method for y1, we get 1 5 3 y = y + hf(t , y ) = 1 + (2 · 0 − 5 · 1) = 1 − = − . 1 0 0 0 2 2 2 31 Applying the method again to get y2 gives us 3 1  1  3 3 1 17 11 y = y + hf(t , y ) = − + 2 · − 5 − = − + = . 2 1 1 1 2 2 2 2 2 2 2 4 The exact solution to this problem can be found using an integrating factor: 1 y(t) = (10t − 2 + 27e−5t) 25 and the exact solution values at the grid points are

y(1/2) ≈ 0.2087, y(1) ≈ 0.3273 which are nowhere close to the numerical solution, which we should expect since h = 1/2 is too large to result in an accurate solution. In fact, if we were to keep going out to a larger value of t in this last example, we would see that the error begins to grow exponentially. This illustrates the important concept of numerical instability. A numerical method is defined to be unstable if the error grows exponentially. The Euler method as we have defined it, can be unstable if h is too large. Therefore one must take care to use a large number of grid points (small h) when using this method to ensure stability. In practice, the Euler method is not usually used because of this property, but it is the easiest numerical method to learn so it serves as a good introduction. The Euler method can be modified to ensure stability but the resulting equations are more difficult to solve. This modification is called the backward Euler method.

1.6.2 Backward Euler Method Recall that we originally approximated the differential equation as y − y n+1 n = f(t , y ). h n n For the backward Euler method, we instead use y − y n+1 n = f(t , y ) h n+1 n+1 which gives us the equation yn+1 = yn + hf(tn+1, yn+1). The word ‘backward” is meant to emphasize the fact that we are approximating the derivative to a function at a point using the previous point. In the forward Euler method, we approximate the derivative at a point using the next point. The error resulting from the backward Euler method is also proportional to h so it is about as accurate as the the forward Euler method, except when the forward Euler method is unstable. The backward Euler method is always guaranteed to be stable but it can be difficult to apply in all but the simplest cases. This is because it is an implicit method, i.e., the numerical solution can not just be updated in terms of the old solution: we are required to solve an equation for yn+1. Let us apply the backward Euler method to the previous example to see how it works.

32 Example 1.6.2. Approximate the values of the solution to the initial value problem dy = 2t − 5y, y(0) = 1 dt in the interval [0, 1] using the backward Euler method with M = 2 subintervals.

Solution: As before, a = 0, b = 1 and M = 2 so h = (1 − 0)/2 = 1/2 and there are 3 grid points: (t0, t1, t2) = (0, 1/2, 1). We need to compute the numerical solution values (y0, y1, y2). Using the backward Euler formula, we get

yn+1 = yn + h(2tn+1 − 5yn+1).

Notice that we now need to solve for yn+1. Rearranging, we get y + 2ht y + 2h(t + h) (1 + 5h)y = y + 2ht ⇒ y = n n+1 = n n . n+1 n n+1 n+1 1 + 5h 1 + 5h

Using this formula, we can compute y1 and y2:

1 1 y0 + 2h(t0 + h) 1 + 2 2 (0 + 2 ) 3/2 3 y1 = = 1 = = ≈ 0.4286 1 + 5h 1 + 5 · 2 7/2 7

3 1 1 1 y1 + 2h(t1 + h) 7 + 2 2 ( 2 + 2 ) 10/7 20 y2 = = 1 = = ≈ 0.4082 1 + 5h 1 + 5 · 2 7/2 49 Comparing these values with the exact solution, we see that the backward Euler method is pro- viding better results than the forward Euler method. Note that the Euler method is not always easy to apply. The differential equation we are working with is linear, which is what allowed us to solve for yn+1. If the equation was nonlinear, then we would have to solve a nonlinear equation for yn+1, which is not always possible. Example 1.6.3. Show that the initial value problem dy = t sin(y), y(0) = 1 dt can not be solved with the backward Euler method.

Solution: Using the backward Euler formula, we get

yn+1 = yn + htn+1 sin(yn+1).

Notice that this is a transcendental equation for yn+1 that is impossible to solve by hand. Therefore, in order to use an implicit method on a nonlinear differential equation, we must also have a numerical method, such as Newton’s method, to solve the resulting nonlinear algebraic equation for yn+1.

33 1.6.3 The Improved Euler Method So far, we have seen two different ways to approximate a derivative: the forward approximation y − y n+1 n = f(t , y ) h n n and the backward approximation y − y n+1 n = f(t , y ). h n+1 n+1 The trapezoidal method averages these two methods to get a more accurate method: y − y 1 n+1 n = (f(t , y ) + f(t , y )) h 2 n n n+1 n+1 which results in the method 1 y = y + h (f(t , y ) + f(t , y )) . n+1 n 2 n n n+1 n+1 This method is more accurate than the previous methods. Both the forward and backward Euler methods produce errors proportional to h but the error from the trapezoid method is proportional to h2. Therefore, if we used a grid spacing of h = 10−2, we would expect the error from the trape- zoid method to be on the order of 10−4. In general, all numerical methods will produce errors that are proportional to some power of h, i.e., error ∼ hp for some p. We then say that the method is pth-order accurate. The forward and backward Euler methods are both first-order accurate and the trapezoid method is second-order accurate.

Unfortunately, the trapezoid method is an implicit method, which is not practical to use for nonlinear problems since it requires us to solve for yn+1. Is it possible to approximate the trape- zoid method to get an explicit second-order accurate method? The answer is yes, which gives us the improved Euler method. We can approximate the yn+1 on the right side of the trapezoid equation using the forward Euler method as

yn+1 = yn + hf(tn, yn). Now we use the trapezoid method with this approximation on the right hand side to get 1 y = y + h (f(t , y ) + f(t , y + hf(t , y ))) , n+1 n 2 n n n+1 n n n which provides an explicit formula for yn+1 and is second-order accurate. The above formula is a bit clunky so a more organized way of defining the improved Euler method in four steps is

f1 = f(tn, yn) ∗ yn = yn + hf1 ∗ f2 = f(tn + h, yn) h y = y + (f + f ) n+1 n 2 1 2 Let us return to the first example and apply the improved Euler method to it.

34 Example 1.6.4. Approximate the values of the solution to the initial value problem dy = 2t − 5y, y(0) = 1 dt in the interval [0, 1] using the improved Euler method with M = 2 subintervals.

Solution: As before, a = 0, b = 1 and M = 2 so h = (1 − 0)/2 = 1/2 and there are 3 grid points: (t0, t1, t2) = (0, 1/2, 1). We need to compute the numerical solution values (y0, y1, y2). Using the improved Euler formula for y1, we get

f1 = 2t0 − 5y0 = 2 · 0 − 5 · 1 = −5 1 3 y∗ = y + hf = 1 + (−5) = − 1 0 1 2 2 1  3 17 f = 2(t + h) − 5y∗ = 2(0 + ) − 5 − = 2 0 1 2 2 2 h 1 17 15 y = y + (f + f ) = 1 + (−5 + ) = = 1.875. 1 0 2 1 2 4 2 8

Applying the formula for y2, we get 1 15 f = 2t − 5y = 2 · − 5 · = −8.375 1 1 1 2 8 15 1 y∗ = y + hf = + (−8.375) = −2.3125 2 1 1 8 2 1 1 f = 2(t + h) − 5y∗ = 2( + ) − 5(−2.3125) = 13.5625 2 1 2 2 2 h 15 1 y = y + (f + f ) = + (−8.375 + 13.5625) = 3.1719. 2 1 2 1 2 8 4

35 Chapter 2

Second-Order Equations

2.1 Introduction to second-order linear equations

We now begin our study of a very important class of differential equations: second-order linear differential equations. The most general form of a second-order linear differential equation is

A(t)y00(t) + B(t)y0(t) + C(t)y(t) = G(t).

Notice that each term is linear with respect to y and its derivatives. Second-order nonlinear equations are, for the most part, impossible to solve except in a few rare cases so we will restrict our attention to linear equations. One special case of the above equation is when G(t) = 0. In this case, the equation is said to be homogeneous. If G(t) is non-zero, then the equation is said to be non-homogeneous and G(t) is referred to as the non-homogeneous term. For the next several weeks, we will consider how to solve second-order linear equations for several different special cases.

2.2 Second-order linear homogeneous differential equations with constant coefficients

The simplest type of second-order linear equation is a homogeneous equation where the coefficient functions are all constants:

A(t) = a, B(t) = b, C(t) = c, G(t) = 0 which reduces the general second-order linear differential equation to

ay00 + by0 + cy = 0.

This is the general form of an important class of differential equations: second-order linear ho- mogeneous equations with constant coefficients. The equation is second-order because the highest derivative appearing in the equation is the second derivative. It is linear because the left hand-side is a linear function with respect to y, y0 and y00. It is homogeneous because every term is a multiple of y or one of its derivatives. It has constant coefficients because a, b, c are constants, i.e., they are independent of t.

36 2.2.1 Fundamental Solutions Such equations are known to have exponential solutions. Let us make the guess that

y(t) = ert for some r. Then y0 = rert and y00 = r2ert. Plugging this into the original equation results in

ar2ert + brert + cert = 0.

Since ert appears in every term and ert 6= 0 for any t, we may safely divide the equation by ert which results in a quadratic equation for r:

ar2 + br + c = 0.

This is called the characteristic equation of the differential equation. The values of r that satisfy this equation can be found with the quadratic formula √ −b ± b2 − 4ac r = . 2a There are now 3 possible cases that we must consider, each of which leads to a different type of solution. Recall that the discriminant of a quadratic equation is defined as D = b2 − 4ac. The three cases are:

Case 1: D > 0. In this case, the quadratic equation has two real, distinct solutions. Case 2: D < 0. In this case, the quadratic equation has two complex solutions that are conjugates of each other. Case 3: D = 0. In this case, the quadratic equation has one real, repeated solution.

For now, we will only consider Case 1 since it is the simplest. Eventually, we will get to cases 2 and 3.

Assuming D > 0 then there are two real, distinct solutions to the quadratic equation: √ √ −b + b2 − 4ac −b − b2 − 4ac r = , r = . 1 2a 2 2a Recall that our original guess for the solution was y(t) = ert. Since we have values two valid values of r, there are two possible solutions:

r1t r2t y1(t) = e , y2(t) = e .

These are called the fundamental solutions of the differential equation, or equivalently, they form a fundamental set of solutions. It is no accident that a second-order equation results in two fundamental solutions. In general, an nth order equation would would result in n fundamental solutions.

37 2.2.2 Forming a General Solution Now we must find a way to combine the fundamental solutions into a single general solution. Second-order linear homogeneous equations happen to have a special property: if y1 and y2 are solutions, then any linear combination of the solutions is also a solution. A linear combination of the two solutions is defined as y(t) = c1y1(t) + c2y2(t). In other words, to form a linear combination of two solutions, we multiply each of them by a constant and add them. For a set of n solutions y1, y2, ..., yn, we would form a linear combination as n X y(t) = ciyi(t). i=1 To see that y(t) is a solution, we just plug it into the differential equation

ay00 + by0 + cy 00 0 = a(c1y1 + c2y2) + b(c1y1 + c2y2) + c(c1y1 + c2y2) 00 00 0 0 = a(c1y1 + c2y2 ) + b(c1y1 + c2y2) + c(c1y1 + c2y2) 00 0 00 0 = c1(ay1 + by1 + cy1) + c2(ay2 + by2 + cy2)

= c1 · 0 + c2 · 0 = 0.

Notice that in the fourth line in the above calculation, both expressions in the parenthesis are zero because y1 and y2 are solutions of the original differential equation. Therefore, we define the general solution to the differential equation as

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

The constants c1 and c2 must be determined by initial conditions. Since there are two constants to solve for, we need two initial conditions, which will result in a system of two equations for the two unknowns c1 and c2. Initial conditions for second-order equations can come in many different forms: we may be given the function values at two points or the first derivative at two points or some combination. For example, we may be given y(0) = 3 and y0(2) = −1 as initial conditions.

2.2.3 Examples Example 2.2.1. Find the solution to

y00 − y0 − 6y = 0 satisfying the initial conditions y(0) = 1 and y0(0) = 4.

Solution: For this problem, a = 1, b = −1 and c = −6 so the e characteristic equation is

r2 − r − 6 = 0

38 which can be factored as (r − 3)(r + 2) = 0 3t so the solutions are r = 3 and r = −2. Therefore the two fundamental solutions are y1(t) = e −2t and r2(t) = e and the general solution is

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

Applying the condition that y(0) = 1, we get

y(0) = c1 + c2 = 1.

0 3t −2t 0 Since y (t) = 3c1e − 2c2e , the second initial condition y (0) = 4 gives us

0 y (0) = 3c1 − 2c2 = 4.

Solving for c1 in the first equation, we get c1 = 1 − c2. Plugging this into the second equation, we get 1 3(1 − c ) − 2c = 4 ⇒ 3 − 3c − 2c = 4 ⇒ −5c = 1 ⇒ c = − . 2 2 2 2 2 2 5

Since c1 = 1 − c2, we get  1 6 c = 1 − − = . 1 5 5 Therefore, the final solution is 6 1 y(t) = e3t − e−2t. 5 5 Example 2.2.2. Find the solution to

2y00 − 20y0 + 48y = 0 satisfying the initial conditions y(0) = 2 and y0(0) = 16.

Solution: For this problem, a = 2, b = −20 and c = 48 so the e characteristic equation is

2r2 − 20r + 48 = 0 which can be factored as (2r − 8)(r − 6) = 0 4t so the solutions are r = 4 and r = 6. Therefore the two fundamental solutions are y1(t) = e and 6t r2(t) = e and the general solution is

4t 6t y(t) = c1e + c2e .

Applying the condition that y(0) = 2, we get

y(0) = c1 + c2 = 2.

0 4t 6t 0 Since y (t) = 4c1e + 6c2e , the second initial condition y (0) = 16 gives us

0 y (0) = 4c1 + 6c2 = 16.

39 Solving for c1 in the first equation, we get c1 = 2 − c2. Plugging this into the second equation, we get 4(2 − c2) + 6c2 = 16 ⇒ 8 − 4c2 + 6c2 = 16 ⇒ 2c2 = 8 ⇒ c2 = 4.

Since c1 = 2 − c2, we get c1 = 2 − 4 = −2. Therefore, the final solution is y(t) = −2e4t + 4e6t. Example 2.2.3. Find the solution to y00 = 4y satisfying the initial condition y(0) = y0 and has a bounded solution as t → ∞.

Solution: First we put the equation in standard form as

y00 − 4y = 0.

For this problem, a = 1, b = 0 and c = −4 so the characteristic equation is

r2 − 4 = 0 which can be factored as (r − 2)(r + 2) = 0 2t so the solutions are r = 2 and r = −2. Therefore the two fundamental solutions are y1(t) = e −2t and r2(t) = e and the general solution is

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

Since we need a solution that is bounded as t → ∞, we must set c1 = 0 which gives us

−2t y(t) = c2e .

Applying the condition that y(0) = y0, we get

y(0) = c2 = y0.

Therefore, the final solution is −2t y(t) = y0e . Example 2.2.4. Find the solution to

y00 + 3y0 = 0 satisfying the initial conditions y(0) = 4 and y0(0) = −6.

Solution: For this problem, a = 1, b = 3 and c = 0 so the characteristic equation is

r2 + 3r = 0 which can be factored as r(r + 3) = 0

40 so the solutions are r = 0 and r = −3. Therefore the two fundamental solutions are y1(t) = 1 and −3t r2(t) = e and the general solution is

−3t y(t) = c1 + c2e .

Applying the condition that y(0) = 4, we get

y(0) = c1 + c2 = 4.

0 −3t 0 Since y (t) = −3c2e , the second initial condition y (0) = −6 gives us

0 y (0) = −3c2 = −6. ⇒ c2 = 2.

Solving for c1 in the first equation, we get c1 = 4 − c2 = 4 − 2 = 2. Plugging this into the second equation, we get Therefore, the final solution is

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

Notice that unlike the previous example, the solution to this equation is bounded as t → ∞ and therefore represents a possible solution to a physical problem. Indeed, there are many physical problems that have solutions of a similar form to this one.

2.3 Solutions of second-order linear equations, linear in- dependence and the Wronskian

Before moving on in our study of second-order linear equations, it is important to introduce some new concepts and terminology that will be needed. In this section, we consider the general second- order homogeneous linear equation

P (t)y00 + Q(t)y0 + R(t)y = 0.

Notice that we can divide the equation by P (t) to obtain a simpler version:

y00 + p(t)y0 + q(t)y = 0 where p(t) = Q(t)/P (t) and q(t) = R(t)/P (t).

2.3.1 Operator Notation We now define the differential operator L as

L[y] = y00 + p(t)y0 + q(t)y so that the equation may be written simply as

L[y] = 0.

Note that L is defined based on how it acts on a function y but we can define L in abstract way as

L = D2 + pD + q

41 where d D = dt is the first derivative operator. The notation D2 means to apply the operator twice. An operator can be thought of as a function that transforms one function into another. For example, given a function y(t), computing L[y](t) produces another function. The operator L is an example of a linear operator. A linear operator always satisfies the property

L[c1y1 + c2y2] = c1L[y1] + c2L[y2] for all constants c1 and c2 and for all functions y1 and y2. We already know that if y1 are y2 are solutions of a second-order linear equation, than any linear combination of them is also a solution. Therefore L[y1] = L[y2] = L[c1y1 + c2y2] = 0.

2.3.2 Existence of a unique solution The first thing we would like to know about this equation is the condition for a solution to exist. Consider the initial value problem

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

If p(t) and q(t) are continuous in some open interval I containing t0, a unique solution exists in this interval.

Example: Find the largest interval for which a unique solution exists to the problem

(t2 − 4)y00 + ty0 + ety = 0, y(5) = 1, y0(5) = −1.

Solution: We must first get the equation into standard form by dividing through by t2 − 4, which results in t et y00 + y0 + y = 0. t2 − 4 t2 − 4 We then see that there are discontinuities in p(t) and q(t) at t = ±2. Therefore there are three possible intervals in which the solution exists: (−∞, −2), (−2, 2) and (2, ∞). Since we are given the initial condition at t0 = 5, we select the interval that contains this value, which is (2, ∞).

Example 2.3.1. Find the largest interval for which a unique solution exists to the problem

(t2 + 1)y00 + ty0 + t2y = 0, y(0) = 2, y0(0) = −3.

Solution: We must first get the equation into standard form by dividing through by t2 + 1, which results in t t2 y00 + y0 + y = 0. t2 + 1 t2 + 1 Since t2 + 1 is never zero, there are no discontinuities in p and q so a unique solution exists over the whole real line (−∞, ∞).

42 2.3.3 Constant Solutions It is always of interest to consider whether a differential equation has any constant solutions. If we assume that y = K is a constant solution and insert it into our second order linear homogeneous equation, we get K00 + p(t)K0 + q(t)K = 0 ⇒ K = 0 so y = 0 is the only possible constant solution. However, non-zero constant solutions are possible for non-homogeneous equations, i.e., if the right side of the differential equation is non-zero. The only initial conditions consistent with the solution y = 0 are y(0) = 0 and y0(0) = 0. Therefore it follows that for any second-order linear homogeneous equation with the initial conditions y(0) = 0 and y0(0) = 0, then the only possible solution is y = 0.

2.3.4 Linear Superposition and Linear Independence

Another important concept is the idea of linear superposition, which states that if y1(t) and y2(t) are solutions to a second-order linear homogeneous equation, then any linear combination of them is also a solution. This can be easily checked by plugging in a linear combination of y1 and y2 into the differential equation, as we did previously.

t Example 2.3.2. Assuming that y1(t) = t and y2(t) = e are solutions to a second-order linear homogeneous equation, find the general solution of the equation.

Solution: The general solution would just be all linear combinations of the two given solutions:

t y(t) = c1t + c2e .

There is one subtlety regarding general solutions that are defined with linear superposition: how do we know that the general solution contains all possible solutions? For example, suppose t our two fundamental solutions are y1(t) = t and y2(t) = e . Then u1(t) = 3t and u2(t) = 2t are also solution but if we form a linear combination of then, we get y(t) = 3c1t + 2c2t = (3c1 + 2c2)t = c3t, which does not include any contribution from y2(t). The reason for this is that u1 and u2 are linearly dependent, i.e., they are multiples of each other. Therefore, we can make the idea of linear superposition more precise by stating it as follows. Given any two linearly independent solutions y1(t) and y2(t), the general solution is a linear combination of y1(t) and y2(t). Therefore, in order for y1(t) and y2(t) to form a fundamental set of solutions, they must be linearly independent.

There is an easy way to check if two solutions are linearly independent or not. Recall that the determinant of a 2 × 2 matrix  a b  A = c d is defined as det(A) = ad − bc. Define the matrix   y1(t) y2(t) U(t) = 0 0 . y1(t) y2(t)

43 The Wronskian determinant is defined as

y1(t) y2(t) 0 0 W (t) = det(U(t)) = 0 0 = y1(t)y2(t) − y2(t)y1(t). y1(t) y2(t)

The solutions y1(t) and y2(t) are guaranteed to be linearly independent if W (t) 6= 0 for any t. If there is any value of t that causes W (t) = 0, then y1 and y2 are linearly dependent and do not form a fundamental set of solutions.

−t 2t Example 2.3.3. Use the Wronskian to show that y1(t) = e and y2(t) = e are linearly inde- pendent.

Solution: The Wronskian for this example is

−t 2t y1(t) y2(t) e e −t 2t −t 2t t t t 0 0 = −t 2t = 2e e + e e = 2e + e = 3e . y1(t) y2(t) −e 2e

t Since W (t) = 3e > 0 for every t, the functions y1 and y2 are linearly independent.

Example 2.3.4. Use the Wronskian to show that y1(t) = t and y2(t) = 3t are linearly dependent.

Solution: The Wronskian for this example is

y1(t) y2(t) t 3t 0 0 = = 3t − 3t = 0. y1(t) y2(t) 1 3

Since W (t) = 0 for every t, the functions y1 and y2 are linearly dependent.

t t Example 2.3.5. Use the Wronskian to show that y1(t) = e and y2(t) = te are linearly indepen- dent.

Solution: The Wronskian for this example is

t t y1(t) y2(t) e te t t t t t 2t 2t 2t 2t 0 0 = t t t = e (e + te ) − e (te ) = e + te − te = e . y1(t) y2(t) e e + te

2t Since W (t) = e > 0 for every t, the functions y1 and y2 are linearly independent.

2.3.5 Complex Solutions One idea that we will need soon is how to deal with complex solutions. A complex function is one in the form of z(t) = u(t) + iv(t) √ where i = −1. The real and imaginary parts of z(t) are denoted as

Re(z(t)) = u(t), Im(z(t)) = v(t).

Suppose we know that z(t) is a solution to the equation

z00 + p(t)z0(t) + q(t)z(t) = 0.

44 Then u(t) and v(t) are also solutions. To verify this, we plug in z(t) into the differential equation to get

z00 + p(t)z0 + q(t)z = (u + iv)00 + p(t)(u + iv)0 + q(t)(u + iv) = (u00 + p(t)u0 + q(t)u) + i(v00 + p(t)v0 + q(t)v) = 0

Since 0 = 0 + i · 0, both the real and imaginary parts of the above equation must be zero so

u00 + p(t)u0 + q(t)u = 0, v00 + p(t)v0 + q(t)v = 0 so u(t) and v(t) are both solutions to the differential equation. Furthermore, if u and v are linearly independent, they form a fundamental set of solutions. Therefore, if we ever encounter a problem that has a complex solution z(t) = u(t) + iv(t) where the real and imaginary parts u and v are linearly independent, then u and v form a fundamental set of solutions and we can state the general strictly real solution y(t) as y(t) = c1u(t) + c2v(t). We will use this concept when we consider complex roots of the characteristic equation.

2.3.6 Converting to a system of first-order equations In practice, most higher-order differential equations are usually analyzed as a system of first-order equations. In fact, numerical methods are always implemented in this manner. For example, there is no way to program MATLAB to solve a second-order equation but it can be programmed to solve a system of first-order equations. In general, an nth order equation can be stated as a system of n first-order equations. Let us consider how to transform our usual second-order linear equation

y00 + p(t)y0 + q(t)y = 0 into a system of two first order equations. Let us introduce a new variable v = y0. Then v0 = y00. Solving for y00 in the original differential equation, we get

v0 = y00 = −p(t)y0 − q(t)y = −p(t)v − q(t)y.

Therefore, we have two first-order differential equations for y and v:

y0 = v v0 = −p(t)v − q(t)y

Let us now define the vector  y(t)  ~x(t) = . v(t) Then  y0   v  ~x0 = = . v0 −p(t)v − q(t)y This can be written in matrix form as  0 1   y  ~x0 = = A(t)~x. −q(t) −p(t) v

45 where A(t) is the 2 × 2 matrix  0 1  A(t) = . −q(t) −p(t) Later on in the class, we will be looking at how to solve equations of linear systems in more depth but it is a good time to introduce the idea now since you will need to use it when using MATLAB.

Example 2.3.6. Convert the initial value problem

y00 − y0 − 6y = 0, y(0) = 1, y0(0) = 4 into a system of two first-order equations.

Solution: Let v = y0. Then v0 = y00 = y0 + 6y = v + 6y so we get the system

y0 = v v0 = v + 6y which can be written in vector form as  y0   v   0 1   y  = = v0 v + 6y 6 1 v or more compactly as  y  ~x0 = A~x, ~x = . v The initial condition for ~x is  y(0)   y(0)   1  ~x(0) = = = . v(0) y0(0) 4

2.4 Complex roots of the characteristic equation

We now continue our study of second-order linear homogeneous equations with constant coefficients of the form ay00 + by0 + cy = 0. We have already seen that such an equation has exponential solutions of the form

y = ert for some values of r. Plugging this into the differential equations results in the characteristic equation ar2 + br + c = 0.

46 Recall that the discriminant of this equation is D = b2 − 4ac and we have already considered the case where D > 0, which leads to a pair of exponential solutions. Now we consider what happens when D < 0. In this case, the solutions to the quadratic equation are complex:

−b ± ip|D| b p|D| r = = − ± i . 2a 2a 2a For convenience, we write this as r = λ ± iµ where

b p|D| λ = Re(r) = − , µ = Im(r) = ± . 2a 2a

Notice that r1 = λ + iµ and r2 = λ − iµ are complex conjugates of each other. If we insert one of the r-values (say r1) into our proposed exponential solution, we get

y(t) = e(λ+iµ)t = eλteiµt.

2.4.1 Euler’s Formula We now need to be able to make sense of the expression eiµt, i.e., we need to know how to compute the exponential of an imaginary number. This can done using the Taylor series for et and results in a remarkable identity that is the basis of an entire study of , called complex analysis. The Taylor series of the exponential function is

∞ X tn 1 1 et = = 1 + t + t2 + t3 + ... n! 2 6 n=0 If we instead plug in it instead of t, we get

∞ X (it)n eit = n! n=0 i0t0 i1t1 i2t2 i3t3 i4t4 i5t5 = + + + + + ... 0! 1! 2! 3! 4! 5! t0 t1 t2 i3t3 t4 t5 = + i − − i + + i ... 0! 1! 2! 3! 4! 5! t0 t2 t4  t1 t3 t5  = − + + ... + i − + + ... 0! 2! 4! 1! 3! 5! ∞ ∞ X (−1)n X (−1)n = t2n + i t2n+1 (2n)! (2n + 1)! n=0 n=0 = cos(t) + i sin(t).

Therefore, our final result is eit = cos(t) + i sin(t) which is known as Euler’s Formula and is an extremely important idea in mathematics that we will use from now on. Let us think about what this equation means. It says that the exponential of an imaginary number it is a complex number, with a real part cos(t) and an imaginary part sin(t). This is why the exponential function is by far the most important function in mathematics: it

47 actually generates the sin and cos functions when imaginary numbers are included in the domain. In this sense, all the trigonometric functions are really special cases of the exponential function!

There is an alternative method to derive this result using differential equations. We know that the exponential function y = eat satisfies the equation

y0 = ay, y(0) = 1.

Therefore, to compute z(t) = eit, we plug in a = i and let our solution be complex-valued: z(t) = u(t) + iv(t). This gives the equation

z0 = iz, z(0) = 1.

Plugging in z = u + iv we get

u0 + iv0 = i(u + iv) = iu − v

Equating the real and imaginary parts, we get

u0 = −v, v0 = u

The initial conditions for u and v are

z(0) = u(0) + iv(0) = 1 + i · 0 ⇒ u(0) = 1, v(0) = 0.

It is a simple matter to check that u(t) = cos(t) and v(t) = sin(t) are the unique solutions of u and v. Therefore z(t) = eit = cos(t) + i sin(t). There are many useful identities that can be derived from Euler’s formula. For example, if we plug in −t into the equation, we get

e−it = cos(−t) + i sin(−t) = cos(t) − i sin(t).

Notice that if we add this equation to Euler’s formula, we get 1 eit + e−it = 2 cos(t) ⇒ cos(t) = (eit + e−it) = cosh(it). 2 Likewise, if we subtract the two equations, we get 1 eit − e−it = 2i sin(t) ⇒ sin(t) = (eit − e−it) = −i sinh(it). 2i Every trig identity can be derived using Euler’s formula. For example, the double-angle identities can be derivate by using the fact that e2it = (eit)2, which gives us the formulas

cos(2t) + i sin(2t) = (cos(t) + i sin(t))2 = cos2(t) − sin2(t) + i(2 sin(t) cos(t)).

Setting the real and imaginary parts equal to each other, we get

cos(2t) = cos2(t) − sin2(t), sin(2t) = 2 sin(t) cos(t).

48 One special case of Euler’s formula is when t = π, we get

eiπ = cos(π) + i sin(π) = −1.

If we take the natural log of each side, we get

ln(−1) = iπ which allows us to extend the natural log function to include negative arguments. Let t < 0. Then

ln(t) = ln(−|t|) = ln |t| + ln(−1) = ln |t| + iπ.

Therefore the natural log of a negative number does exist, but it is complex, with real part ln |t| and imaginary part π.

2.4.2 The General Solution Returning to our original problem of solving our differential equation, we have found that

z(t) = eλteiµt = eλt(cos(µt) + i sin(µt)) is a complex solution. Note that I used r1 = λ + iµ for this solution but I could have just as well used r2 = λ − iµ. As was discussed in the past section, given any complex solution, the real and imaginary parts are also solutions. Furthermore, if the real and imaginary parts are linearly independent, they form a fundamental set of solutions and we can state the general solutions as a linear combination of the real and imaginary parts. Therefore, when we have complex roots of the characteristic equation, we only need to use one of the r values to find the general solution. It is arbitrary which one to use so we will always use r1 = λ + iµ. For the z(t) that we have defined, the real and imaginary parts are

Re(z(t)) = u(t) = eλt cos(µt), Im(z(t)) = v(t) = eλt sin(µt).

To check if u(t) and v(t) are linearly independent, we compute the Wronskian. First we need to compute the derivatives of each function:

u0 = λeλt cos(µt) − µeλt sin(µt) = eλt(λ cos(µt) − µ sin(µt))

v0 = λeλt sin(µt) + µeλt cos(µt) = eλt(λ sin(µt) + µ cos(µt)). Then the Wronskian is

u v eλt cos(µt) eλt sin(µt) W = = . u0 v0 eλt(λ cos(µt) − µ sin(µt)) eλt(λ sin(µt) + µ cos(µt)) Expanding the determinant, we get

W = [eλt cos(µt)][eλt(λ sin(µt) + µ cos(µt))] − [eλt sin(µt)][eλt(λ cos(µt) − µ sin(µt))] = e2λt[λ cos(µt) sin(µt) + µ cos2(µt)] − e2λt[λ sin(µt) cos(µt) − µ sin2(µt)] = e2λt[µ cos2(µt) + µ sin2(µt)] = µe2λt.

49 As long as µ 6= 0, W can never be zero for any t. Therefore, u(t) and v(t) form a fundamental set and we can state the general solution to the differential equation as

λt λt y(t) = c1u(t) + c2v(t) = c1e cos(µt) + c2e sin(µt). It is customary to factor out the exponential in this expression to get the simpler form

λt y(t) = e [c1 cos(µt) + c2 sin(µt)]. One special case of this formula is when λ = 0, we get strictly sin and cos solutions. Recall that b λ = − 2a so the only way λ can be 0 is if b = 0. Therefore any differential equations of the form

ay00 + cy = 0 will have trigonometric solutions. When λ 6= 0, the solutions resemble oscillations that either grow (λ > 0) or decay (λ < 0) exponentially. Many physical systems demonstrate this type of behavior. For example, consider a mass-spring system where air resistance is included in the model. We would expect the height of the mass to oscillate but with an amplitude that gradually decreases, due to energy that is dissipated through air resistance. Indeed, we will study this application thoroughly later on in this chapter.

2.4.3 Examples Example 2.4.1. Solve the initial value problem

y00 + 9y = 0, y(0) = 2, y0(0) = 0.

Solution: The characteristic equation for this problem is √ r2 + 9 = 0 ⇒ r = ± −9 = ±3i.

Therefore λ = 0 and µ = 3 for this problem. The general solution is thus

y(t) = c1 cos(3t) + c2 sin(3t). Applying the initial conditions gives y(0) = c1 = 2 and 0 y (0) = −3c1 sin(0) + 3c2 cos(0) = 3c2 = 0 ⇒ c2 = 0. Therefore the final solution is y(t) = 2 cos(3t). The general equation y00 + k2y = 0 always has solutions cos(kt) and sin(kt). This is a very common equation encountered in and any system that obeys this equation is referred to as a simple harmonic oscillator. It is therefore worth committing the solution to memory since it is so commonly encountered.

50 Example 2.4.2. Solve the initial value problem y00 + 4y0 + 5y = 0, y(0) = 1, y0(0) = 0. Solution: The characteristic equation for this problem is −4 ± p16 − 4(5) r2 + 4r + 5 = 0 ⇒ r = = −2 ± i. 2 Therefore λ = −2 and µ = 1 for this problem. The general solution is thus

−2t y(t) = e [c1 cos(t) + c2 sin(t)]. The derivative of this solution is

0 −2t −2t y (t) = −2e [c1 cos(t) + c2 sin(t)] + e [−c1 sin(t) + c2 cos(t)]. Applying the first initial condition gives

y(0) = c1 = 1. Applying the second initial condition gives

0 y (0) = −2c1 + c2 = −2 + c2 = 0 ⇒ c2 = 2. Therefore the final solution is y(t) = e−2t[cos(t) + 2 sin(t)]. Example 2.4.3. Solve the initial value problem y00 − 2y0 + 5y = 0, y(π/2) = 0, y0(π/2) = 2. Solution: The characteristic equation for this problem is 2 ± p4 − 4(5) r2 − 2r + 5 = 0 ⇒ r = = 1 ± 2i. 2 Therefore λ = 1 and µ = 2 for this problem. The general solution is thus

t y(t) = e [c1 cos(2t) + c2 sin(2t)]. Applying the first initial condition gives

π/2 π/2 y(π/2) = e [c1 cos(π) + c2 sin(π)] = −e c1 = 0 ⇒ c1 = 0. This simplifies the solution to t y(t) = c2e sin(2t). The derivative of this solution is

0 t t y (t) = c2[e sin(2t) + 2e cos(2t). Applying the second initial condition gives

0 π/2 π/2 π/2 −π/2 y (π/2) = c2[e sin(π) + 2e cos(π) = −2c2e = 2 ⇒ c2 = −e . Therefore the final solution is y(t) = −e−π/2et sin(2t) = −et−π/2 sin(2t).

51 2.5 Repeated roots of the characteristic equation

We have now studied the solutions to the equation

ay00 + by0 + cy = 0 for the two cases where the discriminant D = b2 − 4ac is both positive and negative. Now we must consider the final case: D = 0. For this case, we end up with only a single repeated solution to the characteristic equation b r = − 2a −bt/(2a) which tells us that y1 = e is a solution to the differential equation. However, in order to obtain a general solution, we need to take a linear combination of two solutions which leaves us with the problem of finding a second solution. In order to do so, we now introduce the reduction of order technique, which is a way to generate a second solution from a known solution.

2.5.1 Reduction of order The reduction of order technique can be applied to the general second-order linear homogeneous equation A(t)y00 + B(t)y0 + C(t)y = 0.

Suppose that we know one solution to this equation, call it y1(t). We then look for a second solution y2(t) of the form y2(t) = v(t)y1(t). The goal would then be to find v(t). At first, this does not seem like it will produce anything useful, but it does. First we compute the derivatives:

0 0 0 y2 = v y1 + vy1

00 00 0 0 00 y2 = v y1 + 2v y1 + vy1 .

Now we plug y2 into the differential equation to get

00 0 A(t)y2 + B(t)y2 + C(t)y2 = 0

00 0 0 00 0 0 A(t)(v y1 + 2v y1 + vy1 ) + B(t)(v y1 + vy1) + C(t)vy1 = 0 00 0 00 0 0 0 v[A(t)y1 + B(t)y1 + C(t)y1] + A(t)v y1 + 2A(t)v y1 + B(t)v y1 = 0.

Since y1 is a solution to the differential equation, the first term in brackets is zero so we get the equation for v is

0 00 0 0 00 2A(t)y1 + B(t)y1 0 A(t)v y1 + [2A(t)y1 + B(t)y1]v = 0 ⇒ v + v = 0. A(t)y1 Now let us define the function 2A(t)y0 + B(t)y p(t) = 1 1 . A(t)y1 The equation for v can then be written as

v00 + p(t)v0 = 0.

52 Notice that only v00 and v0 appear in this equation, which means that we can reduce it solving two first-order equations, hence the term reduction of order. Let u = v0. Then writing the above equation in terms of u gives us u0 + p(t)u = 0 which is separable and has a solution of the form  Z  u(t) = K exp − p(t)dt where K is a constant. In theory, we could then integrate this function to obtain v(t), which would give us y2(t) = v(t)y1(t).

2.5.2 Finding the second solution We now want to apply the reduction of order technique to the equation

ay00 + by0 + cy = 0

rt using the know solution y1(t) = e where r = −b/(2a) is the single repeated root of the charac- teristic equation. From the previous subsection, we have

2arert + bert 2ar + b p(t) = = = 0. aert a Note that this expression is zero because r = −b/(2a) ⇒ 2ar + b = 0. This gives us the differential equation for v is just v00 = 0 which has the general solution v(t) = c1t + c2. An important note is that there are no initial conditions for v(t) and we may choose to use any solution we like, as long as it is not constant (since this would make y2 a multiple of y1). Therefore, the most convenient solution to use is v(t) = t, which gives us

rt y2(t) = ty1(t) = te .

Let us now check that this is indeed a solution and that it is linearly independent from y1. The derivatives of y2 are 0 rt rt rt y2 = e + rte = e (rt + 1) 00 rt rt rt 2 y2 = re (rt + 1) + e r = e (r t + 2r).

Plugging y2 into the differential equation then gives us

00 0 ay2 + by2 + cy2 = aert(r2t + 2r) + bert(rt + 1) + ctert = ert[(ar2 + br + c)t + 2ar + b] = ert[0 · t + 0] = 0.

53 Therefore y2 is indeed a solution. Now we need to check that it is linearly independent from y1. The Wronskian of y1 and y2 is

rt rt e te 2rt 2rt 2rt W = = e (rt + 1) − rte = e 6= 0. rert ert(rt + 1)

Since y1 and y2 are both solutions and they are linearly independent, we conclude that the general solution is rt rt rt y(t) = c1e + c2te = e (c1 + c2t).

2.5.3 Examples Example 2.5.1. Use reduction of order to find the general solution to

t2y00 + 2ty0 − 2y = 0 given that y1 = t is a solution.

Solution: We start by setting y2(t) = y1(t)v(t) = tv(t). Then

0 0 y2 = v + tv ,

00 0 0 00 0 00 y2 = v + v + tv = 2v + tv .

Plugging y2 into the differential equation gives us t2(2v0 + tv00) + 2t(v + tv0) − 2tv = 0

2t2v0 + t3v00 + 2tv + 2t2v0 − 2tv = 0 t3v00 + 4t2v0 = 0. Now we set u = v0 to get the equation du t3 + 4t2u = 0 dt which we rearrange as du 4t3 4 = − dt = − dt. u t2 t Integrating each side then gives ln |u| = −4 ln |t| + C. Since the initial conditions for u are arbitrary, we set C = 0 to obtain

ln |u| = ln |t−4| ⇒ u(t) = t−4.

We obtain v(t) by setting dv 1 = u(t) = t−4 ⇒ v(t) = − t−3. dt 3 −3 −2 Therefore y2(t) = y1(t)v(t) = −t · t /3 = −t /3. However, we can select any constant multiple of this solution as the second fundamental solution so we take

−2 y2(t) = t .

54 Let’s verify that this is indeed a solution. Plugging it into the differential equation gives

t2(6t−4) + 2t(−2t−3) − 2t−2 = 6t−2 − 4t−2 − 2t−2 = 0

−2 so y2 = t is a solution. Therefore the general solution is

−2 y(t) = c1t + c2t .

Example 2.5.2. Solve the initial value problem

y00 − 6y0 + 9y = 0, y(0) = 3, y0(0) = −2.

Solution: The characteristic equation for this problem is

r2 − 6r + 9 = 0 ⇒ (r − 3)2 = 0 ⇒ r = 3.

The general solutions is thus 3t y(t) = e (c1 + c2t). The derivative of y is

0 3t 3t 3t y = 3e (c1 + c2t) + c2e = e (3c1 + 3c2t + c2).

Applying the first initial condition, we get

y(0) = c1 = 3.

Applying the second initial condition, we get

0 y (0) = 3c1 + c2 = 9 + c2 = −2 ⇒ c2 = −11.

So the final solution is y(t) = e3t(3 − 11t).

2.6 Summary of the Characteristic Solutions

We have now been through every possible case for how to solve the equation

ay00 + by0 + cy = 0.

There are three different cases based on the sign of the discriminant

D = b2 − 4ac.

These cases are:

Case 1: D > 0

In this case, the characteristic equation has two real, distinct solutions, r1 and r2, and the general solution of the differential equation is

r1t r2t y(t) = c1e + c2e .

55 Case 2: D < 0

In this case, the characteristic equation has two complex conjugate solutions, r = λ ± iµ, and the general solution of the differential equation is

λt y(t) = e [c1 cos(µt) + c2 sin(µt)].

Case 3: D = 0

In this case, the characteristic equation has one real, repeated solution, r = −b/(2a), and the general solution of the differential equation is

rt y(t) = e (c1 + c2t).

2.7 Higher-order equations

The methods we have used to solve second-order linear homogeneous differential equations can be extended to higher order equations as well. Consider an nth order linear homogeneous differenti- ation equation with constant coefficients. This equation would have the form

0 (n−1) (n) a0y + a1y + ... + an−1y + any = 0 or more compactly, n X (k) aky = 0. k=0 If we assume the solution has the form y = ert then we get the characteristic equation is

n−1 n a0 + a1r + ... + an−1r + anr = 0.

This polynomial is always guaranteed to have n roots, however finding those roots may be difficult or even impossible. Assuming, we can find all roots, we can use the techniques we have already learned to find a fundamental set of n solutions {y1, y2, ..., yn} and state the general solution as a linear combination of them: n X y(t) = ckyk(t). k=1

2.7.1 Examples Example 2.7.1. Find the general solutions of

y000 + 4y00 + 5y0 = 0.

Solution: The characteristic equation is

r3 + 4r2 + 5r = 0 which can be factored as r(r2 + 4r + 5) = 0

56 so r = 0 is one solution. To find the other two, we use the quadratic formula to get −4 ± p16 − 4(5) r = = −2 ± i. 2 Therefore the roots or the characteristic equation are r = 0, −2 + i, −2 − i which correspond to the three fundamental solutions −2t −2t y1(t) = 1, y2(t) = e cos(t), y3(t) = e sin(t). Therefore the general solution to this problem is −2t −2t y(t) = c1 + c2e cos(t) + c3e sin(t). Example 2.7.2. Find the general solutions of y(4) + 3y000 + 3y00 + y0 = 0. Solution: The characteristic equation is r4 + 3r3 + 3r2 + r = 0 which can be factored as r(r + 1)3 = 0 therefore we get r = 0 is one solution and r = −1, with a multiplicity of 3, are the other solutions. We know the solution corresponding to r = 0 is y1(t) = 1 and one of the solutions corresponding −t to r = −1 is y2(t) = e . To find the other two solutions corresponding to r = −1, we simply multiply y2 by increasing powers of t: −t 2 −t y3(t) = te , y4 = t e . Therefore the general solution to this problem is −t −t 2 −t y(t) = c1 + c2e + c3te + c4t e . Note that in this calculation, we used the fact that if a root of the characteristic equation has k rt multiplicity m then we can form m fundamental solutions as yk(t) = t e for k = 0, ..., m − 1. The proof of this statement can be derived using reduction of order recursively although it is quite tedious.

2.8 Non-homogeneous second-order linear differential equa- tions with constant coefficients

We have now mastered how to solve the equations ay00 + by0 + cy = 0 for any values of a, b and c. Recall that this equation is said to be homogeneous because the right hand side is zero. However, when the right-hand side is a non-zero function of t, the equation is said to be non-homogeneous and has the general form ay00 + by0 + cy = g(t). It is to this equation that we now turn our attention to.

57 2.8.1 The Particular Solution We have already spent a good deal of time developing the methods to solve homogeneous equations so it would be nice if we could somehow apply that knowledge toward solving the non-homogeneous problem. To this end, we define the complementary solution yc(t) as the solution of the correspond- ing homogeneous equation, i.e., yc satisfies

00 0 ayc + byc + cyc = 0 and has the general form yc(t) = c1y1(t) + c2y2(t) where y1 and y1 are two fundamental solution of the homogeneous equation. We then assume that the solution to the non-homogeneous equation y(t) is the sum of the complementary solution and some other unknown function yp(t), i.e.,

y(t) = yc(t) + yp(t).

Inserting this guess into the differential equation, we get

00 0 a(yc + yp) + b(yc + yp) + c(yc + yp) = g(t) 00 00 0 0 a(yc + yp ) + b(yc + yp) + c(yc + yp) = g(t) 00 0 00 0 (ayc + byc + cyc) + ayp + byp + cyp = g(t) 00 0 ayp + byp + cyp = g(t).

00 0 Note that the last step comes from the fact that yc satisfies the homogeneous equation so ayc +byc + cyc = 0. The above equation tells us that yp must satisfy the original non-homogeneous equation. This doesn’t appear to help us a whole lot, except for one crucial fact: yp is a unique solution, that is independent of any initial conditions. For this reason, it is referred to as the particular solution and is completely determined by the differential equation itself. The uniqueness of the particular solution can be understood by considering that yc(t) already contains the two arbitrary constants c1 and c2 that correspond to initial conditions. While this does not immediately help us, it reduces the problem from having to find a general solution of the non-homogeneous equation to only having to find a single particular solution. The process can be summarized as follows:

1. Find the complementary solution by solving the corresponding homogeneous equation.

2. Find the particular solution.

3. Add the complementary and particular solutions to form a general solution.

4. Apply initial conditions if given.

It is step 2, finding the particular solution, that we must now learn how to do.

58 2.8.2 Method of Undetermined Coefficients The method we will employ in finding the particular solutions is called the method of undetermined coefficients. This method requires us to make an initial guess for the solution that contains some unknown coefficients, which we denote with capital lettersA, B, C, etc. If this guess is correct, then inserting it into the differential equation will result in a system of equations for the unknown coefficients. If the guess is incorrect, this will become apparent because the resulting system of equations will have no solution and we must therefore try a different guess. So how do we go about formulating an initial guess? It has been observed that most non-homogeneous differential equations have a particular solution that has the “same form” as the right hand side function g(t). What exactly is meant by the same form? There are really three different types of elementary functions that are the building blocks form most of the functions we encounter in mathematics: polynomials, exponential functions and trigonometric functions (sin and cos). More complicated functions are constructed by multiplying, dividing, adding and subtracting these basic building blocks. We can therefore come up with a sort of “general form” for g(t) by considering a general form the building blocks that make up g(t). This is best demonstrated with some examples. Consider the differential equation

y00 + 4y0 + 3y = g(t).

Let’s find the particular solution to this equation for some different functions for g(t).

Example 2.8.1. g(t) = e2t

Since g(t) is an exponential function, the most general version of g(t) would be a function of 2t 2t the form Ae . Therefore, we try using the particular solution yp = Ae . The first and second derivatives are thus 0 2t 00 2t yp = 2Ae , yp = 4Ae

Plugging yp into the differential equation, we get

4Ae2t + 4(2Ae2t) + 3(Ae2t) = e2t ⇒ 15Ae2t = e2t ⇒ 15A = 1 ⇒ A = 1/15.

Therefore the particular solution is 1 y (t) = e2t. qedsymbol p 15 Example 2.8.2. g(t) = cos(t)

In this case, g(t) is a trigonometric function, so the most general form would be a general trigono- metric function, i.e., somelinear combination of sin(t) and cos(t). Therefore, we try using the particular solution yp = A cos(t) + B sin(t). The first and second derivatives are thus

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

59 Plugging yp into the differential equation, we get

−A cos(t) − B sin(t) + 4[−A sin(t) + B cos(t)] + 3[A cos(t) + B sin(t)] = cos(t).

Combining like terms gives us

(2A + 4B) cos(t) + (2B − 4A) sin(t) = cos(t).

Comparing the coefficients on each side of the equation, we see

2A + 4B = 1, 2B − 4A = 0.

From the second equation, we get B = 2A so

2A + 4(2A) = 1 ⇒ 10A = 1 ⇒ A = 1/10 ⇒ B = 1/5.

Therefore the particular solution is 1 1 y (t) = cos(t) + sin(t). p 10 5 Example 2.8.3. g(t) = 3t2 − 1

Since g(t) is a degree 2 polynomial, the most general version of g(t) would be an arbitrary degree 2 polynomial. Therefore, we try using the particular solution

2 yp = At + Bt + C.

The first and second derivatives are thus

0 00 yp = 2At + B, yp = 2A

Plugging yp into the differential equation, we get

2A + 4(2At + B) + 3(At2 + Bt + C) = 3t2 − 1

Combining like terms gives us

3At2 + (8A + 3B)t + 2A + 4B + 3C = 3t2 − 1.

Equating the coefficients on each side, we get equations

3A = 3, 8A + 3B = 0, 2A + 4B + 3C = −1.

The first equation gives us A = 1. Then the second equation gives us B = −8/3 and the third gives us 3C = −1 − 2 − 32/3 = −41/3 ⇒ C = −41/9. 8 41 y (t) = t2 − t − . p 3 9

60 These three examples cover how to make the initial guess for yp(t) based on the form of g(t) for the three basic building blocks. For more complicated functions g(t), we combine the general forms in the way they are combined in g(t). For example, consider

g(t) = t2et.

This is a quadratic function times an exponential function. Therefore we should make the guess

2 t yp(t) = (At + Bt + C)(De ).

Notice that we can actually get rid of the D by “absorbing” it into A,B and C so we can write this as 2 t yp(t) = (At + Bt + C)e . Now consider g(t) = e−4t sin(3t). This is the product of an exponential function and a trigonometric function so the general form is

−4t yp(t) = [De ][A cos(3t) + B sin(3t)].

Again, we omit the D to get

−4t yp(t) = e [A cos(3t) + B sin(3t)].

Now consider g(t) = t2e−t sin(4t). Then the particular solution has the form

e−t[At2 + Bt + C][D cos(4t) + E sin(4t)] which would result in a system of 5 equations for the unknown coefficients A, B, C, D, E. Now that we have a good idea how to make an initial guess for the particular solution, let’s do some fully worked examples to demonstrate the entire process.

Example 2.8.4. Find the general solution of the equation

y00 + 4y0 + 3y = te2t.

We start by first finding the complementary solution by solving

y00 + 4y0 + 3y = 0.

The characteristic equation is

r2 + 4r + 3 = 0 ⇒ (r + 1)(r + 3) = 0 ⇒ r = −1, −3.

Therefore the complimentary solution is

−t −3t yc(t) = c1e + c2e .

Now we need to find the particular solution. Notice that g(t) is the product of a degree one polynomial and an exponential so the particular solution should have the form

2t yp(t) = (At + B)e .

61 The first and second derivatives are

0 2t 2t 2t yp = Ae + 2(At + B)e = (A + 2B + 2At)e

00 2t 2t 2t yp = 2Ae + 2(A + 2B + 2At)e = (4A + 4B + 4At)e .

Plugging yp into the equation gives

(4A + 4B + 4At)e2t + (A + 2B + 2At)e2t + (At + B)e2t = te2t.

Combining the like terms gives us

(4A + 2A + A)te2t + (4A + 4B + A + 2B + B)e2t = te2t which gives us the equations

7A = 1, 5A + 7B = 0 ⇒ A = 1/7,B = −5/49.

Therefore the particular solution is

1 5  y (t) = t − e2t. p 7 49

The general solution is then stated as the sum of the complementary and particular solutions:

1 5  y(t) = y (t) + y (t) = c e−t + c e−3t + t − e2t. c p 1 2 7 49

At this point, we would apply initial conditions, if given any. It is important to note that the full solution must be constructed before applying the initial conditions; they can not be applied directly to the complementary or particular solutions.

Example 2.8.5. Solve the initial value problem

y00 + 4y = cos(2t), y(0) = 0, y0(0) = 1.

We start by first finding the complementary solution by solving

y00 + 4y = 0.

The characteristic equation is r2 + 4 = 0 ⇒ r = ±2i. Therefore the complimentary solution is

yc(t) = c1 cos(2t) + c2 sin(2t).

Now we need to find the particular solution. Notice that g(t) is a trigonometric function so the particular solution should have the form

yp(t) = A cos(2t) + B sin(2t).

62 Although it might not be obvious, we have run into a problem here: the particular solution has the exact same form as the complementary solution. When this occurs, the usual guess of the particular solution will fail. If we insert our current guess for yp into the equation, we get −4A cos(2t) − 4B sin(2t) + 4(A cos(2t) + B sin(2t)) = cos(2t) ⇒ 0 = cos(2t) which is clearly nonsense. The reason why our guess did not work, is that the right hand side func- tion g(t) is linearly dependent with one of the fundamental solutions to the homogeneous equation. This is a phenomenon known as resonance and we will discuss the physical significance of this idea later. Whenever this occurs, we have to alter our guess for the particular solution so that each term is linearly independent from the fundamental solutions. To do this, we simply multiply our original guess for the particular solution by t:

yp(t) = t[A cos(2t) + B sin(2t)]. This guarantees that the particular solution is linearly independent from the complementary so- lution. The first and second derivatives are

0 yp = A cos(2t) + B sin(2t) + t[−2A sin(2t) + 2B cos(2t)]

0 yp = (A + 2Bt) cos(2t) + (B − 2At) sin(2t) 00 yp = 2B cos(2t) − 2(A + 2Bt) sin(2t) − 2A sin(2t) + 2(B − 2At) cos(2t). 00 yp = (4B − 4At) cos(2t) − (4A + 4Bt) sin(2t)

Plugging yp into the equation gives (4B − 4At) cos(2t) − (4A + 4Bt) sin(2t) + 4t[A cos(2t) + B sin(2t)] = cos(2t).

Now notice that the terms with the t all cancel out and we get

4B cos(2t) − 4A sin(2t) = cos(2t). which gives us the equations

4B = 1, −4A = 0 ⇒ A = 0,B = 1/4.

Therefore the particular solution is 1 y (t) = t sin(2t). p 4 The general solution is then stated as the sum of the complementary and particular solutions: 1 y(t) = y (t) + y (t) = c cos(2t) + c sin(2t) + t sin(2t). c p 1 2 4 Now we apply the initial conditions. The first one is

y(0) = c1 = 0. Therefore the solution simplifies to 1 y(t) = c sin(2t) + t sin(2t). 2 4 63 The derivative is 1 y0(t) = 2c cos(2t) + [sin(2t) + 2t cos(2t)] 2 4 so the second initial condition is

0 y (0) = 2c2 = 1 ⇒ c2 = 1/2.

Therefore the final solution is 1 1 1 y(t) = sin(2t) + t sin(2t) = (2 + t) sin(2t). 2 4 4 Notice that the homogeneous solution is oscillatory with a constant, finite amplitude but the solution to the non-homogeneous equation oscillates with a growing amplitude. This is what is meant by resonance, a physical concept we will explore in the next section, and it is a consequence of the fact that g(t) is linearly dependent with one of the fundamental solutions of the homogeneous equation.

Example 2.8.6. Find the general solutions to

y00 + 6y0 + 13y = 3.

Solution: First we find the complementary solution to the homogeneous equation

y00 + 6y0 + 13y = 0.

The characteristic equation is r2 + 6r + 13 = 0 and the solutions are √ −6 ± p36 − 4(13) −6 ± −16 r = = = −3 ± 2i. 2 2 Therefore the complementary solution is

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

Now we need the particular solution. Notice that for this problem g(t) = 3, i.e., g is constant. 0 00 Therefore we should try a constant particular solution yp = A. Since yp = 0 and yp = 0, plugging this into the differential equation just gives 3 13A = 3 ⇒ A = . 13 Therefore the general solution is 3 y(t) = y (t) + y (t) = e−3t[c cos(2t) + c sin(2t)] + . c p 1 2 13 Note that we can also apply this method to first-order equations, as an alternative to the integrating factor method.

64 Example 2.8.7. Consider the equation

y0 + y = t.

We would usually solve this equation using an integrating factor but lets try to do it using the particular solution method. The corresponding homogeneous is equation is

y0 + y = 0 which has the solution −t yc(t) = c1e . Since the right hand side is a degree one polynomial, we look for a particular solution of the form 0 yp = At + B. Then yp = A. Plugging this into the equation, we get A + At + B = t ⇒ A = 1,A + B = 0 ⇒ A = 1,B = −1.

Therefore the particular solution is yp = t − 1 and the general solution is

−t y(t) = c1e + t − 1.

2.9 The Mass-Spring System

In the past few weeks, we have studied how to solve the second-order equation

00 0 0 0 ay + by + cy = g(t), y(0) = y0, y (0) = y0. The reason we have placed such an emphasis on this equation is that it appears often in physical problems, namely in mechanical and electrical oscillatory systems. We will now look at how this equation can be interpreted in the context of these physical systems. First we will consider free oscillations, which correspond to homogeneous equations with g(t) = 0. Then we will consider forced oscillations, which correspond to non-homogeneous equations.

Consider a vertical spring that is attached to some fixed support (like a ceiling). Let ` be the equilibrium length of the spring. Suppose we attach a mass m to the end of the spring, which stretches the spring by a length L. We define the y axis along the spring such that y = 0 cor- responds to the end of the spring after the mass is attached. For convenience, we define “down” as the positive direction. Suppose we perturb the system by stretching or compressing the spring by some amount y0. We then wish to find the height of the mass at any given time, y(t). The velocity of the mass is then v = y0 and the acceleration is a = y00. According to Newton’s 2nd Law of Motion, the differential equation for y(t) would have the general form

my00 = f(t, y) where f(t, y) is the sum of all forces acting on the mass. In this case there are three forces acting on the mass:

1. Gravity. The gravitational force is simply Fg = mg. Note that it is positive since it acts downward and we have define down to be the positive direction.

65 2. Drag. The drag force is due to air resistance that the mass encounters while in motion. The most common model for the drag force Fd is to assume that it is proportional to the velocity: 0 Fd = −γy . The proportionality constant γ ≥ 0 is referred to as the drag coefficient or damping constant and it is a property of the fluid that the mass-spring system is immersed in. The minus sign comes from the fact that the drag always acts in the opposite direction of the velocity. 3. The restoring force. The restoring force is due to the potential energy stored in the spring and is modeled using Hooke’s Law, which states that the restoring force is proportional to the length that the spring has been stretched or compressed from its equilibrium. Since the mass already stretches the spring a length L away from its equilibrium, the restoring force when the mass is at y would be Fs = −k(L+y). The proportionality constant k ≥ 0 is called the spring constant and is a property of how stiff the spring is. The minus sign signifies that the restoring force always acts in such a way as the “restore” the spring to equilibrium. For example, if L+y is positive, the spring is stretched and the restoring force would act upwards (in the negative direction). Therefore the total force acting on the object is

0 f = Fg + Fd + Fs = mg − γy − k(L + y) which gives us the equation my00 = mg − γy0 − k(L + y). Rearranging this equation gives us

my00 + γy0 + ky = mg − kL.

However, if we consider the system when its at rest, there are only two forces acting, gravity and the restoring force, and they must cancel each other out. Since the mass stretches the spring a length L, the restoring force is Fs = −kL and therefore we must have mg − kL = 0.

Notice that this equation suggests a simple way of measuring the value of k for a spring. Since we can easily measure m and L, the spring constant can be calculated as k = mg/L. Using mg − kL = 0, we get the equation of motion for the system:

my00 + γy0 + ky = 0, which is exactly the differential equation we have been studying; just with a, b and c replaced with m, γ and k. Notice that there is no dependence on gravity, i.e., the presence of gravity is irrelevant to the motion. The same equation would hold no matter if the experiment were conducted at sea level, at the center of the earth or out in the depths of space (although γ would certainly have a different value in space than on earth).

It is important to note the limitations of the model we have constructed. First of all, it is as- sumed that the drag force is proportional to the velocity, which may not always be an appropriate model. Some fluids demonstrate a nonlinear relationship between the drag force and the velocity. Also, the assumption that the spring obeys Hooke’s Law is not always valid. Hooke’s Law is usu- ally a good approximation when the spring is close to equilibrium but when it is stretched very

66 far, most springs begin to demonstrate a nonlinear relationship between the restoring force and the distance its been stretched. And, of course, every spring can only be stretched a finite distance before it breaks. A spring that is assumed to obey Hooke’s Law is referred to as an ideal spring.

It is often useful to analyze a system by considering its total energy. Any mechanical system has a total energy E given by E = K + U where K is the kinetic energy and U is the potential energy. The kinetic energy is the same for any mechanical system: 1 1 K = mv2 = m(y0)2. 2 2 The potential energy depends on the system in question. Since gravity does not contribute to the mass-spring system, there is only one source of potential energy, the energy contained in the spring, which is 1 U = ky2. 2 Therefore the total energy of the mass-spring system is 1 1 E = K + U = m(y0)2 + ky2. 2 2 2.9.1 Undamped Free Oscillations The first case we will consider is for an undamped system, i.e., when γ = 0. Theoretically, γ can only be zero in a perfect vacuum, which is a fictional idealization. However, γ = 0 may be a decent approximation for a low-resistance fluid, but only on a small time interval. The equation of motion for this system is my00 + ky = 0 and is the prototypical example of a simple harmonic oscillator. The characteristic equation for this problem is 2 mr + k = 0 ⇒ r = ±iω0 where r k ω = 0 m is the natural frequency of oscillation. The general solution is therefore

y(t) = A cos(ω0t) + B sin(ω0t) where A and B are determined from initial conditions. Physically speaking, the natural frequency ω0 is the number of full oscillation cycles the mass goes though per unit time. The period of oscillation T is defined as the amount of time required for one cycle, which is 2π T = . ω0 It is standard practice to re-write the solution in the form

y(t) = R cos(ω0t − φ),

67 which is always possible. To see this, we use the trig identity

cos(u − v) = cos(u) cos(v) + sin(u) sin(v).

Therefore, R cos(ω0t − φ) = R cos(ω0t) cos(φ) + R sin(ω0t) sin(φ). If we then set R cos(φ) = A, R sin(φ) = B, we get √ B  R = A2 + B2, φ = tan−1 . A Therefore the solution can always be written with a single cos in the form

y(t) = R cos(ω0t − φ) where R is the amplitude of oscillation (the maximum distance the system deviates from equilib- rium) and φ is referred to as the phase angle. The values of R and φ are determined by initial conditions. If we use the general initial value problem conditions

0 y(0) = y0, y (0) = v0, we get y(0) = A = y0 and 0 y (0) = Bω0 = v0 ⇒ B = v0/ω0 so q   2 2 2 −1 v0 R = y0 + v0/ω0, φ = tan ω0y0 Note that the velocity of the mass at time t is

0 v(t) = y (t) = −Rω0 sin(ω0t + φ) which has a maximum absolute value of q q 2 2 2 2 2 |v|max = Rω0 = ω0 y0 + v0/ω0 = (ω0y0) + v0.

Since there is no damping in this system, the total energy is conserved and it is therefore referred to as a conservative system. By using the energy function, we can derive the equation of motion by requiring that dE = 0, dt which is just the mathematical translation of the fact that the energy is constant. Since 1 1 E = m(y0)2 + ky2, 2 2 we have dE = my0y00 + kyy0 = 0 dt 68 by the chain rule. Factoring out y0 results in

y0(my00 + ky) = 0.

Since y0 6= 0, it follows that my00 + ky = 0. Since this system was relatively simple, we were able to derive the equation of motion from Newton’s 2nd Law but more complex systems are usually analyzed by energy considerations. Since the energy is constant, it is always equal to its initial value: 1 1 E(t) = E(0) = mv2 + ky2. 2 0 2 0 This can be verified by plugging in our solutions for y(t) and v(t) into the energy formula.

2.9.2 Damped Free Oscillations Now we consider the damped mass-spring system where γ > 0. In this case, the characteristic equation is mr2 + γr + k = 0 and has a discriminant D = γ2 − 4mk which leads to three different types of solutions based on the sign of D.

Case 1: D < 0 (under-damping). When D < 0, the roots of the characteristic equation are com- √ γ |D| plex and have the form r = λ ± iµ where λ = − 2m and µ = 2m . We then get a solution of the form − γ t y(t) = e 2m [A cos(µt) + B sin(µt)]. which can be written as − γ t y(t) = Re 2m cos(µt + φ). A system with this type of solution is said to be under-damped. An under-damped system con- forms to our intuitive notion of how the system should behave: it oscillates about the equilibrium with an exponentially decaying amplitude. Although this system has an oscillatory nature, it is not periodic because the amplitude is not constant. For this reason, µ is referred to as the quasi- frequency since the notion of a natural frequency only makes sense in the context of a periodic function. Likewise, the quasi-period is defined as T = 2π/µ.

Case 2: D > 0 (over-damping). When D > 0, the roots of the characteristic equation, r1 and r2, are real and distinct and we therefore get a solution of the form

y(t) = Aer1t + Ber2t.

A system that has this type of solution is said to be over-damped. Note that in order for this solution to by physical, we must have that r1, r2 ≤ 0, otherwise the oscillation would grow exponentially.

69 This property is always satisfied for any non-negative values of m, γ and k. To see this, we use the quadratic formula r −γ ± pγ2 − 4mk γ  γ 2 k r = = − ± − 2m 2m 2m m Notice that the solution with the minus sign is always less than or equal to zero: r γ  γ 2 k r = − − − ≤ 0. 1 2m 2m m The solution with the plus is also less than or equal to zero although this is less obvious. To show this, consider that r r  γ 2 k  γ 2 γ − ≤ = . 2m m 2m 2m Therefore r γ  γ 2 k γ γ r = − + − ≤ − + = 0. 2 2m 2m m 2m 2m In the over-damped case, the mass does not oscillate, it just slowly returns to the equilibrium. Our intuitive notion for the motion of the mass-spring system is usually that of the under-damped case because we envision performing this experiment in the earth’s atmosphere where the drag force is relatively weak. However, consider performing this experiment by immersing the mass-spring system in a very thick fluid, like molasses. The drag force in such a resistive fluid would be in- credibly strong. As soon as the mass is stretched an released, most of its energy would be quickly dissipated by the drag force and it would not have enough energy to over-shoot the equilibrium. √ Case 3: D = 0 (critical-damping). When D = 0, we have γ = 4mk and the characteristic γ equation has only one repeated root: r = − 2m . The general solution therefore has the form

− γ t y(t) = e 2m (A + Bt).

A system with this type of solution is said to be critically-damped, which represents the “boundary” between under-damping and over-damping. In this case, the motion of the mass-spring resembles that of the over-damped system: it just returns to the equilibrium without over-shooting.

Note that is all three of the above cases, the mass always approaches the equilibrium as t gets large, i.e., lim y(t) = 0. t→∞ What about the energy of a damped system? Intuitively, we should expect that the energy func- tion of a damped system is constantly decreasing since energy is dissipated by damping. As we previously showed, dE = y0(my00 + ky). dt Using the differential equation, we have

my00 + ky = −γy0

70 so dE = y0(−γy0) = −γ(y0)2 ≤ 0 dt since γ > 0 and (y0)2 ≥ 0. Therefore E(t) is a decreasing function of time. Since energy must be positive, it follows that lim E(t) = 0. t→∞ In other words, all of the energy is eventually dissipated by the drag force.

2.10 LRC Series Circuits

The mass-spring system is not the only physical system that can be modeled by the equation

ay00 + by0 + cy = 0.

This model can also be applied to an LRC series circuit, i.e., a closed circuit with 3 circuit elements in series: an inductor, a resistor and a capacitor. Let Q(t) be the charge on the capacitor at any given time. Using Kirkhoff’s Voltage Law, we can derive a differential equation for Q(t) that has the exact same form as the mass-spring equation. Kirkhoff’s Voltage Law says that the sum of the voltages across the elements of a closed circuit must add up to zero.

The charge Q on a capacitor and the voltage drop VC across the capacitor are known to obey the relationship Q = CVC where C is a constant called the capacitance. The voltage drop VR across a resistor is given by Ohm’s Law VR = RI where dQ I = dt is the current passing through the resistor and R is the constant resistance. The voltage drop VL across an inductor is given by dI d2Q V = L = L L dt dt2 where L is the constant inductance. Therefore the voltage drops across the three circuit elements are 1 V = LQ00,V = RQ0,V = Q. L R C C By Kirkhoff’s Volatage Law, VL + VR + VC = 0, giving us the differential equation for Q(t): 1 LQ00 + RQ0 + Q = 0, C which has the exact same form as the mass-spring system. The initial conditions would specify 0 Q(0) = Q0, the initial charge on the capacitor and Q (0) = I0, the initial current in the circuit.

71 The fact that the differential equations for the LRC circuit and the mass-spring system have the exact same form demonstrates an important concept in : many physical systems have the same mathematical model. Therefore, if we know how to solve the general dif- ferential equation, all we have to do is interpret the variables and constants in the context of the physical problem we are modeling. We also see that there is a direct correspondence between the mechanical mass-spring system and the electrical LRC circuit: 1 m ↔ L, γ ↔ R, k ↔ , y ↔ Q. C This correspondence has often been exploited by physicists and engineers for practical purposes. For example, suppose you are designing a very complicated mechanical system that is too difficult to analyze mathematically and would be very expensive and time-consuming to set up experimen- tally. Instead, you could use the above correspondence to translate the mechanical parameters into electrical parameters and then build the circuit and observe how it behaves using basic laboratory tools. In addition to being cheaper and easier than performing the mechanical experiment, the circuit experiment can be performed in a highly controlled environment whereas the mechanical experiment might be subjected to outside influences, like weather conditions.

An “undamped system” in the context of a circuit corresponds to R = 0, which is just an LC circuit. The oscillation cycles correspond to charge leaving one capacitor plate, accumulating on the opposite plane and then returning to the original plate. The natural frequency of this oscilla- q 1 tion is ω0 = LC and it’s period is T = 2π/ω0. The amplitude of the oscillation corresponds to the maximum amount of charge on either capacitor plate.

When the resistor is included, we have an LRC circuit, which give damped oscillations. The solutions exhibit the same behavior we saw in the previous section, which can be over-damped, under-damped or critically damped.

2.11 Forced Oscillations

In the last section, we considered free oscillations, i.e., systems that were not subjected to any external forces. We will now consider forced oscillations, which do have external forces acting on them, which appear in the differential equation as a non-homogeneous term. First consider the mass-spring system with a total external force F (t) acting on the mass. This external force could represent any number of outside influences and is often a periodic function of t. We refer to F (t) as the driving force. The total force acting on the system would then be

0 f = Fg + Fd + Fs + F (t) = mg − γy − k(L + y) + F (t).

Following the same steps as before, we get the equation

my00 + γy0 + ky = F (t),

72 which is the non-homogeneous version of the mass-spring system. We therefore solve it by solving the homogeneous system to find the complementary solution and then apply the method of unde- termined coefficients to find the particular solution. Since the particular solution is dependent on the functional form of F (t), we will only consider periodic driving forces of the form

F (t) = F0 cos(ωt) where F0 is the driving amplitude and ω is the driving frequency. The solution to the forced equation has the general form y(t) = yc(t) + yp(t) where yc is the complementary solution and yp is the particular solution. However, when discussing these solutions in physical terms, we often refer to the complementary solution as the transient solution ytr and the particular solution as the steady-state solution yss. Therefore, we’ll use the alternative notation y(t) = ytr(t) + yss(t). Since the driving force is assumed to be periodic, the steady-state solution will also be periodic and will have general form yss(t) = C cos(ωt + φss). When γ > 0, i.e., damping is included, the transient solution always decays exponentially and is therefore only relevant at small times. At larger times, the transient solution does not contribute much and the solution converges to the steady-state solution. It is important to note that the steady-state solution does not depend on initial conditions. Different initial conditions leads to different transient solutions but all solutions, regardless of the initial conditions, will converge to the steady-state solution as t → ∞.

2.11.1 Forced Oscillations with damping Let us first consider the case when γ > 0, i.e., a damped system. In this case, the transient (complementary) solution would fall into one of the three cases: under-damped, over-damped or critically damped, which is determined by the sign of the discriminant D = γ2 − 4mk. To find the steady-state (particular) solution, we use the initial guess

yss(t) = A cos(ωt) + B sin(ωt).

Then we get the derivatives 0 yss = −Aω sin(ωt) + Bω cos(ωt) 00 2 2 yss = −Aω cos(ωt) − Bω sin(ωt).

Plugging yss into the differential gives

00 0 myss + γyss + kyss = F0 cos(ωt)

2 2 m[−Aω cos(ωt)−Bω sin(ωt)]+γ[−Aω sin(ωt)+Bω cos(ωt)]+k[A cos(ωt)+B sin(ωt)] = F0 cos(ωt). Equating the cos coefficients gives us

2 −Amω + Bγω + Ak = F0

73 and equating the sin coefficients gives us

−Bmω2 − Aγω + Bk = 0

2 Recall that ω0 = k/m is the natural frequency of the undamped, unforced system. It is convenient to rewrite these equations as 2 2 Am(ω0 − ω ) + Bγω = F0 2 2 Bm(ω0 − ω ) − Aγω = 0 Using the second equation, we get m A = B(ω2 − ω2). γω 0 Plugging this into the first equation gives

γωF0 B = 2 2 2 2 2 2 m (ω0 − ω ) + γ ω so 2 2 mF0(ω0 − ω ) A = 2 2 2 2 2 2 . m (ω0 − ω ) + γ ω However, we want to write the steady-state solution in the standard form

yss(t) = C cos(ωt + φss).

To find the amplitude C, we calculate √ F C = A2 + B2 = 0 . p 2 2 2 2 2 2 m (ω0 − ω ) + γ ω The phase angle is     −1 B −1 γω φss = tan = tan 2 2 . A m(ω0 − ω ) Notice that the steady state amplitude C depends on the driving frequency ω in a nonlinear way. It is therefore an interesting question to ask if there is a value of ω maximizes the steady-state amplitude? This frequency is called the resonance frequency ωr and is of utmost importance in applications. To find the resonance frequency, let us define

2 2 2 2 2 2 G(ω) = m (ω0 − ω ) + γ ω so that we may write F C = √ 0 . G Therefore, C is maximized when G(ω) is at a global minimum. To calculate the frequency that minimizes G, we set dG = 0 dω to get dG = 2m2(ω2 − ω2)(−2ω) + 2γ2ω = 0. dω 0 74 Dividing by 2ω and rearranging, we get r γ2 γ2 = ω2 − ω2 ⇒ ω = ω2 − . 2m2 0 0 2m2 Therefore the resonance frequency is r r γ2 k γ2 ω = ω2 − = − . r 0 2m2 m 2m2 This can be verified to be a global minimum of G with the second derivative test. Plugging this value into G gives γ2(2mk − γ2) G(ω ) = r 4m2 which gives a maximum amplitude

F0 2mF0 Cmax = = . p p 2 G(ωr) γ 2km − γ

2.11.2 Forced oscillations with no damping Now we consider the undamped case when γ = 0, which gives us the equation

00 my + ky = F0 cos(ωt).

2 Dividing by m and using k/m = ω0, this can be written as F y00 + ω2y = 0 cos(ωt). 0 m Notice that if we take the limit as γ → 0 in the results from the last section, we get that the resonance frequency is just the natural frequency, ωr = ω0, but that the maximum amplitude Cmax → ∞. The reason for this was demonstrated in a previous example. The complementary solution of this equation is yc(t) = c1 cos(ω0t) + c2 sin(ω0t).

Now suppose that ω = ω0. Our usual guess for the particular solution would be

yp(t) = A cos(ω0t) + B sin(ω0t) but this is linearly dependent with the complementary solution so we would have to multiply it by t. The particular solution would then have the form

yp(t) = t[A cos(ω0t) + B sin(ω0t)] which can be written as yp(t) = Ct cos(ω0t + φ). However, the factor of t causes the amplitude to grow linearly in time, so there is no maximum amplitude. This phenomenon is called pure resonance. The reason for it can be understood as follows. When the driving frequency is the same as the natural frequency (ω = ω0), it means that the driving forces is perfectly in sync with the natural oscillation and therefore always acts in the

75 same direction that the spring is moving in, i.e., it acts to enhance its motion, rather than oppose it. On the other hand, when ω 6= ω0, the driving force is sometimes acting in the opposite direction of motion and sometimes acting in the same direction, which balance each other out to produce a periodic solution with a bounded amplitude.

Let us no find the general solution to this problem, assuming ω 6= ω0. Then our initial guess would be yp(t) = A cos(ωt) + B sin(ωt). Inserting this into the differential equation gives

2 2 2 −Aω cos(ωt) − Bω sin(ωt) + ω0[A cos(ωt) + B sin(ωt)] = F0 cos(ωt) which gives us the system of equations F −Aω2 + Aω2 = 0 0 m

2 2 −Bω + Bω0 = 0. From the second equation, B = 0 and from the first equation,

F0 A = 2 2 m(ω0 − ω ) so the general solution is

F0 y(t) = c1 cos(ω0t) + c2 sin(ω0t) + 2 2 cos(ωt). m(ω0 − ω )

The constants c1 and c2 depend on initial conditions. Let us assume the system is initially in equilibrium, i.e., the initial conditions are

y(0) = 0, y0(0) = 0.

Applying these conditions gives the equations

F0 y(0) = c1 + 2 2 = 0 m(ω0 − ω )

0 y (0) = c2ω0 = 0 so F0 c1 = − 2 2 , c2 = 0 m(ω0 − ω ) and the general solution is then

F0 y(t) = 2 2 [cos(ωt) − cos(ω0t)]. m(ω0 − ω ) Using the trig identity u − v  u + v  cos(u) − cos(v) = −2 sin sin , 2 2

76 we can write this equation as      2F0 (ω0 − ω)t (ω0 + ω)t y(t) = 2 2 sin sin . m(ω0 − ω ) 2 2 Let us re-write this as (ω + ω)t y(t) = A(t) sin 0 2 where   2F0 (ω0 − ω)t A(t) = 2 2 sin . m(ω0 − ω ) 2 The solution is thus has a periodically varying amplitude, giving by A(t).

2.11.3 Beat Phenomenon

Now consider the case where ω ≈ ω0. Then ω − ω0 is very small compared with ω + ω0. Then the amplitude function A(t) varies slowly, which gives rise to the beat phenomenon, which are fast oscillations with a slowly varying periodic amplitude. The beat frequency is the frequency of the amplitude function, |ω − ω| ω = 0 beat 2 and the beat length is the period of the amplitude function 2π 4π Tbeat = = . ωbeat |ω0 − ω| Beats phenomena often occur in acoustic applications. For example, when two guitars are slightly out of tune with each other and they play the same note simultaneously, the resulting sound wave is the sum of the two waves from each guitar. Since the frequency of these waves are slightly different, they interfere with each other in a specific way which is perceived by the ear as a periodic change in volume with a frequency ωbeat.

2.11.4 LRC Series Circuits All of the above analysis is valid for LRC circuits as well. In this case, the non-homogeneous equation would correspond to the circuit being hooked up to a power source with a potential V (t): 1 LQ00 + RQ0 + Q = V (t). C This is why we usually consider periodic non-homogeneous terms, since

V (t) = V0 cos(ωt) is the general form for an alternating potential.

77 2.12 The Nonlinear Pendulum

So far, the oscillations we have considered are the result of solving linear second-order equations. However, some oscillatory systems exhibit nonlinear oscillations that arise from a nonlinear equa- tion. Unfortunately, these systems are often too difficult to solve exactly and we usually rely on numerical methods. The prototypical example of a nonlinear oscillator is a pendulum.

Consider a pendulum with a lever of length L that has a mass m attached to the end of it. Let θ(t) be the angle (in radians) that the pendulum makes with respect to the vertical axis at time t so that θ = 0 corresponds the equilibrium position. We ignore friction and air resistance, i.e., the system is conservative. What is the equation of motion for this system? We could derive it using forces and Newton’s 2nd Law or, since it is a conservative system, we could derive it using the energy function. The velocity and acceleration of the mass are given by

dθ d2θ v(t) = L , a(t) = L dt dt2

dθ d2θ where dt is the angular velocity and dt2 is the angular acceleration. There are two forces acting on the system: gravity and tension, although the tension is irrelevant to the motion since it always acts in the radial direction, which is perpendicular to the angular direction. The component of the gravitational force that acts in the angular direction is

Fg = −mg sin(θ).

Therefore, applying Newtons’s 2nd Law in the angular direction gives us

00 ma = Fg ⇒ mLθ = −mg sin(θ).

This gives os the equation of motion

mLθ00 + mg sin(θ) = 0.

Dividing by mL results in g θ00 + sin(θ) = 0 L which is a second-order nonlinear equation for θ. This equation has no known analytic solution although it has been studied extensively with numerical methods.

We can also derive this equation by consider the fact that energy is conserved in this system. The kinetic energy is 1 1 K = mv2 = mL2(θ0)2 2 2 and the potential energy due to gravity is

U = mgy where y is the height of the mass above the equilibrium height, which is y = L(1 − cos(θ)). The total energy is thus 1 E = mL2(θ0)2 + mgL[1 − cos(θ)]. 2 78 Setting E0(t) = 0, results in

E0(t) = mL2θ0θ00 + mgL sin(θ)θ0 = 0 which factors as mLθ0[Lθ00 + g sin(θ)] = 0. Since θ0 6= 0, we get the equation of motion g Lθ00 + g sin(θ) = 0 ⇒ θ00 + sin(θ) = 0, L which is the same equation we got when using Newton’s 2nd Law.

A common technique for gaining insight into nonlinear equations is linearization, which approxi- mates a nonlinear equation with a linear one. However, linear approximations are only good when the system is close to its equilibrium. Recall that the Taylor series expansion for sin(θ) is 1 1 sin(θ) = θ − θ3 + θ5 + ... 3! 5! Therefore, if θ  1, then sin(θ) ≈ θ, since the higher-order terms would be much smaller than the first term. This tells us that when θ is small, i.e., close to the equilibrium, we may approximate the equation of motion with the linearized equation g θ00 + θ ≈ 0, L which is exactly the equation for a simple harmonic oscillator, like the undamped mass-spring system. The natural frequency and period are approximated by

r g 2π ω0 ≈ ,T ≈ L ω0 and the approximate solution is

θ(t) ≈ c1 cos(ω0t) + c2 sin(ω0t)

Note that since θ can never be greater than its initial value, it suffices that θ0  1 in order for this approximation to be valid.

79 Chapter 3

Laplace Transforms

3.1 Introduction

We will now introduce a different method for solving non-homogeneous linear differential equations of the form 00 0 0 0 ay + by + cy = g(t), y(0) = y0, y (0) = y0. We previously approached this problem with the method of undetermined coefficients but this is a rather clumsy method that only works for specific types of functional form for g(t). The method of Laplace transforms is a much more powerful and general method that will allow us to solve this equation for just about any g(t) we could imagine, even discontinuous functions. Electrical engineers often encounter this type of problem so the Laplace transform method is the method of choice in electrical .

3.1.1 Integral Transforms We first define the general notion of an . When we encounter difficult problems in mathematics, a common technique that we use is to apply some transformation to the problem that makes it simpler to solve. After solving the transformed problem, we must then apply the inverse of the original transformation to get the answer in terms of the original problem. Integral transforms are a clever way to so exactly that. An integral transform I is defined as an operation that transforms a function y(t) into a different function with a different domain Y (s) via an integral: Z b I[y] = K(s, t)y(t) dt = Y (s). a The brackets in I[y] are used to denote that I is not really a function, but an operator that acts on a function y. The integral transform is characterized by the limits of integration, a and b, and the function K(s, t), which is called the kernel of the transformation. It transforms that function y(t) into the function Y (s) by integrating over the t variable, while holding s fixed. Once t has been “integrated out”, we are left only with a function of s. Of course, there are many different integral transforms possible but in order to be useful, the transform must be invertible, i.e., given Y (s), we must be able to apply the inverse transformation to recover y(t). An important property of an integral transform is that it is a linear transformation, i.e., it satisfies the requirements

I[cy] = cI[y] = cY (s), c ∈ R

80 and I[y1 + y2] = I[y1] + I[y2] = Y1(s) + Y2(s). More generally, we could say that

I[c1y1 + c2y2] = c1I[y1] + c2I[y2] = c1Y1(s) + c2Y2(s) for any constants c1 and c2 and for any functions y1 and y2. These properties follow directly from the linearity properties of integrals. This is a very useful property that we will take advantage of often.

3.1.2 The Laplace Transform Definition The Laplace transform L is an integral transform whose limits of integration are a = 0, b = ∞ and the kernel is K(s, t) = e−st. Therefore the Laplace transform is written explicitly as

Z ∞ L [y] = e−sty(t) dt = Y (s). 0 Since this is an improper integral, we must take care to make sure that the integral converges when using it. For most functions y(t), this integral is guaranteed to converge for s > 0 so the domain of Y (s) will always be some sub-interval of (0, ∞). A sufficient condition to guarantee that the integral converges on some interval s ∈ (a, ∞) is that y(t) can not grow faster than an exponential function. All functions we will consider in this class will satisfy this requirement. Note that if t has units of time, then s has units of frequency. Therefore, we often refer to the domain of y as the time domain and the domain of Y as the frequency domain.

3.1.3 Examples Example 3.1.1. Compute the Laplace transform of y(t) = 1.

Solution: The Laplace transform for y(t) = 1 is

Z ∞ t=∞ −st 1 −st 1 1 L [1] = e dt = − e = − (0 − 1) = . 0 s t=0 s s Note that by the linearity of integral transforms, we can use this to get the Laplace transform for any constant c: c L [c] = cL [1] = . s Example 3.1.2. Compute the Laplace transform of y(t) = eat with s > a.

Solution: The Laplace transform for y(t) = eat is

Z ∞ Z ∞ t=∞ at −st at (a−s)t 1 (a−s)t 1 1 L [e ] = e e dt = e dt = e = (0 − 1) = . 0 0 a − s t=0 a − s s − a Note that the requirement that s > a is necessary for the integral to converge. Also notice, that y(t) = 1 is a special case of this problem with a = 0.

81 Example 3.1.3. Compute the Laplace transform of y(t) = 3 − 4e2t.

Solution: This can be done simply using the linearity property and the last two examples: 3 4 s + 6 L [3 − 4e2t] = 3L [1] − 4L [e2t] = − = − . s s − 2 s(s − 2) Example: Compute the Laplace transform of y(t) = cos(at).

Solution: Recall that cos(at) = (eiat + e−iat)/2. Therefore   1 iat −iat  1 1 1 s L [cos(at)] = L [e ] + L [e ] = + = . 2 2 s − ia s + ia s2 + a2

3.1.4 Properties of the Laplace Transform In this section, we will derive some useful properties of Laplace transforms.

Time Scaling

Let Y (s) be the Laplace transform of y(t). State the Laplace transform of y(at) in terms of Y .

The Laplace transform for y(at) is Z ∞ L [y(at)] = e−sty(at)dt. 0 Making the substitution u = at, we get 1 Z ∞ 1 Z ∞ 1 s L [y(at)] = e−su/ay(u)du = e−(s/a)uy(u)du = Y . a 0 a 0 a a Frequency Shifting

Let Y (s) be the Laplace transform of y(t). State the Laplace transform of eaty(t) in terms of Y .

The Laplace transform for eaty(t) is Z ∞ Z ∞ L [eaty(t)] = e−steaty(t)dt = e−(s−a)ty(t)dt = Y (s − a). 0 0 There are a lot of ways we can apply this. For example, let y(t) = cos(bt). Then Y (s) = s/(s2 +b2), as we already showed. Using this property, we get that s − a L [eat cos(bt)] = Y (s − a) = . (s − a)2 + b2 Frequency Differentiation

Let Y (s) be the Laplace transform of y(t). Then by definition Z ∞ Y (s) = e−sty(t)dt. 0

82 If we then differential each side with respect to s, we get d Z ∞ Z ∞ d Z ∞ Y 0(s) = e−sty(t)dt = (e−st)y(t)dt = −e−stty(t)dt = −L [ty(t)]. ds 0 0 ds 0 This gives us the useful identity L [ty(t)] = −Y 0(s). If this process is repeated n times, we get the more general identity

L [tny(t)] = (−1)nY (n)(s). Note that if we apply this identity with y(t) = 1, we get the Laplace transform of tn is dn 1 n! L [tn] = (−1)n = . dsn s sn+1 Time Differentiation

Let Y (s) be the Laplace transform of y(t). State the Laplace transform of y0(t) in terms of Y .

The Laplace transform for y0(t) is Z ∞ L [y0(t)] = e−sty0(t)dt. 0 Now we do integration by parts with u = e−st and = dv = y0(t)dt. Then du = −se−stdt and v = y. Integration by parts the gives us

Z ∞ t=∞ Z ∞ Z ∞ −st 0 −st −st −st e y (t)dt = e y(t) + se y(t)dt = (0 − y(0)) + s e y(t)dt = sY (s) − y(0). 0 t=0 0 0 This gives us the most useful property of Laplace transforms for solving differential equations:

L [y0(t)] = sY (s) − y(0). Repeating this process a second time, would yield the result for the Laplace transform of the second derivative:

00 0 0 0 2 0 L [y (t)] = sL [y (t)] − y (0) = s(sY (s) − y(0)) − y (0) = s Y (s) − sy0 − y0. We can use this property to find the Laplace transform for sin(at) since we already know the Laplace transform of y(t) = cos(at): 1  d  1 1  s2  a L [sin(at)] = − L cos(at) = − (sY (s) − cos(0)) = − − 1 = a dt a a s2 + a2 s2 + a2 Action on a Differential Equation

Consider a simple first-order non-homogeneous equation of the form

0 ay + by = g(t), y(0) = y0

83 If we take the Laplace transform of each side, we get

aL [y0] + bL [y] = L [g(t)] which gives us G(s) + ay a[sY (s) − y ] + bY (s) = G(s) ⇒ Y (s) = 0 . 0 as + b Notice that we were able to solve for Y (s) algebraically after performing the Laplace transform. This is what makes Laplace transforms so useful: differential equations in the time domain become algebraic equations in the frequency domain. However, there still remains the problem of inverting Y (s) to recover the solution y(t).

3.1.5 Further Examples We have already seen that the Laplace transform for monomials with integer powers is n! L [tn] = . sn+1 But what about non-integer powers? It turns out that there is a well defined way extend the idea of a factorial to any positive number, which is called the gamma function Γ(r). The gamma function is defined by the integral Z ∞ Γ(r) = xr−1e−xdx. 0 When evaluated at integers, the gamma function satisfies the relation

Γ(n) = (n − 1)! which can be proven using successive integration by parts. Therefore we can generalize the Laplace transform for non-integer powers of t: Γ(r + 1) L [tr] = . sr+1 Other than integers, not many exact values for the gamma function are known. One exception is √ π Γ(3/2) = (1/2)! = . 2 Like the factorial, the gamma function satisfies the property

Γ(r + 1) = rΓ(r) and we can use this to generate the factorials of all multiples of 1/2. For example, √ 3 π (3/2)! = (3/2)(1/2)! = . 4 This allows us to compute √ √ Γ(3/2) π L [ t] = L [t1/2] = = s3/2 2s3/2 84 and √ Γ(5/2) 3 π L [t3/2] = = . s5/2 4s5/2 Some problems will require us to apply multiple properties of the Laplace transform. For example, consider the problem of finding the Laplace transform of

y(t) = te−3t sin(2t).

By starting with the Laplace transform of sin(2t), we can apply the frequency differentiation property to get the Laplace transform of t sin(2t) and then apply the frequency shifting property to get the Laplace transform of y(t). Let u(t) = sin(2t). Then 2 U(s) = . s2 + 4 Now let z(t) = tu(t). Applying frequency differentiation gives us 4s L [z(t)] = L [tu(t)] = −U 0(s) = = Z(s). (s2 + 4)2

Now applying frequency shifting gives us

4(s + 3) L [y(t)] = L [e−3tz(t)] = Z(s + 3) = . [(s + 3)2 + 4]2

3.1.6 Inversion of the Laplace Transform So far, we have seen how to compute a Laplace transform of a function y(t) in the time domain, which results in the function Y (s) in the frequency domain. However, in order to effectively use Laplace transforms, we must have a way of performing the inverse operation: given Y (s), find y(t). The notation we use for this operation is

y(t) = L −1[Y (s)].

Unfortunately, to do this for a general function Y (s) involves some pretty advanced mathematical techniques that are beyond the scope of this course. However, the inverse Laplace transforms for many different types of functions have been calculated and tabulated by mathematicians for centuries and it is perfectly fine to just look up the inverses in a table or simply use what we already know. We’ve already seen what the Laplace transforms are for the most common types of functions so we should be able to use this information to find the inverse Laplace transform. The idea is best illustrated by examples.

2s Example 3.1.4. Find the inverse Laplace transform of the function Y (s) = s2+9 .

Solution: Recall the Laplace transform for the cosine function: s L [cos(at)] = . s2 + a2

85 This tells us that  s  L −1 = cos(at). s2 + a2 We recognize that Y (s) has a similar form so we can use this result to invert Y (s):  2s   s  y(t) = L −1 = 2L −1 = 2 cos(3t). s2 + 9 s2 + 32 3 Example 3.1.5. Find the inverse Laplace transform of the function Y (s) = s2−s .

Solution: So far, we have not seen a Laplace transform that resembles Y (s) but if we do a partial fraction decomposition (PFD), we can reduce Y (s) to a linear combination of functions that we can look up in the table. 3 3 A B Y (s) = = = + . s2 − s s(s − 1) s s − 1 Multiplying by s(s − 1) results in 3 = A(s − 1) + Bs and equating coefficients gives 3 = −A, A + B = 0 ⇒ B = 3. Therefore, we get −3 3 Y (s) = + . s s − 1 Now we can do these: the first term is the Laplace transform of −3 and the second term is the Laplace transform of 3et. Therefore 1  1  y(t) = L −1[Y (s)] = −3L −1 + 3L −1 = −3 + 3et. s s − 1 3 Example 3.1.6. Find the inverse Laplace transform of the function Y (s) = s2+2s+5 .

Solution: So far, we have not seen a Laplace transform that resembles Y (s). The denomi- nator can not be factored to apply a PFD either. When encountering a function like this, we must complete the square: 3 3 3 Y (s) = = = s2 + 2s + 5 s2 + 2s + 1 + 4 (s + 1)2 + 4 This almost resembles the expression for the Laplace transform of eat sin(bt): b L [eat sin(bt)] = (s − a)2 + b2 with a = −1 and b = 2. However, the numerator is 3 and we need it to be 2 in order to use this formula. We can fix this by writing it as 3 3 2 Y (s) = = · (s + 1)2 + 4 2 (s + 1)2 + 4 and therefore 3  2  3 y(t) = L −1 = e−t sin(2t). 2 (s + 1)2 + 4 2

86 5s+2 Example 3.1.7. Find the inverse Laplace transform of the function Y (s) = (s−3)2+16 .

Solution: First, we split this function up us s 2 Y (s) = 5 · + (s − 3)2 + 16 (s − 3)2 + 16

We recognize them second term has having the form 2 F (s − 3), where F (s) = . s2 + 16 This almost resembles the Laplace transform of sin(at) which has the form a/(s2 + a2). Do get F (s) in this form with a = 4, we can write it as 1 4 1 F (s) = ⇒ f(t) = sin(4t). 2 s2 + 16 2 For the first term in Y (s), we would like to also get it into the form of F (s − 3). In order to get it into this form, we just add and subtract 3 from the numerator: s s − 3 + 3 s − 3 3 5 · = 5 · = 5 · + 5 · . (s − 3)2 + 16 (s − 3)2 + 16 (s − 3)2 + 16 (s − 3)2 + 16

Now the first term in the above expression has the form G(s − 3) where s G(s) = 5 · ⇒ g(t) = 5 cos(4t). s2 + 16 For the second term, we write it as 3 15 4 5 · = · = H(s − 3) (s − 3)2 + 16 4 (s − 3)2 + 16 where 15 4 15 H(s) = · ⇒ h(t) = sin(4t). 4 s2 + 16 4 To summarize, Y (s) = F (s − 3) + G(s − 3) + H(s − 3). Applying the frequency shifting property to each term gives us the solution:

y(t) = e3t[f(t) + g(t) + h(t)] 1 15  = e3t sin(4t) + 5 cos(4t) + sin(4t) 2 4  17  = e3t 5 cos(4t) + sin(4t) . 4

87 3.1.7 Table of Results

Time Domain: y(t) = L −1[Y (s)] Frequency Domain: Y (s) = L [y(t)]

1 1 s

at 1 e s−a

s cos(at) s2+a2

a sin(at) s2+a2

r Γ(r+1) t sr+1 √ √ π t 2s3/2

at (s−a) e cos(bt) (s−a)2+b2

at b e sin(bt) (s−a)2+b2

s cosh(at) s2−a2

a sinh(at) s2−a2

r at Γ(r+1) t e (s−a)r+1

e−as ua(t) s

−as ua(t)y(t − a) e Y (s)

δ(t − a) e−as

δ(t − a)y(t) y(a)e−as

1 s  y(at) a Y a

eaty(t) Y (s − a)

tny(t) (−1)nY (n)(s)

y0(t) sY (s) − y(0)

y00(t) s2Y (s) − sy(0) − y0(0)

88 3.2 Solving IVPs with Laplace Transforms

Laplace transforms provide a powerful and general method for solving linear initial value problems of any order and with any non-homogeneous terms. Up until now, we have always solved non- homogeneous equations either using an integrating factor for first order equations or the method of undetermined coefficients for second order equations. Now we will see how to use Laplace transforms to tackle these problems. The general strategy of solving an IVP with a Laplace transform is as follows.

1. Take the Laplace transform of each side of the differential equation.

2. Algebraically solve for Y (s).

3. Compute the inverse Laplace transform of Y (s) to obtain y(t).

As we have already seen, Laplace transforms act on derivatives in such a way as to convert dif- ferential equations into algebraic equations. This reduces the act of solving for Y (s) into simple algebra. However, this is the easy part of the problem. The real difficulty in using Laplace trans- forms comes in the last step when we must invert Y (s). The reason this is difficult is that Y (s) won’t always have a simple form that appears in our lookup table; we often have to perform alge- braic techniques to break it down into simpler forms that we can look up in the table. This usually involves the method of partial fraction decomposition (PFD), which we will be using quite often. It is also sometimes possible to use one or more of the general properties of the Laplace transform, like frequency shifting or frequency differentiation, although this can require some ingenuity.

Recall from the last section that

L [y0(t)] = sY (s) − y(0).

We can repeat this process to get the Laplace transform for a second-derivative. Let v(t) = y0(t). Then L [y00(t)] = L [v0(t)] = sL [v(t)] − sv(0) = s[sL [y(t)] − y(0)] − v(0) which is simplified to

L [y00(t)] = s[sY (s) − y(0)] − y0(0) = s2Y (s) − sy(0) − y0(0).

Let us see how to use these expressions to solve some initial value problems.

Example 3.2.1. Solve the initial value problem

0 y = ay, y(0) = y0.

Solution: Taking the Laplace transform of the equation gives us

L [y0] = aL [y] which gives us sY (s) − y0 = aY (s).

89 We now solve for Y (s): y (s − a)Y (s) = y ⇒ Y (s) = 0 . 0 s − a Now we just compute the inverse Laplace transform of Y (s):   −1 −1 1 at y(t) = L [Y (s)] = y0L = y0e . s − a

Example: Solve the initial value problem

y00 + 4y = 0, y(0) = 3, y0(0) = 2

Solution: Taking the Laplace transform of the equation gives us

L [y00] + 4L [y] = 0 which gives us [s2Y (s) − 3s − 2] + 4Y (s) = 0. We now solve for Y (s): 3s + 2 s 2 (s2 + 4)Y (s) = 3s + 2 ⇒ Y (s) = = 3 + . s2 + 4 s2 + 4 s2 + 4 Notice that this has the form s a Y (s) = 3 + s2 + a2 s2 + a2 with a = 2. Referring to our table, we see that the solution is

y(t) = L −1[Y (s)] = 3 cos(2t) + sin(2t).

Example 3.2.2. Solve the initial value problem

y0 + 2y = t, y(0) = 1.

Solution: Taking the Laplace transform of the equation gives us

L [y0] + 2L [y] = L [t] which gives us 1 sY (s) − 1 + 2Y (s) = s2 We now solve for Y (s): 1 1 1 (s + 2)Y (s) = + 1 ⇒ Y (s) = + . s2 s2(s + 2) s + 2

The second term is already in the proper form to be inverted but we’ll have to do a PFD on the first term: 1 A B C = + + ⇒ 1 = As(s + 2) + B(s + 2) + Cs2 = (A + C)s2 + (2A + B)s + 2B. s2(s + 2) s s2 s + 2

90 Equating the coefficients for each power of s, we get

2B = 1, 2A + B = 0,A + C = 0 which has the solution 1 B 1 1 B = ,A = − = − ,C = −A = . 2 2 4 4 Therefore Y (s) is 1 1 1 1 1 1 5 Y (s) = − + + + = − + + . 4s 2s2 4(s + 2) s + 2 4s 2s2 4(s + 2)

Now we just compute the inverse Laplace transform of Y (s):

1 1 1  1  5  1  1 1 5 y(t) = L −1[Y (s)] = − L −1 + L −1 + L −1 = − + t + e−2t 4 s 2 s2 4 s + 2 4 2 4 so the final solution is 1 1 5 y(t) = − + t + e−2t. 4 2 4 Example 3.2.3. Solve the initial value problem

y00 − 2y0 + 2y = 0, y(0) = 0, y0(0) = 1.

Solution: Taking the Laplace transform of the equation gives us

L [y00] − 2L [y0] + 2L [y] = 0 which gives us

[s2Y (s) − s · 0 − 1] − 2[sY (s) − 0] + 2Y (s) = 0 ⇒ s2Y (s) − 1 − 2sY (s) + 2Y (s) = 0

We now solve for Y (s): 1 (s2 − 2s + 2)Y (s) = 1 ⇒ Y (s) = . s2 − 2s + 2 This Laplace transform does not appear in our table. However, we can write the denominator as

s2 − 2s + 2 = s2 − 2s + 1 + 1 = (s − 1)2 + 12 so 1 Y (s) = (s − 1)2 + 12 Now we see that this has the form of the Laplace transform for eat sin(bt) with a = b = 1. The solution is therefore y(t) = L −1[Y (s)] = et sin(t).

91 Example 3.2.4. Solve the initial value problem y00 + y0 − 6y = 2t, y(0) = 0, y0(0) = 0. Solution: Taking the Laplace transform of the equation gives us

L [y00] + L [y0] − 6L [y] = L [2t] which gives us 2 2 [s2Y (s) − s · 0 − 0] + [sY (s) − 0] − 6Y (s) = ⇒ s2Y (s) + sY (s) − 6Y (s) = s2 s2 We now solve for Y (s): 2 2 (s2 + s − 6)Y (s) = ⇒ Y (s) = . s2 s2(s − 2)(s + 3) Now we must do a PFD to get Y (s) into a form where it can be inverted: 2 A B C D = + + + . s2(s − 2)(s + 3) s s2 s − 2 s + 3 Multiplying through by the common denominator gives us 2 = As(s − 2)(s + 3) + B(s − 2)(s + 3) + Cs2(s + 3) + Ds2(s − 2). Since these equations must hold for every value of s, an alternative (and sometimes easier) way to solve for the coefficients is to just plug in values of s that simplify the equation. For example, letting s = 0 gives us 2 = −6B ⇒ B = −1/3. Plugging in s = 2 results in 2 = C(22)(2 + 3) ⇒ C = 1/10. Plugging in s = −3 results in 2 = D(−3)2(−3 − 2) ⇒ D = −2/45. Now plugging in s = 1 results in 2 = A(−1)(4) + B(−1)(4) + C(4) + D(−1) ⇒ 2 = −4A − 4B + 4C − D and therefore A = −(2 + 4B − 4C + D)/4 = −1/18. After doing the PFD, the Laplace transform is A B C D Y (s) = + + + s s2 s − 2 s + 3 so its inverse is 1 1 1 2 y(t) = A + Bt + Ce2t + De−3t = − − t + e2t − e−3t. 18 3 10 45 Notice that this is the sum of a complementary solution (the exponential terms) and a particular solution (the linear terms).

92 Example 3.2.5. Solve the initial value problem

y00 + 2y0 + y = 4e−t, y(0) = 2, y0(0) = −1.

Solution: Taking the Laplace transform of the equation gives us 4 L [y00] + 2L [y0] + L [y] = s + 1 which gives us 4 [s2Y (s) − 2s + 1] + 2[sY (s) − 2] + Y (s) = . s + 1 This simplifies to 4 4 (s2 + 2s + 1)Y (s) = 2s − 1 + 4 + ⇒ (s + 1)2Y (s) = 2s + 3 + s + 1 s + 1 so s 1 1 Y (s) = 2 + 3 + 4 . (s + 1)2 (s + 1)2 (s + 1)3 Now we have to be clever in figuring out the inverse Laplace transforms of these functions. The second term is the easiest since we know that 1 L [t] = . s2 Using the frequency shifting property, we get

1  1  L [te−t] = ⇒ L −1 = te−t. (s + 1)2 (s + 1)2

Now we do the last term. We know that 2! 1 1 L [t2] = ⇒ L [ t2] = s3 2 s3 so again using the frequency shifting property, we have 1 1 L [ e−tt2] = . 2 (s + 1)3

Now we do the first term. Notice that s = sF (s) (s + 1)2 where 1 F (s) = ⇒ f(t) = te−t. (s + 1)2 Since f(0) = 0, we can write

s  s  = sF (s) − f(0) ⇒ L −1 = L −1 [sF (s) − f(0)] = f 0(t). (s + 1)2 (s + 1)2

93 Therefore   −1 s 0 d −t −t −t L = f (t) = te = e − te . (s + 1)2 dt Combining all of these results, we get

y(t) = L −1[Y (s)]  s   1   1  = 2L −1 + 3L −1 + 4L −1 (s + 1)2 (s + 1)2 (s + 1)3 1 = 2(e−t − te−t) + 3te−t + 4 · t2e−t 2 = e−t(2t2 + t + 2).

3.3 Laplace Transforms of Piecewise Functions

One of the most powerful aspects of Laplace transforms is that they allow us to solve non- homogeneous equations, even when the non-homogeneous term is a piecewise-defined function of t that may contain discontinuities. We start by introducing some of the simplest piecewise-defined functions that can then be used as building blocks to construct more complicated functions.

3.3.1 Step Functions and Piecewise Functions The unit step function, also referred to as the heaviside function is defined as ( 0 if t < 0 u(t) = . 1 if t ≥ 0

Note that since we will always be dealing with functions whose time domain is [0, ∞), the unit step function u(t) = 1 in this domain. A unit step function that is shifted to the right by a is defined as ( 0 if t < a ua(t) = u(t − a) = . 1 if t ≥ a Note that ( 1 if t < a 1 − ua(t) = 0 if t ≥ a switches the intervals where the function is 0 and 1. We also note that

lim ua(t) = u∞(t) = 0. a→∞ The Laplace transform of a general step function is

Z ∞ Z ∞ t=∞ −as −st −st 1 −st e Ua(s) = L [ua(t)] = e ua(t) = e = − e = . 0 a s t=a s

94 The rectangle function is defined as ( 1 if a ≤ t ≤ b r[a,b](t) = . 0 otherwise

This function is just a linear combination of two step functions:

r[a,b](t) = ua(t) − ub(t) so its Laplace transform is

e−as − e−bs R[a,b](s) = L [rab(t)] = L [ua(t) − ub(t)] = . s There is a very useful identity involving step functions that we will need before learning how to solve IVPs. Let y(t) be a function. Then

Z ∞ Z ∞ −st −st L [ua(t)y(t − a)] = e ua(t)y(t − a)dt = e y(t − a)dt. 0 a Now introducing a new integration variable τ = t − a, we get Z ∞ Z ∞ e−s(τ+a)y(τ)dτ = e−as e−sτ y(τ)dτ = e−asY (s). 0 0 So −as −1 −as L [ua(t)y(t − a)] = e Y (s) ⇒ L [e Y (s)] = ua(t)y(t − a). We will use this identity often when solving IVPs involving step functions.

Any piecewise function can be stated as a combination of rectangle functions, or equivalently, a combination of step functions. Therefore, we can always find the Laplace transform for a piece- wise function g(t) because we can always represent g(t) as a combination of step functions, which we know how to transform.

Example 3.3.1. Write the function f(t) with step functions:  2 if 0 ≤ t < 1  1 if 1 ≤ t < 2  f(t) = 5 if 2 ≤ t < 3 .  6 if 3 ≤ t < 4  3 if t ≥ 4

Solution: We first define this in terms of rectangle functions by multiplying each “component” function by the rectangle function for the interval it is defined on and add all of them together:

f(t) = 2 · r[0,1] + 1 · r[1,2] + 5 · r[2,3] + 6 · r[3,4] + 3 · r[4,∞].

95 Now we use the definition of the rectangle functions to write this in terms of step functions:

f(t) = 2(u0 − u1) + 1(u1 − u2) + 5(u2 − u3) + 6(u3 − u4) + 3(u4 − u∞) which simplifies to

f(t) = 2u0 − 2u1 + u1 − u2 + 5u2 − 5u3 + 6u3 − 6u4 + 3u4 − 3u∞

= 2 − u1 + 4u2 + u3 − 3u4.

Example 3.3.2. Write the function f(t) with step functions:  1 if 0 ≤ t ≤ 1  f(t) = t if 1 < t ≤ 3 . 2 − t2 if t > 3

Solution: We first define this in terms of rectangle functions by multiplying each “component” function by the rectangle function for the interval it is defined on and add all of them together:

2 f(t) = 1 · r[0,1] + t · r[1,3] + (2 − t ) · r[3,∞].

This can be written in terms of steps functions as

2 2 2 f(t) = u0 − u1 + t(u1 − u3) + (2 − t )(u3 − u∞) = u0 − u1 + t(u1 − u3) + (2 − t )u3 − (2 − t )u∞ which simplifies to 2 1 + (t − 1)u1 + (2 − t − t)u3. Example 3.3.3. Find the Laplace transform of the periodic square wave function defined as  1 if 0 ≤ t ≤ 1  f(t) = 0 if 1 < t ≤ 2 . f(t) = f(t − 2) if t > 2

Solution: This function keeps alternating between 1 and 0. It is 0 in intervals that start with odd integers and 1 in intervals that start with even integers. Therefore, we can state it is as an infinite linear combination of rectangle functions:

∞ ∞ X X f(t) = 1 · r[2n,2n+1](t) + 0 · r[2n+1,2n](t) = r[2n,2n+1](t). n=0 n=0 Now we write it in terms of step functions as

∞ X f(t) = u2n(t) − u2n+1(t). n=0 Taking the Laplace transform now gives us

∞ ∞ ∞ X e−2ns e−(2n+1)s X e−2ns e−2ns X 1 F (s) = − = − e−s · = (1 − e−s)e−2ns. s s s s s n=0 n=0 n=0

96 Notice that we can now pull out the stuff that does not depend on n and the resulting series is a geometric series: ∞ 1 − e−s X F (s) = (e−2s)n. s n=0 Recall that a geometric series converges to

∞ X 1 xn = , if |x| < 1. 1 − x n=0 Since |e−2s| < 1 for all s > 0, the series for F (s) converges to

∞ 1 − e−s X 1 − e−s F (s) = (e−2s)n = . s s(1 − e−2s) n=0

3.3.2 IVPs with Piecewise Functions Example 3.3.4. Solve the initial value problem

0 y + 2y = ua(t), y(0) = 4.

Solution: Taking the Laplace transform of each side gives e−as e−as sY (s) − 4 + 2Y (s) = ⇒ (s + 2)Y (s) = 4 + s s so 4 1 Y (s) = + e−as . s + 2 s(s + 2) For the second term, we do a PFD: 1 A B = + ⇒ 1 = A(s + 2) + Bs s(s + 2) s s + 2 which gives the equations

2A = 1,A + B = 0 ⇒ A = 1/2,B = −1/2.

Therefore, 4 1 1 1  Y (s) = + e−as − . s + 2 2 s s + 2 The inverse of the first term is  4  L −1 = 4e−2t s + 2 and the second term is in the form e−asH(s) where 1 1 H(s) = − . s s + 2 The inverse of H(s) is h(t) = 1 − e−2t

97 so −1 −as −2(t−a) L [e H(s)] = ua(t)h(t − a) = ua(t)[1 − e ]. Therefore the final solution is 1 y(t) = 4e−2t + u (t)[1 − e−2(t−a)]. 2 a Example 3.3.5. Solve the initial value problem

00 0 y + y = u2(t), y(0) = 0, y (0) = 1.

Solution: Taking the Laplace transform of each side gives

e−2s e−2s s2Y (s) − sy(0) − y0(0) + Y (s) = ⇒ (s2 + 1)Y (s) = 1 + s s so 1 1 Y (s) = + e−2s . s2 + 1 s(s2 + 1) For the second term, we do a PFD: 1 A Bs + C = + ⇒ 1 = A(s2 + 1) + (Bs + C)s s(s2 + 1) s s2 + 1 which gives the equations

A + B = 0,C = 0,A = 1 ⇒ A = 1,B = −1,C = 0.

Therefore, 1 1 s  Y (s) = + e−2s − . s2 + 1 s s2 + 1 The inverse of the first term is  1  L −1 = sin(t) s2 + 1 and the second term is in the form e−2sH(s) where 1 s H(s) = − . s s2 + 1 The inverse of H(s) is h(t) = 1 − cos(t) so −1 −2s L [e H(s)] = u2(t)h(t − 2) = u2(t)[1 − cos(t − 2)]. Therefore the final solution is

y(t) = sin(t) + u2(t)[1 − cos(t − 2)].

98 Example 3.3.6. Solve the initial value problem

y00 + 6y0 = 216g(t), y(0) = 0, y0(0) = 0 where ( 0 if 0 ≤ t < 3 g(t) = . t − 3 if t ≥ 3 Solution: Taking the Laplace transform of each side gives

s2Y (s) + 6sY (s) = 216L [g(t)] = 216G(s).

To find the Laplace transform of g(t), we write it in terms of step functions:

−3s −3s e g(t) = u3(t)(t − 3) ⇒ G(s) = e L [t] = . s2 This type of function is called a ramp function since it resembles a ramp when plotted. Now solving for Y gives us 216e−3s 216e−3s s(s + 6)Y (s) = ⇒ Y (s) = s2 s3(s + 6) Notice that this can be written in the form

Y (s) = e−3sF (s) with 216 F (s) = s3(s + 6) and therefore the solution from the inverse Laplace transform will have the form

y(t) = u3(t)f(t − 3) and we therefore only need to find f(t). To do so, we do a PDF to get 216 A B C D F (s) = = + + + s3(s + 6) s s2 s3 s + 6 Multiplying through by the common denominator gives us

216 = As2(s + 6) + Bs(s + 6) + C(s + 6) + Ds3 and combining like terms,

216 = (A + D)s3 + (6A + B)s2 + (6B + C)s + 6C.

Equating the coefficients for each power of s gives

A + D = 0, 6A + B = 0, 6B + C = 0, 6C = 216.

Solving these equations gives

A = 1,B = −6,C = 36,D = −1

99 so 1 6 36 1 F (s) = − + − . s s2 s3 s + 6 We now invert each term of F (s): 1 L −1 = 1, s  6  L −1 = 6t, s2 36 L −1 = 18t2, s3  1  L −1 = e−6t. s + 6 Therefore f(t) = 1 − 6t + 18t2 − e−6t and the solution is thus

2 −6(t−3) y(t) = u3(t)f(t − 3) = u3(t)[1 − 6(t − 3) + 18(t − 3) − e ]. Notice that the solution is zero until t = 3. Before t = 3, the equation is homogeneous and both initial conditions are zero so the solution is zero on this interval. However, once the forcing function is turned on at t = 3, the solution begins to change. Example 3.3.7. Solve the initial value problem 5 y00 + y0 + y = g(t), y(0) = 0, y0(0) = 0 4 where ( sin(t) if 0 ≤ t ≤ π g(t) = . 0 if t > π Solution: Taking the Laplace transform of each side gives 5 s2Y (s) + sY (s) + Y (s) = L [g(t)] = G(s). 4 To find the Laplace transform of g(t), we write it in terms of step functions:

g(t) = sin(t) · r[0,π] = sin(t)[u0(t) − uπ(t)] = sin(t) − uπ(t) sin(t).

The second term has the form of ua(t)f(t) but in order to be able to find the Laplace transform, it must be in the form ua(t)f(t − a). We therefore need to use the fact that sin(t − π) = − sin(t) as can be verified using a trig identity or just considering the unit circle. Then 1 1 g(t) = sin(t) + u (t) sin(t − π) ⇒ G(s) = + e−πs . π s2 + 1 s2 + 1 Now solving for Y gives us 1 1 Y (s) = + e−πs . 2 2 5 2 2 5 (s + 1)(s + s + 4 ) (s + 1)(s + s + 4 )

100 Notice that this can be written in the form

Y (s) = F (s) + e−πsF (s) with 1 F (s) = 2 2 5 (s + 1)(s + s + 4 ) and therefore the solution from the inverse Laplace transform will have the form

y(t) = f(t) + uπ(t)f(t − π) and we therefore only need to find f(t). To do so, we do a PDF to get 1 As + B Cs + D F (s) = = + . 2 2 5 2 2 5 (s + 1)(s + s + 4 ) s + 1 s + s + 4 Multiplying through by the common denominator gives us 5 1 = (As + B)(s2 + s + ) + (Cs + D)(s2 + 1). 4 Equating the coefficients for each power of s gives

A + C = 0,A + B + D = 0, 5A + 4B + 4C = 0, 5B + 4D = 1.

Solving these equations gives 16 4 16 12 A = − ,B = ,C = ,D = . 17 17 17 17 Now we complete the square 5  12 s2 + s + = s + + 1 4 2 and write F (s) as s 1 s 1 F (s) = A · + B · + C · + D · . s2 + 1 s2 + 1 (s + 1/2)2 + 1 (s + 1/2)2 + 1 The third term with the C coefficient currently poses a problem since it is not in a particular form that can be inverted. However, notice that if we get a little tricky we can write this is s s + 1/2 1 1 C · = C · − C · , (s + 1/2)2 + 1 (s + 1/2)2 + 1 2 (s + 1/2)2 + 1 which we can now apply the frequency shifting property to. Therefore s 1 s + 1/2 1 F (s) = A · + B · + C · + (D − C/2) · s2 + 1 s2 + 1 (s + 1/2)2 + 1 (s + 1/2)2 + 1 which can be inverted. The first two terms we recognize as transforms of sines and cosines:  s  A · L −1 = A cos(t), s2 + 1

101  1  B · L −1 = B sin(t). s2 + 1 The second two terms are shifted sines and cosines:  s + 1/2  C · L −1 = Ce−t/2 cos(t), (s + 1/2)2 + 1  1  (D − C/2) · L −1 = (D − C/2)e−t/2 sin(t). (s + 1/2)2 + 1 Putting all of the together, we get f(t) = A cos(t) + B sin(t) + Ce−t/2 cos(t) + (D − C/2)e−t/2 sin(t). Plugging in the values for the coefficients gives 4 f(t) = −4 cos(t) + sin(t) + 4e−t/2 cos(t) + e−t/2 sin(t) 17 and the solution is y(t) = f(t) + uπ(t)f(t − π).

3.4 The Impulse Function and its Laplace Transform

We have previously seen that the second-order linear non-homogeneous equation ay00 + by0 + cy = g(t) can be used to model mechanical systems and LRC series circuits. In the mechanical context, the function g(t) corresponds to some external force acting on the system and in the circuit context, it corresponds to a voltage signal from an external power source. In either case, there are situations where a large external force is applied over a very short period of time. For example, consider the force acting on a baseball that is pitched to a batter. The only time there is a non-zero force acting on the ball is the very short time interval when the bat is in contact with the ball. If we were to plot the external force as a function of time, it would appear to always be zero except at the time when the bat strikes the ball, there would be a huge spike. We can model this spike using a special type of “function”, called the unit impulse function, as engineers call it, or the , as mathematicians call it. This is not really a function, hence the quotation marks in the previous sentence. It is an example of something called a generalized function, as any rigorous mathematician would insist. However, for our purposes, we can think of it as a function and will refer to it as one. The impulse function arises by taking the limit of a family of functions, which we now derive.

3.4.1 Definition of the Impulse Function We begin by defining the following piecewise function

( 1 2 if −  < x <  δ(x) = 0 otherwise

102 where  is some constant. When plotted, this function resembles a rectangle centered around x = 0 1 with a width of 2 and a height of 2 and therefore always has an area of 1. In terms of an integral, we have Z ∞ Z  1 1 δ(x)dx = dx = ( − (−)) = 1. −∞ − 2 2 For large values of , the rectangle is short and wide and for small values of , the rectangle is tall and thin. The unit impulse function δ(x) is then derived by taking the limit as  → 0:

δ(x) = lim δ(x). →0 In this limit, the rectangle collapses to an infinite spike at x = 0 and we can therefore think of it as the piecewise “function” ( ∞ if x = 0 δ(x) = . 0 otherwise When multiplying the impulse function by another function f(x) under an integral, it acts in a way that “plucks out” a single vale of f(x): Z ∞ δ(x)f(x)dx = f(0), −∞ or more generally, Z ∞ δ(x − a)f(x)dx = f(a). −∞

This can be proved by using δ(x) and taking the limit as  → 0. Let f(x) be a function with an anti-derivative F (x). Then Z ∞ Z  1 1 δ(x)f(x)dx = f(x)dx = [F () − F (−)] . −∞ − 2 2 Using the definition of the derivative, we see that 1 lim [F () − F (−)] = F 0(0) = f(0) →0 2 and therefore Z ∞ Z ∞ δ(x)f(x)dx = lim δ(x)f(x)dx = f(0). −∞ →0 −∞ Notice that the area under the spike is still equal to 1 in the limit. Letting f(x) = 1, we get Z ∞ Z ∞ δ(x)dx = δ(x)f(x)dx = f(0) = 1. −∞ −∞ The integral identity Z ∞ δ(x − a)f(x)dx = f(a) −∞ makes computing the Laplace transform of the impulse function very easy: Z ∞ L [δ(t − a)] = e−stδ(t − a)dt = e−as. 0

103 Furthermore, for any function f(t), we have

Z ∞ L [δ(t − a)f(t)] = e−stδ(t − a)f(t)dt = e−asf(a). 0 With these results in hand, we can now solve differential equations that have an impulsive forcing function g(t).

It should be noted that the impulse function is not actually realistic, it approximates a very large force acting over a very small time as an infinite force acting over zero time. Nevertheless, it is actually a good approximation for many cases, the stronger and shorter the force, the better the approximation. The impulse function can be thought of as the derivative of a unit step function: d δ(t − a) = u (t). dt a We can understand this intuitively because unit step functions are always constant so the deriva- tive should always be zero, except at the jump point, where it becomes infinite.

3.4.2 IVPs with Impulse Functions Example 3.4.1. Solve the initial value problem

y00 + 2y0 + 2y = δ(t − π), y(0) = 1, y0(0) = 0

Solution: Taking the Laplace transform of each side gives

s2Y (s) − s + 2(sY (s) − 1) + 2Y (s) = e−πs.

Solving for Y (s) gives s + 2 1 Y (s) = + e−πs · . s2 + 2s + 2 s2 + 2s + 2 We invert the first term by writing it as s + 2 s + 1 + 1 s + 1 1 = = + . s2 + 2s + 2 (s + 1)2 + 1 (s + 1)2 + 1 (s + 1)2 + 1

Therefore  s + 2  L −1 = e−t sin(t) + e−t cos(t) s2 + 2s + 2 using the inverse transforms for sine and cosine and the frequency shifting property. The second term in Y (s) has the form 1 e−πs · = e−πsF (s) s2 + 2s + 2 with 1 1 F (s) = = s2 + 2s + 2 (s + 1)2 + 1

104 which has an inverse Laplace transform f(t) = e−t sin(t) and therefore −πs −(t−π) L [e F (s)] = uπ(t)f(t − π) = uπ(t)e sin(t − π). Putting all of these results together gives us the solution

−t −t −(t−π) y(t) = e sin(t) + e cos(t) + uπ(t)e sin(t − π). Example 3.4.2. Solve the initial value problem 2y00 + y0 + 4y = δ(t − π/6) sin(t), y(0) = 0, y0(0) = 0. Solution: Taking the Laplace transform of each side gives 1 2s2Y (s) + sY (s) + 4Y (s) = e−πs/6 sin(π/6) = e−πs/6. 2 Solving for Y (s) gives 1 1 Y (s) = e−πs/6 2 2s2 + s + 4 which has the form Y (s) = e−πs/6F (s) with 1 1 F (s) = · 2 2s2 + s + 4 and therefore the solution will have the form

y(t) = uπ/6(t)f(t − π/6). To find f(t), we complete the square in the denominator to write F (s) as 1 1 1 1 1 1 F (s) = · = · = · . 2 2 1 2 31 2 2s + s + 4 4 s + 2 s + 2 4 (s + 1/4) + 16 Now notice that we can write F (s) in the form 1 b F (s) = · 4b (s − a)2 + b2 where √ 1 31 a = − , b = . 4 4 Using the Laplace transform of the sine function and the frequency shifting property, we get √ ! 1 1 31 f(t) = eat sin(bt) = √ e−t/4 sin t 4b 31 4 and the solution is thus √ ! 1 −(t−π/6)/4 31 y(t) = uπ/6(t)f(t − π/6) = √ uπ/6(t)e sin (t − π/6) . 31 4

105 Example 3.4.3. Solve the initial value problem 00 2 t 0 y + y = t δ(t − 3) + u5(t)e , y(0) = 1, y (0) = 0 Solution: First note that we can write the last term as t 5 t−5 u5(t)e = e u5(t)e . Taking the Laplace transform of each side then gives 1 s2Y (s) − s + Y (s) = 9e−3s + e5e−5s · . s − 1 Solving for Y (s) gives 1 1 Y (s) = 9e−3s · + e5e−5s · . s2 − s + 1 (s − 1)(s2 − s + 1) Now we need to do a PDF on the last term: 1 A Bs + C = + . (s − 1)(s2 − s + 1) s − 1 s2 − s + 1 multiplying by the common denominator gives us 1 = A(s2 − s + 1) + (Bs + C)(s − 1) = (A + B)s2 + (C − A − B)s + (A − C) which gives us the equations A + B = 0,C − A − B = 0,A − C = 1 and the solution is A = −1,B = −1,C = −2. We also need to complete the square: s2 − s + 1 = (s − 1/2)2 + 3/4. Therefore, we have 1  1 s + 2  Y (s) = 9e−3s · − e5e−5s + . (s − 1/2)2 + 3/4 s − 1 (s − 1/2)2 + 3/4 Now let us define 1 p3/4 F (s) = = p4/3 . (s − 1/2)2 + 3/4 (s − 1/2)2 + 3/4 Then Y (s) can be written as Y (s) = 9e−3sF (s) − e5e−5sG(s) where 1 G(s) = + sF (s) + 2F (s). s − 1 The inverse of F (s) is 2 √ f(t) = √ et/2 sin( 3t/2). 3 The inverse of G(s) is therefore g(t) = et + f 0(t) + 2f(t). We can now state the inverse of Y (s) as 5 y(t) = 9u3(t)f(t − 3) − e u5(t)g(t − 5).

106 3.5 The Convolution Formula

There is a very useful formula for computing the inverse Laplace transform of a product of two functions. This formula can be quite convenient and will allow us to sometimes skip having to do a partial fraction decomposition. First we define the convolution product which is a certain way of “multiplying” two functions functions f(t) and g(t) and is defined as

Z t h(t) = (f ∗ g)(t) = f(u)g(t − u)du. 0 This type of integral appears in many mathematical applications. Conceptually speaking, the convolution product is a measurement of how much the functions f(t) and g(t) “overlap” each other. It turns out that the Laplace transform of (f ∗ g)(t) is

L [(f ∗ g)(t)] = F (s)G(s).

In other words, regular multiplication in the frequency domain corresponds to the convolution product in the time domain. Let us see how this formula can be used to avoid doing a PFD.

Example 3.5.1. Use the convolution product to compute the inverse Laplace transform of 1 Y (s) = . s(s2 + 1)

Solution: We can write Y (s) as Y (s) = F (s)G(s) with 1 1 F (s) = ,G(s) = . s2 + 1 s The the corresponding functions in the time domain are

f(t) = sin(t), g(t) = 1.

Using the convolution formula, we get

Z t y(t) = L −1[F (s)G(s)] = (f ∗ g)(t) = sin(u) · 1du = −[cos(t) − cos(0)] = 1 − cos(t). 0 Example 3.5.2. Use the convolution product to compute the inverse Laplace transform of 1 Y (s) = . (s − 3)(s − 4)

Solution: We can write Y (s) as Y (s) = F (s)G(s) with 1 1 F (s) = ,G(s) = . s − 3 s − 4

107 The the corresponding functions in the time domain are f(t) = e3t, g(t) = e4t. Using the convolution formula, we get Z t y(t) = L −1[F (s)G(s)] = (f ∗ g)(t) = e3ue4(t−u)du 0 Now we do the above integral: Z t Z t Z t e3ue4(t−u) = e3ue4te−4udu = e4t e−u = −e4t(e−t − 1) = e4t − e3t 0 0 0 so y(t) = e4t − e3t. We have already been using the formula −1 −as L [e Y (s)] = ua(t)y(t − a) but now we can prove it using the convolution formula by letting F (s) = e−as and G(s) = Y (s). Then f(t) = δ(t − a) and g(t) = y(t) and the convolution formula gives us Z t L −1[e−asY (s)] = (f ∗ g)(t) = δ(u − a)y(t − u)du. 0 Now we consider the two intervals t < a and t ≥ a. If t < a, then δ(u − a) = 0 for every u between 0 and t. If t ≥ a, then the above integral is Z t δ(u − a)y(t − u)du = y(t − a). 0 Therefore ( −1 −as 0 if t < a L [e Y (s)] = = ua(t)y(t − a) y(t − a) if t ≥ a The derivation of the Laplace transform of a convolution product requires multi-variable calculus but I will explain it in the notes for those that want to understand it. By definition, we know that Z ∞ Z t  L [(f ∗ g)(t)] = e−st f(u)g(t − u)du dt 0 0 which we can write as a double integral as Z ∞ Z t L [(f ∗ g)(t)] = e−stf(u)g(t − u) du dt. 0 0 By switching the order in which the variables are integrated, this integral is equal to Z ∞ Z ∞ e−stf(u)g(t − u) dt du. 0 u Now we make the substitution v = t − u to get Z ∞ Z ∞  Z ∞ Z ∞  f(u) e−s(v+u)g(v) dv du = e−suf(u) e−svg(v) dv du. 0 0 0 0 The innermost integral is just G(s). This then simplifies to Z ∞ Z ∞ e−suf(u)G(s)du = G(s) e−suf(u)du = F (s)G(s). 0 0

108