uhoensch differential equations and applications using mathematica

331
Dierential Equations and Applications Using  Mathematica  R Ulrich A Hoensch Rocky Mountain College 1511 Poly Drive Billings, MT 59102, USA [email protected] December 18, 2012

Upload: hector-oliver

Post on 10-Oct-2015

161 views

Category:

Documents


0 download

DESCRIPTION

Differential equations

TRANSCRIPT

  • Differential Equations and Applications Using Mathematica R

    Ulrich A HoenschRocky Mountain College

    1511 Poly DriveBillings, MT 59102, [email protected]

    December 18, 2012

  • 2

  • Contents

    0 Introduction 7

    0.1 Introduction to This Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    0.2 Introduction to Mathematica . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    1 First-Order Differential Equations 13

    1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    1.2 Separable Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    1.3 Homogeneous Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    1.4 Linear Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    1.5 Exact Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    1.6 Equilibrium Solutions and Phase Portraits . . . . . . . . . . . . . . . . . . . . . . . . 27

    1.7 Slope Fields and Eulers Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    1.8 Existence and Uniqueness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    1.9 Bifurcations of Autonomous First-Order Differential Equations . . . . . . . . . . . . 37

    1.10 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    1.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    2 Applications of First-Order Differential Equations 51

    2.1 Population Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    2.2 Electric Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    2.3 Chemical Reaction Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    2.4 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    3 Higher-Order Linear Differential Equations 65

    3.1 Introduction to Homogeneous Second-Order Linear Equations . . . . . . . . . . . . . 65

    3.2 Homogeneous Second-Order Linear Equations with Constant Coefficients . . . . . . 66

    3.3 Case I: Two Real Distinct Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    3.4 Case II: One Repeated Real Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    3.5 Case III: Complex Conjugate Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    3.6 Method of Undetermined Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    3.7 Higher-Order Linear Equations with Constant Coefficients . . . . . . . . . . . . . . . 83

    3.8 The Structure of the Solution Space for Linear Equations . . . . . . . . . . . . . . . 85

    3.9 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    3.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    3

  • 4 CONTENTS

    4 Applications of Second-Order Linear Equations 954.1 Mechanical Vibrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954.2 Linear Electric Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1074.3 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1104.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

    5 First-Order Linear Autonomous Systems 1155.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155.2 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1165.3 Case I: Two Real Distinct Non-Zero Eigenvalues . . . . . . . . . . . . . . . . . . . . 1175.4 Case II: One Real Repeated Non-Zero Eigenvalue . . . . . . . . . . . . . . . . . . . . 1245.5 Case III: Complex Conjugate Eigenvalues . . . . . . . . . . . . . . . . . . . . . . . . 1275.6 Case IV: Zero Eigenvalues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1315.7 The Trace-Determinant Plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1315.8 Bifurcations of Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1345.9 Solutions to Matrix Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1355.10 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1415.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    6 Two-Dimensional Non-Linear Systems 1476.1 Equilibrium Points and Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1476.2 Linearization and Hartmans Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 1496.3 Polar Coordinates and Nullclines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1566.4 Limit Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1596.5 Existence and Nonexistence of Limit Cycles . . . . . . . . . . . . . . . . . . . . . . . 1636.6 Hamiltonian Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1676.7 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1716.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    7 Applications of Systems of Differential Equations 1797.1 Competing Species Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1797.2 Predator-Prey Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1837.3 The Forced Damped Pendulum and Chaos . . . . . . . . . . . . . . . . . . . . . . . . 1897.4 The Lorenz System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1997.5 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2017.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2047.7 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    8 Laplace Transforms 2118.1 Introduction to Laplace Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2118.2 The Laplace Transform of Selected Functions . . . . . . . . . . . . . . . . . . . . . . 2138.3 Solving Initial Value Problems Using Laplace Transforms . . . . . . . . . . . . . . . 2188.4 Discontinuous and Periodic Forcing Functions . . . . . . . . . . . . . . . . . . . . . . 2208.5 Dirac Functions and Impulse Forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . 2298.6 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2348.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

  • CONTENTS 5

    9 Further Methods of Solving Differential Equations 2399.1 Power Series Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2399.2 Numerical Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2459.3 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2599.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

    10 Introduction to Partial Differential Equations 26510.1 DAlemberts Formula for the One-Dimensional Wave Equation . . . . . . . . . . . . 26510.2 The One-Dimensional Wave Equation and Fourier Series . . . . . . . . . . . . . . . . 26910.3 The One-Dimensional Heat Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . 27810.4 The Schrodinger Wave Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28110.5 Mathematica Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28810.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

    A Answers to Exercises 293

    B Linear Algebra Prerequisites 319B.1 Vectors, Matrices, and Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 319B.2 Linear Independence and Determinants . . . . . . . . . . . . . . . . . . . . . . . . . 320B.3 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322B.4 Projections onto Subspaces and Linear Regression . . . . . . . . . . . . . . . . . . . 323

    C Results from Calculus 325C.1 The Second Derivative Test for Functions of Two Variables . . . . . . . . . . . . . . 325C.2 Taylor Series for Selected Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

  • 6 CONTENTS

  • Chapter 0

    Introduction

    0.1 Introduction to This Text

    Differential equations are of central importance in modeling problems in engineering, the naturalsciences and the social sciences. The virtue of differential equations models rests in their ability tocapture the time-evolution of processes that exhibit elements of (instantaneous) feedback. We usethe following simple example to illustrate this point. Consider an account that pays 6% interestevery year. If A(t) is the amount of money after the t-th year, we have the recurrence equation

    A(t+ 1) = 1.06A(t). (1)

    The feedback is represented by the fact that the amount in the t-th year determines the amount inthe (t+ 1)-st year. We can rewrite (1) as a difference equation in the form

    A(t+ 1)A(t) = 0.06A(t). (2)

    In this interpretation, the change in A from time t to time t + 1 is determined by the value of Aat time t. We may consider other time increments than one year. For example, if the interest iscompounded in intervals of length t, then the difference equation (2) becomes

    A(t+ t)A(t) = 0.06tA(t), (3)

    where 0.06t represents an annual interest rate of 6% applied over a period of length t years (e.g.t = 1/12 for monthly compounding). Dividing (3) by t gives

    A(t+ t)A(t)t

    = 0.06A(t),

    and letting t 0 yields the differential equationdA

    dt= 0.06A(t). (4)

    The parameter r = 0.06 can now be interpreted as the instantaneous (or continuous) rate ofcompounding. The beauty of the differential equation model is that it is rather flexible whenincorporating additional assumptions. For example, if in addition to the compounding of interest,

    7

  • 8 CHAPTER 0. INTRODUCTION

    $100 per year are continuously withdrawn from the account, the new differential equation is obtainedfrom (4) by subtracting this additional rate of change from the right-hand side:

    dA

    dt= 0.06A(t) 100. (5)

    This text introduces the reader to most standard approaches to analyzing and solving differentialequations. In our example, solving the differential equation means we seek functions A(t) thatsatisfy the given differential equations (4) or (5). For equation (4), it can be checked that A(t) =A0e

    0.06t is a solution; A0 is a parameter and can be interpreted as the amount of money in theaccount at time t0 = 0.

    Chapter 1 presents standard methods of solving first-order differential equations and introducesthe concept of equilibrium solutions, numerical methods of solving differential equations, existenceand uniqueness results, and bifurcations of first-order equations. Chapter 2 covers applications offirst-order differential equations.

    Chapter 3 deals with second-order and higher-order linear differential equations; solution meth-ods using the characteristic equation are presented. Chapter 4 presents applications to second-orderlinear equations, in particular mechanical vibrations and electric circuits.

    Chapters 5 and 6 cover systems of linear and non-linear systems of equations. We mostlylimit ourselves to two-dimensional systems, although higher-dimensional examples are also given.Chapter 7 presents applications of these topics.

    Chapter 8 presents Laplace transforms and how they can be used to solve linear systems. Chap-ter 9 presents additional methods of solving differential equations, namely power series methodsand numerical methods.

    Chapter 10 offers a brief introduction to partial differential equations. Some methods of solvingpartial differential equations are presented by analyzing the wave equation and the heat equation.The chapter also discusses Schrodingers wave equation.

    Overall, this book emphasizes qualitative (geometric) methods over symbolic or numerical waysof solving differential equations. To this end, equilibrium solutions, their types, and their bifurca-tions are discussed. Although it is anticipated that readers will initially focus on worked examples,a definition-theorem-proof approach is threaded throughout the text. Exercises are given at theend of each chapter, and answers to selected exercises can be found in Appendix A. (These exer-cises are marked with the symbol .) We make use of the computer algebra system Mathematicathroughout the text, including some of the exercises. Prerequisites to this text are vector calculusand elementary linear algebra. The linear algebra material required in this text is mainly knowledgeabout determinants, eigenvalues and eigenvectors. Appendix B provides a very condensed overviewof the necessary linear algebra concepts.

    0.2 Introduction to Mathematica

    Mathematica is a computer algebra system (CAS) developed by Wolfram Research (www.wolfram.com). Other similar CAS are for example Maple (www.maplesoft.com) and Matlab (www.mathworks.com). In addition, many modern hand-held calculators, such as the Texas Instruments TI-89 or TI-Nspire, have a CAS kernel. In this section, we present a deliberately brief introduction to workingwith Mathematica. In later sections, we will get to know Mathematica methods that are relevantto the analysis of differential equations. Generally, Mathematica is extremely powerful software for

  • 0.2. INTRODUCTION TO MATHEMATICA 9

    mathematical analysis, symbolic manipulation and computation. To appreciate the full scope ofthis software, readers are directed to the many tutorials available, for example [27]. Mathematicanotebooks used in conjunction with this text are available at:

    http://cobalt.rocky.edu/~hoenschu/DiffEqBook/Mathematica.

    Comments, Evaluation, and Arithmetic

    Comments are delimited by ( and ). Commands are entered in lines which are evaluated bypressing Shift+Enter. Arithmetic is performed using the usual symbolic operators. Note thatMathematica will perform exact arithmetic with integers and rational numbers, and floating pointarithmetic with floating point numbers.

    H* Exact Arithmetic *L7 * 5^14 2^1042724609375

    1024

    H* Floating Point Arithmetic -- at least one number is a floating-point number *L7.0 * 5^14 2^10

    4.17233 107

    H* Convert the output in line 1 to a floating-point number *LN@Out@1DD

    4.17233 107

    H* Use Postfix version of the N@D command *LOut@1D N

    4.17233 107

    Calculus and Functions

    H* Take the derivative of the function of x *LD@3 x^2 - 5 x + 1, xD

    -5 + 6 x

    H* Define the function f@xD, and take the derivative *Lf@x_D := 3 x^2 - 5 x + 1;D@f@xD, xD

    -5 + 6 x

    H* Take the second partial derivative withrespect to x and the first partial with respect to y *L

    D@x^3 y + x^2 y^2, 8x, 2

  • 10 CHAPTER 0. INTRODUCTION

    H* Integrate the function f@xD *LIntegrate@f@xD, xD

    x -5 x2

    2+ x3

    H* Compute the definite integral *LIntegrate@f@xD, 8x, 0, 3

  • 0.2. INTRODUCTION TO MATHEMATICA 11

    H* Plot a parametrized curve *LParametricPlot@8t * Cos@tD, t * Sin@tD

  • 12 CHAPTER 0. INTRODUCTION

    H* Solve an equation numerically*Lsolution = NSolve@x^4 - x^3 2, xD

    88x -1.

  • Chapter 1

    First-Order Differential Equations

    1.1 Introduction

    A first-order differential equation is an equation of the form

    F(x, y, y

    )= 0, (1.1)

    where at least y occurs explicitly on the left-hand side of (1.1). A solution to (1.1) is a functiony = f(x) so that F (x, f(x), f (x)) = 0 for all x in some open interval I. In particular, we requirethe solution function to be differentiable, and hence continuous on I.

    We will usually deal with differential equations where (1.1) is solvable for y; these can bewritten in the form

    y = G (x, y) . (1.2)

    An initial value problem for a first-order differential equation is a consists of the differentialequation together with the specification of a value of the solution. That is, initial value problemsare of the general form

    F(x, y, y

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

    The function y = f(x) is a solution to this initial value problem if it is a solution to F (x, y, y) = 0,x0 is in the domain of f(x), and f(x0) = y0.

    Example 1.1.1. The differential equation (y)2y = 0 has the solution y = (1/4)(x2 +2x+1), sincey = (1/2)(x+ 1) and

    (y)2 y =(

    1

    2(x+ 1)

    )2(

    1

    4(x2 + 2x+ 1)

    )=

    1

    4

    (x2 + 2x+ 1

    ) 14

    (x2 + 2x+ 1

    )= 0.

    This solution is defined for all real numbers: I = R. More generally, we can check that y =(1/4)(x2 + 2xC + C2) is a solution for any C R. For the initial value problem

    (y)2 y = 0, y(0) = 1, (1.4)we can find the corresponding value of C by solving y(0) = 1 for C:

    (1/4)(02 + 2(0)C + C2) = 1 gives C = 2.Thus, y = (1/4)(x2 + 4x+ 4) and y = (1/4)(x2 4x+ 4) are solutions to (1.4).

    13

  • 14 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Example 1.1.2. Consider the following situation: A stone is dragged using a rope of length 1. Ifthe stone is initially at the point (1, 0), and the person dragging the stone moves along the positivey-axis, what is the path of the stone?

    The curve described here is also called a tractrix (from Latin trahere: to pull; to drag). Wecan describe this curve via a differential equation as follows. Let f(x) we the (unknown) functionso that the curve (x, f(x)) describes the tractrix. The tangent line to the graph of y = f(x) at thepoint (x, f(x)) is given by the equation

    y(t) = f(x) + f (x)(t x).

    The tangent line intersects the y-axis when t = 0, that is at the point (0, f(x)+f (x)(x)) (see alsoFigure 1.1) We know that the distance from the point (x, f(x)) to the point (0, f(x) + f (x)(x))

    Figure 1.1: The curve in example 1.1.2.

    length=1

    0.5 1.0 1.5 2.0

    0.5

    1.0

    1.5

    2.0

    is always 1:

    1 =

    (x 0)2 + (f(x) (f(x) + f (x)(x)))2 =

    x2 + x2(f (x))2.

    This means x2(1 + (f (x))2) = 1, or

    f (x) =

    1 x2x2

    .

    The negative sign was chosen since f(x) is clearly a decreasing function of x. Since f(1) = 0, theunknown function is described by the initial value problem

    f (x) =

    1 x2x2

    , f(1) = 0.

  • 1.2. SEPARABLE DIFFERENTIAL EQUATIONS 15

    In this case, the right-hand side of the differential equation does not depend on y, which meansthat to solve the initial value problem, we need to find the integral

    f(x) = x

    1

    1 t2t2

    dt =

    1x

    1 t2t2

    dt

    for 0 < x 1. Using e.g. the trigonometric substitution t = sin gives

    f(x) = log(

    1 +

    1 x2) log x

    1 x2.

    (We use log to denote the natural logarithm .)

    In sections 1.2, 1.3, 1.4, 1.5, we present various methods of solving first-order differential equa-tions. It should be pointed out, however, that for a randomly selected differential equation, wecannot expect to obtain a solution in a closed algebraic form (i.e. in terms of the usual elementaryfunctions). In other words, none of the methods in those sections will then help us to find thesolution. This can be seen from the fact that solving a differential equation is at least as hard asfinding the antiderivative of a function (consider simple differential equations of the form y = f(x);see also example 1.1.2).

    Section 1.6 provides us with methods to analyze the geometric behavior of solutions to au-tonomous first-order differential equations (i.e. differential equations of the form y = f(y)). Thissection is probably the most important section in this chapter. Section 1.7 introduces a simplenumerical method for solving first-order differential equations, namely Eulers method. Section 1.8discusses issues surrounding the existence and uniqueness of solutions, and section 1.9 explores howthe geometric behavior of one-parameter families of autonomous differential equations depends onthe parameter.

    1.2 Separable Differential Equations

    A first-order differential equation is separable if it can be written in the form

    y = g(x)h(y). (1.5)

    Separable differential equations can be solved in the following manner. If we interpret the derivativey = dy/dx as a quotient and separate variables, then

    dy

    dx= g(x)h(y)

    becomesdy

    h(y)= g(x) dx. (1.6)

    Formally integrating both sides gives dy

    h(y)=

    g(x) dx.

    If H(y) is an antiderivative of 1/h(y) and G(x) is an antiderivative of g(x), we obtain

    H(y) = G(x) + C.

  • 16 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    If H(y) is invertible, then

    y = H1 (G(x) + C) .

    Note that working with equation (1.6) as we just did could be rather spurious: after all, a derivativeis not a quotient of the differentials dy and dx. While it is sometimes convenient to use theformalism provided by differentials1, we try to avoid their use and provide more rigorous proofs ofcorresponding results. Our first theorem (and its proof) tells us that the method just developeddoes indeed work.

    Theorem 1.2.1. Suppose dy/dx = g(x)h(y) is a separable differential equation; suppose H (y) =1/h(y) and H(y) is invertible; and suppose G(x) = g(x). Then for any real number C the functionf(x) = H1 (G(x) + C) is a solution to dy/dx = g(x)h(y).

    Proof. We need to verify that if f(x) = H1 (G(x) + C), then f (x) = g(x)h(f(x)). Observe thatH(f(x)) = G(x) +C. When differentiating both sides of this equation and applying the chain rule,we obtain

    H (f(x)) f (x) = G(x).This is equivalent to 1/h(f(x)) f (x) = g(x) or f (x) = g(x)h(f(x)), as required.

    Example 1.2.1. Find a solution to each of the following initial value problems.

    (a) (1 + x2)(dy/dx) 1 = 0, y(0) = 0. Solving the differential equation for dy/dx gives dy/dx =1/(1 + x2). In this case, we simply integrate both sides to obtain y = tan1(x) + C. Sincey(0) = 0, 0 = tan1(0) + C, or C = 0. The solution to the initial value problem is y =tan1(x), x R.

    (b) dy/dx = y 1, y(0) = 0. Separating variables gives dy/(y 1) = dx, and integrating bothsides

    dy

    y 1 =dx,

    which results in log |y1| = x+C (recall that log denotes the natural logarithm). This meansthat y = ex+C + 1. Observing that ex+C = ex eC , we may re-label the constant eCas C. We obtain the solution y = Cex + 1, where C R. (Note that technically C 6= 0, sinceeC 6= 0; however, if C = 0, the function y = 1 is also a solution to the differential equationdy/dx = y 1.) If y(0) = 0, 0 = C + 1, or C = 1. Thus, the solution to the initial valueproblem is y = 1 ex, x R.

    (c) y = sinx y, y(0) = 1. Separating variables gives dy/y = sinx dx, ordy

    y=

    sinx dx.

    This means log |y| = cosx + C, or y = Ce cosx (absorbing the constant eC into C as inpart (b) above). y(0) = 1 gives 1 = Ce1, or C = e. The solution to the initial value problemis y = e1cosx, x R.

    1The philosopher George Berkeley (1685-1753) called them ghosts of departed quantities.

  • 1.2. SEPARABLE DIFFERENTIAL EQUATIONS 17

    (d) y = x/y, y(0) = r, r 0. Separating variables gives y dy = x dx, ory dy =

    x dx.

    This means y2/2 = x2/2 + C, or x2 + y2 = C (absorbing the constant 2C into C). Theinitial condition y(0) = r gives C = r2. The solution curves are the circles x2 + y2 = r2.

    (e)dy

    dt= y(1 y), y(0) = y0. (1.7)

    Separating variables yields dy/(y(1 y)) =

    dt. (1.8)

    The integral of the left side can be found by using partial fractions, as follows:

    dy

    y(1 y) =

    1

    y 1y 1 dy = log

    yy 1+ C.

    The right side of (1.8) is t+C. Combining these, we obtain the equation log |y/(y 1)| = t+C.Exponentiating both sides and absorbing the constant gives y/(y 1) = Cet, which meansy = Cet(y1) or yCety = Cet. Solving for y gives y = Cet/(1Cet) = Cet/(Cet1) =1/(1Cet) (absorbing 1/C into C). If y(0) = y0, y0 = 1/(1C), or C = (y0 1)/y0. Thistells us that the solution to the initial value problem (1.7) is

    y =y0

    y0 (y0 1)et . (1.9)

    Remark 1.2.1. Note that in part (d) of example 1.2.1, the solution has not been expressed as afunction of x; rather, the implicit solution x2 + y2 = r2 gives us solution curves that are moregeneral than when we express y as a function of x.

    Remark 1.2.2. Figure 1.2 shows solution curves to (1.7) for various initial conditions. We make thefollowing observations about these solutions.

    (a) If y0 = 0, then y = 0 for all t; if y0 = 1, then y = 1 for all t. That is, we can think of thesolutions with initial conditions y0 = 0 or y0 = 1 as stationary solutions.

    (b) If y0 > 0, then y 1 as t; if y0 < 1, then y 0 as t . In words: Solutions withan initial condition of y0 > 0 approach the line y = 1 going forward; solutions that start withy0 < 1 approach the line y = 0 going backward.

    (c) Some solutions (namely those where y0 > 1 or y0 < 0) have vertical asymptotes. If weinterpret the variable t as time (as we frequently will), we can say that these solutions approachinfinity in finite time.

    We will see in section 1.6 how to obtain results like the ones in (a) and (b) without having to solvethe differential equation.

  • 18 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Figure 1.2: Several solution curves to the equation dy/dt = y(1 y).

    -4 -2 2 4

    -2

    -1

    1

    2

    3

    1.3 Homogeneous Differential Equations

    A homogeneous differential equation is of the form

    dy

    dx= F

    (yx

    ). (1.10)

    This means, the rate with which the function y changes depends only on the ratio y/x. Homoge-neous differential equations can be solved by using the substitution v = y/x, where v is a functionof x. Then xv = y, and taking derivatives with respect to x, v + x(dv/dx) = dy/dx. Substitutionof dy/dx = v + x(dv/dx) and v = y/x into (1.10) gives

    v + xdv

    dx= F (v) ,

    ordv

    dx=F (v) v

    x, (1.11)

    which is separable and can thus be solved using the method in section 1.2.

    Example 1.3.1. Find a solution to the initial value problem dy/dx = 1 + (y/x), y(1) = 0. If wemake the substitution v = y/x, F (v) = 1 + v, and converting the differential equation to the form(1.11), we obtain

    dv

    dx=

    (1 + v) vx

    =1

    x.

    Integrating both sides gives v = log |x| + C. Re-substitution of v = y/x gives y = x log |x| + Cx.The initial condition y(1) = 0 implies that C = 0. Clearly, y = x log |x| is not defined when x = 0;this leaves us with two choices for the domain of definition of the solution: {x R : x > 0} or{x R : x < 0}. Since x0 = 1 is in the first set, the solution to the initial value problem isy = x log x, x > 0.

  • 1.4. LINEAR DIFFERENTIAL EQUATIONS 19

    Example 1.3.2. Solve the differential equation dy/dx = (x2 + y2)/(xy). Note that (x2 + y2)/(xy) =(x/y) + (y/x), so the equation is homogeneous and the substitution v = y/x leads to F (v) =(1/v) + v. Using (1.11) gives

    dv

    dx=

    (1/v) + v vx

    =1

    vx.

    Separating variables leads to v2/2 = log |x|+C. Re-substitution of v = y/x gives y2 = 2x2 log |x|+Cx2 (we absorbed the constant 2C into the new constant C). Given an initial condition withy(x0) > 0, the explicit solution would be of the form y =

    2x2 log |x|+ Cx2. If y(x0) < 0, we

    would have y = 2x2 log |x|+ Cx2.Substitution methods are not limited to homogeneous differential equations. Exercises 1.3 and

    1.4 present other situations in with a substitution makes a differential equation integrable.

    1.4 Linear Differential Equations

    First-order linear differential equations are of the form

    dy

    dx+ p(x)y = q(x). (1.12)

    The origin of this name can be seen as follows. If the right-hand side of this equation is representedby the differential operator

    L[y] = y + p(x)y,

    then this operator is linear in y:

    L[ry1 + sy2] = rL[y1] + sL[y2],

    where y1, y2 are functions of x, and r, s R.First-order linear differential equations may be solved by using an integrating factor . The idea

    is to multiply both sides of (1.12) by a function r(x) so that the left side of the resulting equationis the derivative of r(x)y. Suppose we multiply both sides of (1.12) by r(x). The equation becomes

    r(x)dy

    dx+ r(x)p(x)y = r(x)q(x). (1.13)

    If the left side is to be obtained by differentiating r(x)y, it will be of the form r(x)(dy/dx)+(dr/dx)y.Comparing this to the left side of (1.13) yields the differential equation

    dr

    dx= r(x)p(x),

    which is separable. Its solution is obtained by separation of variables as follows. Sincedr

    r=

    p(x) dx,

    it follows that log |r| = p(x) dx. This means an integrating factor is r(x) = eP (x), where P (x) isan antiderivative of p(x). Thus, the equation (1.13) becomes

    d

    dx

    (eP (x)y

    )= eP (x)q(x).

  • 20 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Integrating both sides gives

    eP (x)y =

    eP (x)q(x) dx,

    or

    y = eP (x)(

    eP (x)q(x) dx

    ). (1.14)

    The following theorem summarizes how to solve linear differential equations.

    Theorem 1.4.1. Suppose dy/dx + p(x)y = q(x) is a linear differential equation and supposeP (x) = p(x). Define r(x) = eP (x). Suppose further that G(x) = r(x)q(x). Then for any realnumber C the function

    f(x) =G(x) + C

    r(x)

    is a solution to dy/dx+ p(x)y = q(x).

    Proof. Suppose f(x) = (G(x) + C)/r(x). Then r(x)f(x) = G(x) + C. When differentiatingboth sides of this equation and applying the product rule and the fact that G(x) = r(x)q(x), itfollows that r(x)f (x) + r(x)f(x) = r(x)q(x). Now, r(x) = eP (x)P (x) = r(x)p(x), so we obtainr(x)f (x) + r(x)p(x)f(x) = r(x)q(x). Since r(x) > 0, we may divide both sides by r(x) to obtainf (x) + p(x)f(x) = q(x).

    Example 1.4.1. Find a solution to each of the following initial value problems.

    (a) dy/dx = x y, y(0) = 0. The differential equation is equivalent to dy/dx + y = x, so wehave p(x) = 1 and q(x) = x. We can choose P (x) = x, and consequently r(x) = ex. Sinceq(x) = x,

    r(x)q(x) dx =

    xex dx = xex

    ex dx = xex ex + C,

    using integration by parts. So we can choose G(x) = xex ex. According to theorem 1.4.1,or using equation (1.14),

    y =xex ex + C

    ex= x 1 + Cex

    is a solution to the differential equation. The initial condition y(0) = 0 gives 0 = 1 + C 1,or C = 1, and y = x 1 + ex, x R is a solution to the initial value problem.

    (b) x(dy/dx) y = 2x3, y(1) = 0. Rewriting the differential equation as (dy/dx) (y/x) = 2x2allows us to identify p(x) = 1/x and q(x) = 2x2. Since x0 = 1 > 0, we need only considerpositive values for x, and so we can choose P (x) = log x and r(x) = e log x = elog(1/x) = 1/x.Since q(x) = 2x2,

    r(x)q(x) dx =

    2x dx = x2 + C and we may choose G(x) = x2. Using

    theorem 1.4.1,

    y =x2 + C

    1/x= x3 + Cx

    is a solution to the differential equation. The initial condition y(1) = 0 gives 0 = 1 + C, soC = 1. We observe that y = x3 x is a solution to the initial value problem for all x R(not just for x > 0), since x(dy/dx) y = x(3x2 1) (x3 x) = 2x3 for any real number x.

  • 1.4. LINEAR DIFFERENTIAL EQUATIONS 21

    Structure of the Solution Space

    Definition 1.4.1. A first-order linear differential equation of the form

    dy

    dx+ p(x)y = q(x)

    is called homogeneous if q(x) = 0 for all x. Otherwise, the equation is non-homogeneous.

    The meaning of the term homogeneous in the current context is different from how thisword was used in section 1.3. Here, it means that the right-hand side of a linear equation is zero.This is exactly the same meaning as for a system of algebraic linear equations. Indeed, resultsanalogous to the ones encountered in a linear algebra course apply. The following theorem assertsthat the solutions to a homogeneous linear equation form a vector space, and the solutions to anon-homogeneous linear equation form an affine space.

    Theorem 1.4.2. (a) If y1 and y2 are solutions to the homogeneous equation dy/dx+ p(x)y = 0,then so is any linear combination yh = ry1 + sy2, r, s R.

    (b) If yp is a solution to the non-homogeneous equation dy/dx+ p(x)y = q(x) and yh is solutionto the corresponding homogeneous equation dy/dx+ p(x)y = 0, then yp + yh is also a solutionto dy/dx+ p(x)y = q(x).

    Proof. Suppose y1, y2 both satisfy dy/dx+ p(x)y = 0, and yh = ry1 + sy2. Then,

    dyhdx

    + p(x)yh = rdy1dx

    + sdy2dx

    + r(p(x)y1) + s(p(x)y2)

    = r

    (dy1dx

    + p(x)y1

    )+ s

    (dy2dx

    + p(x)y2

    )= r(0) + s(0) = 0.

    This proves part (a). To see part (b), observe that since dyh/dx+p(x)yh = 0 and dyp/dx+p(x)yp =q(x),

    d(yp + yh)

    dx+ p(x)(yp + yh) =

    dypdx

    + p(x)yp +dyhdx

    + p(x)yh = q(x) + 0 = q(x).

    An application of theorem 1.4.2 is given in the following.

    Linear Differential Equations with Constant Coefficients

    A first-order linear differential equation of the form (1.12) has constant coefficients if the coefficientfunction p(x) is constant. Consequently, these equations are of the form

    dy

    dx+ ay = q(x). (1.15)

    Since p(x) = a, and so P (x) = ax, it can be seen from theorem 1.4.1 that the solution of (1.15) canbe expressed as

    y = eax(

    eaxq(x) dx

    ). (1.16)

  • 22 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    In the homogeneous case, we obtain yh = Ceax, C R. Non-homogeneous linear differential equa-

    tions with constant coefficients may now be solved using the method of undetermined coefficients,as explained in the following example.

    Example 1.4.2. Find the solution to each initial value problem.

    (a) (dy/dx) + 2y = 3x2 2x + 5, y(0) = 3. Here a = 2, and q(x) = 3x2 2x + 5. When using(1.16), we would need to evaluate the integral

    e2x(3x2 2x + 5) dx. An alternative is to

    observe that if (dy/dx) + 2y is to equal the second order polynomial 3x2 2x + 5, then yshould be a polynomial of degree at most 2. Thus, it makes sense to use a trial solution ofthe form yp = A2x

    2 +A1x+A0, where A0, A1, A2 are coefficients that we need to determine.Then,

    dypdx

    + 2yp = (2A2x+A1) + 2(A2x2 +A1x+A0)

    = 2A2x2 + (2A2 + 2A1)x+ (A1 + 2A0).

    Comparing this to the right-hand side of the differential equation leads to the equations2A2 = 3, 2A2 + 2A1 = 2, and A1 + 2A0 = 5. Successively solving this linear system givesA2 = 3/2, A1 = 5/2, A0 = 15/4. Thus, yp = (3/2)x2 (5/2)x + (15/4) is a solutionto the differential equation. However, it does not satisfy the initial condition. We now usetheorem 1.4.2: solutions to the homogeneous equation (dy/dx) + 2y = 0 are yh = Ce

    2x, soyp+yh = (3/2)x

    2(5/2)x+(15/4)+Ce2x is a solution to the non-homogeneous equation forany C R. Since y(0) = 3, we obtain (3/2)02 (5/2)0 + (15/4) + Ce2(0) = (15/4) + C = 3or C = 3/4. Thus, y = (3/2)x2 (5/2)x + (15/4) (3/4)e2x is a solution to the initialvalue problem.

    (b) (dy/dx) y = 2 sin(3x), y(0) = 1. Here, we choose the trial solution yp = A cos(3x) +B sin(3x), since derivatives linear combinations of cos(3x) and sin(3x) are again expressed bysuch a linear combination. Then the differential equation gives

    dypdx yp = (3A sin(3x) + 3B cos(3x)) (A cos(3x) +B sin(3x))

    = (3B A) cos(3x) (3A+B) sin(3x).

    Writing the right-hand side of the differential equation in the form (0) cos(3x) + (2) sin(3x)and comparing coefficients leads to the system 3B A = 0, 3A+B = 2. Solving this givesA = 3/5. B = 1/5, so yp = (3/5) cos(3x) (1/5) sin(3x) is a solution to the differentialequation. The solution to the homogeneous equation (dy/dx) y = 0 is yh = Cex, so weconsider solutions of the form yp + yh = (3/5) cos(3x) (1/5) sin(3x) +Cex. Using y(0) = 1gives (3/5)+C = 1 or C = 8/5. Consequently, y = (3/5) cos(3x) (1/5) sin(3x)+(8/5)exis a solution to the initial value problem.

    Remark 1.4.1. Solving an initial value problem of the form (dy/dx) + ax = q(x), y(x0) = y0 usingthe method of undetermined coefficients as in example 1.4.2 leads to the following steps:

    1. Identify a trial solution yp and determine any unknown coefficients in the trial solution byusing the differential equation.

  • 1.5. EXACT DIFFERENTIAL EQUATIONS 23

    2. Add the solution to the homogeneous equation (dy/dx) + ax = 0, i.e. yh = Ceax to yp to

    obtain y = yp + yh.

    3. Use the initial condition to determine the value of C.

    The crucial step is, of course, to set up a trial solution that works. The method of undeterminedcoefficients will be revisited in section 3.6 in more detail in the context of second-order lineardifferential equations with constant coefficients.

    1.5 Exact Differential Equations

    We consider first-order differential equations of the form

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

    which we may interpret in the following ways.

    (a) By formally dividing both sides by dx, we can transform (1.17) into a differential equation ofthe form

    dy

    dx= M(x, y)

    N(x, y),

    whose solutions are functions y = f(x).

    (b) By formally dividing both sides by dy, we can transform (1.17) into a differential equation ofthe form

    dx

    dy= N(x, y)

    M(x, y),

    whose solutions are functions x = g(y).

    (c) We can also think of the solution to (1.17) to be given implicitly (as in part (d) of example1.2.1) by the curves F (x, y) = C, where

    xF (x, y) = M(x, y),

    yF (x, y) = N(x, y). (1.18)

    The logic of this point of view can be seen as follows. Suppose x = x(t) and y = y(t) areparametrized by the variable t. Then F (x(t), y(t)) = C for all t; taking the derivative withrespect to t and using the chain rule for functions of two independent variables ([28], theorem6 of section 14.4), we obtain

    xF (x(t), y(t))

    (dx

    dt

    )+

    yF (x(t), y(t))

    (dy

    dt

    )= 0.

    By formally multiplying this equation by dt, and using (1.18), we obtain (1.17).

    In the language of vector calculus, F (x, y) is a potential function for the vector fieldM(x, y) dx+N(x, y) dy, and the solution curves are level curves of F (x, y). If there exists a function F (x, y)that satisfies the conditions in (1.18), then the differential equation (1.17) is said to be exact .

  • 24 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    The next theorem states necessary and sufficient conditions for a differential equation to beexact. We omit its proof (refer to e.g. [28], section 16.3.)

    Theorem 1.5.1. Suppose M(x, y) and N(x, y) together with their first-order partial derivatives aredefined and continuous on some open and simply connected subset U of R2. Then the differentialequation M(x, y) dx+N(x, y) dy = 0 is exact if and only if

    yM(x, y) =

    xN(x, y). (1.19)

    Remark 1.5.1. We are interested in finding the potential function. One method to accomplish thisis to first integrate M(x, y) with respect to x:

    F (x, y) =

    xx0

    M(, y) d + g0(y). (1.20)

    The function g0(y) appears on the right-hand side instead of the customary integration constant.Clearly, (/x)F (x, y) = M(x, y) (Fundamental Theorem of Calculus). Also,

    yF (x, y) =

    xx0

    My(, y) d + g0(y) (1.21)

    =

    xx0

    Nx(, y) d + g0(y)

    = N(x, y)N(x0, y) + g0(y),

    where we used that My = Nx and again the Fundamental Theorem of Calculus. Since we require(/y)F (x, y) = N(x, y) and also F (x0, y0) = C0, (1.20) and (1.21) imply that

    g0(y) = N(x0, y), g0(y0) = C0.

    Thus,

    g0(y) = C0 +

    yy0

    N(x0, ) d

    and using (1.20),

    F (x, y) = C0 +

    yy0

    N(x0, ) d +

    xx0

    M(, y) d. (1.22)

    In effect, we compute the line integral along the straight-line path from (x0, y0) to (x0, y) and thento (x, y). More generally, we can use any curve from (x0, y0) to (x, y) to compute the potentialfunction. However, it is important to ensure that this curve lies entirely in the simply connecteddomain U .

    Example 1.5.1. Find a solution to each initial value problem.

    (a) 2x dx + 3y2 dy = 0, y(0) = 1. The differential equation is exact since (/y)2x = 0 =(/x)3y2. It can be solved by separating variables and integrating: 3y2 dy = 2x dx yieldsy3 = x2 + C, or x2 + y3 = C. The initial condition gives 02 + 13 = C, or C = 1. The

  • 1.5. EXACT DIFFERENTIAL EQUATIONS 25

    (implicit) solution is x2 + y3 = 1, which may be solved for y to obtain y = 3

    1 x2, x R.Alternatively, we may find the potential function using equation (1.20):

    F (x, y) =

    x0

    2 d + g0(y) = x2 + g0(y).

    Since (/y)F (x, y) = g0(y) must equal 3y2, we obtain g0(y) = y3 +C, thus F (x, y) = x2 +y3

    as above.

    (b) (3x29y) dx+(3y29x) dy = 0, y(0) = 0. The differential equation is exact since (/y)(3x29y) = 9 = (/x)(3y2 9x). Equation (1.20) gives

    F (x, y) =

    x0

    32 9y d + g0(y)

    =(3 9y)=x

    =0+ g0(y)

    = x3 9xy + g0(y).Now, we take the derivative with respect to y of the last equation and compare to N(x, y) =3y2 9x. It follows that g0(y) 9x = 3y2 9x, or g0(y) = 3y2. This means that we maychoose g0(y) = y

    3, and consequently F (x, y) = x3 +y39xy. The general solution curves arex3 + y3 9xy = C. Now y(0) = 0 implies C = 0, so the solution to the initial value problemis given by the curve x3 + y3 9xy = 0. Parts of this curve are shown in Figure 1.3.The potential function may also be computed via a line integral using the path x(t) = tx andy(t) = ty, 0 t 1, from (x0, y0) = (0, 0) to (x, y). Then, dx = xdt, dy = ydt, and

    F (x, y) =

    10

    (3(tx)2 9(ty))x+ (3(ty)2 9(tx))y dt

    = (x3 + y3)

    10

    3t2 dt 9xy 1

    02t dt

    = x3 + y3 9xy.

    Integrating Factor for Inexact Equations

    What can be done if the differential equation is not exact, that is if My 6= Nx? If we multiply bothsides of (1.17) by r(x, y), we obtain

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

    We hope to choose the integrating factor r(x, y) in such as way that (1.23) is exact. In general,this means that r(x, y) should be chosen in such as way that

    y(r(x, y)M(x, y)) =

    x(r(x, y)N(x, y)) . (1.24)

    This leads to a partial differential equation involving r(x, y), solving which is beyond the scope ofthis text. If, however, we assume that the integrating factor is either a function of x only or afunction of y only, we may be able to convert (1.17) into an exact equation.

  • 26 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Figure 1.3: Parts of the solution curve to (3x2 9y) dx+ (3y2 9x) dy = 0, y(0) = 0.

    -2 0 2 4

    -2

    0

    2

    4

    We observe that if r(x, y) = r(x), then

    y(r(x)M(x, y)) = r(x)My(x, y),

    x(r(x)N(x, y)) = r(x)N(x, y) + r(x)Nx(x, y).

    Equation (1.24) becomes r(x)My(x, y) = r(x)N(x, y)+r(x)Nx(x, y), or r(x)N(x, y) = r(x)(My(x, y)

    Nx(x, y)), or:r(x)r(x)

    =My(x, y)Nx(x, y)

    N(x, y).

    In other words, if (My(x, y)Nx(x, y))/N(x, y) = g(x) is a function of x only, then the integratingfactor is r(x) = e

    g(x) dx. By also performing a similar calculation if r(x, y) = r(y) (or simply

    interchanging the roles of M,N and x, y), we obtain the following result.

    Theorem 1.5.2. Consider the equation M(x, y) dx+N(x, y) dy = 0.

    (a) If (My(x, y)Nx(x, y))/N(x, y) is a function of x only, and G(x) satisfies G(x) = (My(x, y)Nx(x, y))/N(x, y), then r(x) = e

    G(x) is an integrating factor; that is, r(x)M(x, y) dx +r(x)N(x, y) dy = 0 is an exact equation.

    (b) If (Nx(x, y)My(x, y))/M(x, y) is a function of y only, and H(y) satisfies H (y) = (Nx(x, y)My(x, y))/M(x, y), then r(y) = e

    H(y) is an integrating factor; that is, r(y)M(x, y) dx +r(y)N(x, y) dy = 0 is an exact equation.

    Example 1.5.2. Solve each differential equation.

  • 1.6. EQUILIBRIUM SOLUTIONS AND PHASE PORTRAITS 27

    (a) (y + ex) dx+ dy = 0. Here,

    My(x, y)Nx(x, y)N(x, y)

    =1 0

    1= 1

    can be viewed as a function of x only, r(x) = e

    1 dx = ex is an integrating factor, and thedifferential equation

    ex(y + ex) dx+ ex dy = 0

    is exact. So,

    F (x, y) = g0(y) +

    ex(y + ex) dx

    = g0(y) +

    exy + 1 dx

    = g0(y) + exy + x.

    Since Fy(x, y) = g0(y)+e

    x and also Fy(x, y) = ex, we have g0(y) = 0. The curves exy+x = C

    constitute implicit solutions to (y+ ex) dx+ dy = 0. Solving for y gives y = xex +Cex.(b) For (2xy3 + y4) dx+ (xy3 2) dy = 0,

    Nx(x, y)My(x, y)M(x, y)

    =y3 (6xy2 + 4y3)

    2xy3 + y4=3(2xy2 + y3)y(2xy2 + y3)

    = 3y

    is a function of y only, r(y) = e (3/y) dy = e3 log y = y3 is an integrating factor, and the

    equivalent differential equation (2x+ y) dx+ (x 2y3) dy = 0 is exact. The solution can befound in the usual way as follows:

    F (x, y) = g0(y) +

    2x+ y dx

    = g0(y) + x2 + xy.

    Fy(x, y) = x 2y3 gives g0(y) = 2y3 and we can choose g0(y) = y2. The solutions aregiven by y2 + x2 + xy = C, C R.

    1.6 Equilibrium Solutions and Phase Portraits

    Definition 1.6.1. An autonomous first-order differential equation is of the form

    dy

    dt= F (y). (1.25)

    We assume that the right-hand function F (y) is at least continuous. Note that the rate of changeof the function y depends only on the state y, and not on t. (We choose t to denote the independentvariable rather than x, since thinking of the independent variable as time aids the understanding ofthe concepts that follow.) An equilibrium solution or stationary solution to the differential equation(1.25) is a solution that is a constant function y = y; since dy/dt = 0 for a constant function, weobtain equivalently that for an equilibrium solution F (y) = 0.

  • 28 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Finding equilibrium solutions, and determining their type is a good way of gaining insight intothe qualitative behavior of solution curves. As indicated in the definition above, finding equilibriumsolutions is equivalent to solving the equation F (y) = 0, which is usually a lot easier than solvinga differential equation. We illustrate the process of equilibrium point analysis by re-visiting part(e) of example 1.2.1.

    Example 1.6.1. Find and describe the nature of all equilibrium solutions of the logistic equation

    dy

    dt= y(1 y). (1.26)

    Here, F (y) = y(1 y) which is zero precisely when y = 0 or y = 1. Figure 1.4 shows the graphof F (y) = y(1 y).

    Figure 1.4: The graph of dy/dt = y(1 y).

    -0.5 0.5 1.0 1.5y

    -0.4

    -0.2

    0.2

    0.4

    dydt

    The equilibrium solutions correspond to the points of intersection of the graph with the y-axis(which is the horizontal axis in this case). We further observe that the values on the vertical axisrepresent values of dy/dt. In particular, this means:

    (a) If y < 0, then dy/dt < 0, so the function y is decreasing. If the initial value of y is negative,then the values of the solution become smaller (more negative) with time.

    (b) If 0 < y < 1, then dy/dt > 0, so the function y is increasing. If the initial value is between 0and 1, the values of y increase with time.

    (c) If y > 1, then dy/dt < 0, so the function y is decreasing. If the initial value is greater than 1,the values of y get smaller with time.

    The observations (a)-(c), together with the equilibrium solutions, give us information on the quali-tative/geometric/asymptotic behavior of the solution curves. This information may be summarized

  • 1.6. EQUILIBRIUM SOLUTIONS AND PHASE PORTRAITS 29

    graphically in a phase portrait . The phase portrait for the logistic equation is given by Figure 1.5.The equilibrium solution y = 0 is a source, y = 1 is a sink.

    Figure 1.5: The phase portrait for dy/dt = y(1 y).

    0 1y

    Definition 1.6.2. An equilibrium solution y = y is:

    (a) A sink if dy/dt > 0 for all y-values close to, but less than y = y, and if dy/dt < 0 for ally-values close to, but greater than y = y.

    (b) A source if dy/dt < 0 for all y-values close to, but less than y = y, and if dy/dt > 0 for ally-values close to, but greater than y = y.

    (c) A node if dy/dt > 0 for all y-values close to, but not equal to y = y; or if dy/dt < 0 for ally-values close to, but not equal to y = y.

    Figure 1.6 shows the phase portraits near each type of critical point.

    Figure 1.6: Classification of Equilibrium Points.

    y*y

    y*y

    Sink Source

    y*y

    y*y

    Node Node

    Remark 1.6.1. This means that solutions that start near a sink will approach the sink as t increases;solutions starting near a source will move away from it as t increases (and towards it if goingbackward in time); solutions near a node will move in one direction only. Note that under fairlygeneral conditions (namely that F (y) in (1.25) is continuous), these solutions will never actuallyreach the equilibrium point in finite time. This last fact is addressed more rigorously in section 1.8.

    Although the definition of a sink, source, or node only involves local behavior of solution curves,it can be easily extended to a larger set of initial conditions. Consider for example the phase portraitin Figure 1.5. At first glance, it may be conceivable that a solution curve starting at, e.g., y = 2decreases in forward time, but does not become arbitrarily close to the equilibrium point y = 1.

  • 30 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Suppose y ymin as t . Then dy/dt 0 and the continuity of F (y) implies F (ymin) = 0.Since there is no equilibrium point between y = 1 and y = 2, ymin = y

    , and y = 1 must attractall solution curves starting at y > 1 in forward time.

    Example 1.6.2. Find and classify all equilibrium solutions and draw the phase portrait. Also,determine the asymptotic behavior of the solution with the given initial values.

    (a) dy/dt = 3y2(2 y), y(0) = 1. Here, F (y) = 0 precisely if y = 0 or y = 2. The graph ofF (y) = 3y2(2 y) (Figure 1.6a) shows that if y < 0 or 0 < y < 2, dy/dt > 0; and if y > 2,dy/dt < 0. This means that y = 0 is a node and y = 2 is a sink. Figure 1.7a shows thephase portrait for this differential equation on the y-axis. Since the initial value y(0) = 1 liesbetween 0 and 2, we have

    limt y(t) = 2, limt y(t) = 0.

    (b) dx/dt = x3 x2 3x + 3, x(0) = 2. The equation x3 x2 3x + 3 = 0 can be solved bygrouping and yields the equilibrium solutions x = 1 and x = 3. Figure 1.7b shows thegraph of F (x) = x3 x2 3x+ 3 together with the phase portrait. The equilibrium solutionx = 1 is a sink and x = 3 are both sources. Since x(0) = 2 > 3,

    limtx(t) =, limtx(t) =

    3.

    Figure 1.7: The graphs of the right-hand side, together with the corresponding phase portraits forexample 1.6.2: (a) dy/dt = 3y2(2 y) (left); dx/dt = x3 x2 3x+ 3 (right).

    -1 1 2 3y

    -1

    1

    2

    3

    4dydt

    -3- 3 1 3 3

    x

    -1

    1

    2

    3

    4

    5dxdt

    1.7 Slope Fields and Eulers Method

    As seen in the previous section, phase portraits are appropriate graphs for autonomous differentialequations. In the case of a more general non-autonomous differential equation y = G (x, y), wemay use a slope field to obtain information on the qualitative behavior of solution curves. Thefollowing example illustrates how a slope field is generated.

  • 1.7. SLOPE FIELDS AND EULERS METHOD 31

    Example 1.7.1. Consider the differential equation dy/dx = y2 x. The idea when creating a slopefield is to pick a set of points in the xy-plane, and draw a short line segment that represents the slopedy/dx at each point (i.e. it represents the slope of the solution curve passing through that point).Figure 1.8a shows how this is done for the point (2, 1), where the slope is dy/dx = 12 2 = 1;and for the point (1, 2), where the slope is dy/dx = 22 1 = 3. If this process is done (preferablyby using a grapher) for a large grid of points, we obtain the slope field in Figure 1.8b.

    Figure 1.8: Slopes dy/dx for dy/dx = y2x: (a) slopes at two selected points (left); (b) slope fieldusing a large grid of points (right).

    slope=12-2=-1

    slope=22-1=3

    -1 1 2 3x

    -1

    1

    2

    3y

    -3 -2 -1 1 2 3x

    -3

    -2

    -1

    1

    2

    3

    y

    Example 1.7.2. Determine which of the following eight differential equations correspond with whichof the four slope fields given in Figure 1.9.

    (i) dy/dx = x 1 (ii) dy/dx = 1 y2 (iii) dy/dx = y2 x2 (iv) dy/dx = 1 x(v) dy/dx = 1 y (vi) dy/dx = x2 y2 (vii) dy/dx = 1 + y (viii) dy/dx = y2 1

    Observe that in slope field (a), the slopes are the same along each vertical line; that is, theslope depends only on x, not on y. This tells us that the corresponding differential equation mustbe of the form dy/dx = g(x). The two choices are hence (i) and (iv). Since for x = 0, the slopesare positive in slope field (a), we match it with differential equation (iv).

    Slope field (b) corresponds to an autonomous differential equation (slopes are the same alonghorizontal lines), and y = 1 is its one and only equilibrium solution. Differential equation (v) isthe only one that fits this description.

    Slope field (c) also corresponds to an autonomous differential equation, and has y = 1 as itsequilibrium solutions. Differential equations (ii) and (viii) are both candidates, but (viii) is the onethat also has negative slopes when y = 0.

    We observe that in slope field (d), dy/dx = 0 for points that appear to be on the lines y = x.This narrows things down to differential equations (iii) or (vi). Since the slopes are all non-positivealong the x-axis (that is, when y = 0), differential equation (iii) matches with slope field (d).

  • 32 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Figure 1.9: The slope fields for example 1.7.2.

    -3 -2 -1 1 2 3x

    -3

    -2

    -1

    1

    2

    3

    y

    -3 -2 -1 1 2 3x

    -3

    -2

    -1

    1

    2

    3

    y

    (a) (b)

    -3 -2 -1 1 2 3x

    -3

    -2

    -1

    1

    2

    3

    y

    -3 -2 -1 1 2 3x

    -3

    -2

    -1

    1

    2

    3

    y

    (c) (d)

  • 1.7. SLOPE FIELDS AND EULERS METHOD 33

    Eulers Method

    Eulers Method is a numerical method that, roughly speaking, follows the slope field starting atan initial point (x0, y0) to obtain approximate solutions to the initial value problem y

    = G(x, y),y(x0) = y0. More precisely, given a point (x0, y0) and a step size x, the solution y = g(x) to thisinitial value problem is approximated as follows.

    Let xi = x0 + k x for k = 1, 2, 3, . . .. Using the tangent line approximationg(x+ x) g(x) + g(x)x, (1.27)

    we can approximate g(x1) = g(x0 + x) as g(x1) g(x0) + g(x0)x. But now g(x0) = y0 andg(x0) = G(x0, y0) (since g(x) is a solution to the initial value problem y = G(x, y), y(x0) = y0).Thus the first step in Eulers Method is to approximate g(x1) by y1 = y0 + G(x0, y0)x. This isequivalent to following a line passing through the point (x0, y0) with slope G(x0, y0) for x unitshorizontally to the point (x1, y1); see Figure 1.10a. From this point, we follow the line with slopeG(x1, y1) for x units, and obtain the new point (x2, y2); we repeat this process by starting at(x2, y2) with slope G(x2, y2), etc. Figure 1.10b illustrates this process.

    Figure 1.10: Illustration of Eulers Method: (a) the first step (left); (b) the first and second step(right).

    slope=GHx0,y0L

    x0 x1=x0+Dxx

    y0

    y1=y0+GHx0,y0LDx

    y

    slope=GHx0,y0L

    slope=GHx1,y1L

    x0 x1 x2x

    y0

    y1=y0+GHx0,y0LDx

    y2=y1+GHx1,y1LDx

    y

    In effect, we compute approximations yk to the values of the actual solution g(xk) by using theiterative scheme

    yk+1 = yk +G(xk, yk)x. (1.28)

    Example 1.7.3. Consider the initial value problem dy/dx = y2 x, y(0) = 1. We use Eulersmethod to approximate the solution for 0 x 2 using x = 0.2. Note that y0 = 1, x0 = 0,and x1 = 0.2, x2 = 0.4, x3 = 0.6, . . . , x10 = 2.0. Also, G(x, y) = y

    2 x. According to equation(1.28), y1 = 1 + ((1)2 0) 0.2 = 0.8, y2 = 0.8 + ((0.8)2 0.2) 0.2 = 0.712, y3 =0.712 + ((0.712)2 0.4) 0.2 = 0.690611, . . . . The results are shown in Table 1.1. Figure 1.11shows the polygonal path obtained from plotting these points.

  • 34 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Table 1.1: The results of Eulers method for dy/dx = y2 x, y(0) = 1 using x = 0.2.

    k xk yk0 0.00 1.00001 0.20 0.80002 0.40 0.71203 0.60 0.69064 0.80 0.71525 1.00 0.77296 1.20 0.85347 1.40 0.94788 1.60 1.04819 1.80 1.148410 2.0 1.2446

    It is reasonable to expect that if x is chosen to be small, then Eulers method will usually givea good approximation of the actual solution to the given initial value problem. However, there areexceptions, as the following example illustrates.

    Example 1.7.4. Consider the initial value problem

    dy

    dx= ex cos(ex 1), y(0) = 0.

    It can be seen by integration that the solution is y = sin(ex 1). However, the numerical solutionwhen using Eulers method will eventually become unbounded, no matter how small x is chosen.Figure 1.12 shows the numerical solution in red for 0 x 4 with x = 0.25, and Figure 1.13shows the numerical solution in red for 0 x 5 with x = 0.1. The actual solution is shown inblue.

    The reason for this behavior is that the actual solution exhibits higher and higher frequenciesas x becomes large. Thus, at some point, the tangent line used for approximation will become sosteep that it overshoots the horizontal strip H = {(x, y) : 1 y y} even for a small step size,and then lands well outside H. In fact, Figure 1.12 shows that even before the numerical solutionbecomes unstable, it tends to bounce around this strip without really following the exact solutionany more.

    1.8 Existence and Uniqueness

    Example 1.8.1. Consider the initial value problem dy/dx = xy2/3, y(0) = 0. The differentialequation is separable, so we may use the method in section 1.2 to solve it. Separating variablesgives dy/y2/3 = x dx; integrating both sides gives 3y1/3 = (x2/2) +C, or y = ((x2/6) +C)3. Usingy(0) = 0 provides C = 0, so a solution to the initial value problem is y = x6/216. However, theconstant function y = 0 is also a solution to this initial value problem, and so are the piecewise

  • 1.8. EXISTENCE AND UNIQUENESS 35

    Figure 1.11: The polygonal path traced out by the points when using Eulers method for dy/dx =y2 x, y(0) = 1 with x = 0.2.

    0.5 1.0 1.5 2.0x

    -2.0

    -1.5

    -1.0

    -0.5

    y

    Figure 1.12: The numerical solution (red) versus the actual solution (blue) in example 1.7.4: (a)x = 0.25 (left); (b) x = 0.1 (right).

    1 2 3 4

    -5

    5

    10

    15

    1 2 3 4 5

    -25

    -20

    -15

    -10

    -5

    5

  • 36 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    defined functions

    y =

    {0 if x < 0

    x6/216 if x 0 and y ={x6/216 if x < 0

    0 if x 0 .

    We observe that the initial value problem in example 1.8.1 does not have a unique solution.From an applications point of view, this is rather problematic, especially in physical applicationswhere only one solution is observed. In other words, the initial value problem dy/dx = xy2/3,y(0) = 0 would not be a good mathematical model for a situation in which a unique solution isexpected. The following theorem states a condition under which a unique solution to a given initialvalue problem can be guaranteed.

    Theorem 1.8.1. Suppose the function G(x, y) and its partial derivative (G/y)(x, y) are contin-uous on some open rectangle containing the point (x0, y0). Then there exists a unique solution tothe initial value problem

    dy

    dx= G(x, y), y(x0) = y0. (1.29)

    The proof of this theorem involves graduate level work, and is consequently omitted. Note thatthe unique solution in theorem 1.8.1 need not be defined over the entire width of the rectanglewhere G(x, y) and (G/y)(x, y) are continuous. In general, this solution is only defined on apossibly smaller open interval I containing x0.

    Example 1.8.2. Use theorem 1.8.1 to investigate the uniqueness of solutions to each initial valueproblem.

    (a) dy/dx = xy2, y(0) = 1. Here, G(x, y) = xy2 and (G/y)(x, y) = 2xy are continuous on allof R2. Thus, there is a unique solution to the initial value problem. Note that the existence ofa unique solution to an initial value problem and the fact that G(x, y) and (G/y)(x, y) arecontinuous for all values of x and y does not imply that this solution is defined everywhere.Here, the solution (which is y = 2/(2 x2)) is undefined at x = 2.

    (b) dy/dx = 3y2/3, y(0) = 0. The partial derivative (G/y)(x, y) = 2y1/3 is not continuousat y = 0, so theorem 1.8.1 does not assert the existence of a unique solution. Indeed, it canbe seen that the functions y = x3 and y = 0 are both solutions the initial value problem.Additionally, the initial value problem has infinitely many solutions of the form

    y =

    {0 if x < C

    (x C)3 if x C for C > 0

    or

    y =

    {(x C)3 if x < C

    0 if x C for C < 0.

    (c) dy/dx = |y|, y(0) = 0. Clearly, the constant function y = 0 is a solution to this initial valueproblem. The absolute value function G(y) = |y| is not differentiable at y = 0, so theorem1.8.1 cannot guarantee that y = 0 is the only solution. However, it does not assert that theremust be others. In fact, using the following elementary arguments, it can be seen that y = 0is indeed the only solution to dy/dx = |y|, y(0) = 0.

  • 1.9. BIFURCATIONS OF AUTONOMOUS FIRST-ORDER DIFFERENTIAL EQUATIONS 37

    Suppose there exists a solution y(x) to dy/dx = |y|, y(0) = 0 with y 6= 0. This means thereexists a value x0 so that y0 = y(x0) 6= 0. First consider the case y0 > 0. The solution satisfiesthe initial value problem dy/dx = y, y(x0) = y0 which has the by theorem 1.8.1 uniquesolution y(x) = y0e

    xx0 defined on some open interval about x0. Since y(0) = y0ex0 6= 0,y(x) must at some point be different from y(x). The only way this can be accomplishedis by having a point of discontinuity for y(x). However, by virtue of being a solution to adifferential equation, y(x) is differentiable and thus must be continuous. The case y0 < 0 istreated similarly.

    Remark 1.8.1. A geometric consequence of having a unique solution to a given initial value problemis that solution curves corresponding to different initial values are either identical or they do notintersect. In particular, this means that for an autonomous differential equation, transient solutionscan never reach an equilibrium solution in finite time. This fact was already mentioned in remark1.6.1.

    1.9 Bifurcations of Autonomous First-Order Differential Equa-tions

    We now consider first-order differential equations of the form

    dy

    dt= F(y) (1.30)

    where is a parameter ; that is, is a value that may be chosen freely, but is fixed when solvingthe differential equation. Technically, equations of the form (1.30) are one-parameter families ofautonomous differential equations. Autonomous differential equations were covered in section 1.6.In this section, we will investigate how different values of the parameter influence the qualitativestructure of solutions to (1.30).

    Example 1.9.1. Consider the one-parameter family

    dy

    dt= y2 2y + . (1.31)

    The graph of F(y) = y22y+ for various values of is shown in Figure 1.13. Since the effect of

    the parameter is that of lifting the graph of y 7 y2 2y, we expect that there is a unique value0 so that the following hold.

    If > 0, there are no equilibrium solutions, and dy/dt > 0 for any solution y. If = 0, there is exactly one equilibrium solution y, which is a node. If < 0, there are two equilibrium solutions y1 < y2. The equilibrium solution y1 is a sink;y2 is a source.

    The value 0 is called the bifurcation value or bifurcation parameter. A bifurcation occurs if thereis a fundamental change in the dynamics of a differential equation. In this example, the bifurcationoccurs precisely when the parabola y22y+ touches the y-axis: at 0, a sink and a source collide,

  • 38 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Figure 1.13: The graph of F(y) = y2 2y + for = 1, 0, 1, 2.

    -2 -1 1 2 3 4y

    -2

    2

    4

    6

    8

    10dydx

    =2

    =1

    =0

    =-1

    and after the collision, the equilibrium solutions have vanished (the sink and the source cancelout at 0). From Figure 1.13, 0 = 1. We can also compute 0 analytically by observing that thevertex of F(y) occurs at y = 1 (when F

    (y) = 2y 2 = 0). The dy/dt-coordinate of the vertex is

    F(1) = 12 2(1) + = 1. Thus, dy/dt = 0 if = 1.

    Continuing this example, we would now like to generate a bifurcation diagram for the one-parameter family F(y) = y

    2 2y + . The horizontal axis of this bifurcation diagram representsvalues of the parameter . The vertical axis represents the equilibrium solutions y. Dashed curvesin the bifurcation diagram give the locus of sources, solid curves represent the locus of sinks. Thebifurcation diagram of the one-parameter family of differential equations (1.31) is shown in Figure1.14. It is obtained qualitatively from Figure 1.13 as follows. If < 0 = 1, the graph in Figure1.13 has two points of intersection with the y-axis, representing two equilibrium solutions: the sinky1 with y1 < 1, and the source y2 with y2 > 1. If = 0 = 1, there is one point of intersectionwith the y-axis, which represents an equilibrium solution which is a node. If > 0 = 1, there areno intersections with the y-axis, and hence no equilibrium solutions.

    A bifurcation where a source and a sink collide and subsequently disappear is called a saddle-node bifurcation, or a tangent bifurcation. Note that the curves in Figure 1.14 may be foundanalytically as follows. Since an equilibrium solution occurs when dy/dt = 0, we need to set (1.31)equal to zero, and solve

    (y)2 2y + = 0. (1.32)

    This yields y = 1 1 , which represents the two branches in the bifurcation diagram. Byevaluating F (y) along each branch, we can determine whether we have a sink (F (y) < 0) or asource (F (y) > 0). It should be pointed out that generally, due to possible algebraic complica-tions, we prefer to obtain the bifurcation diagram qualitatively (as from Figure 1.13), rather thananalytically.

    Example 1.9.2. Find the bifurcation values and draw the bifurcation diagram for each of the fol-lowing one-parameter families of differential equations.

  • 1.9. BIFURCATIONS OF AUTONOMOUS FIRST-ORDER DIFFERENTIAL EQUATIONS 39

    Figure 1.14: The bifurcation diagram of dy/dt = y2 2y + .

    source

    sink

    node

    -0.5 0.5 1.0 1.5

    0.5

    1.0

    1.5

    2.0

    (a) dy/dt = y3 y. Figure 1.15a shows the graph of F(y) = y3 y for > 0. In this casethere are three equilibrium solutions: y1 = 0, which is a sink, and y2/3 =

    , which are

    sources. Figure 1.15b shows the graph of F for < 0; there, y1 = 0 is the only equilibrium

    solution, and a source. The bifurcation diagram is given in Figure 1.16. In this example, wehave a pitchfork bifurcation at 0 = 0: as changes sign from negative to positive, the sourceflips into a sink, and two new sources are created.

    Figure 1.15: The graphs of F(y) = y3 y: (a) > 0 (left); (b) < 0 (right).

    -

    y

    dydx

    y

    dydx

    (b) dx/dt = x(1 x)2 + . The graph of F(x) = x(1 x)2 + , with = 0, in Figure 1.17ashows that we have two tangent bifurcations, one at 0 = 0, and the other occurs whereF(x) has its local maximum. Elementary analysis yields that this occurs when x = 1/3, so

  • 40 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    Figure 1.16: The bifurcation diagram of dy/dt = y3 y.

    -0.5 0.0 0.5 1.0-1.0

    -0.5

    0.0

    0.5

    1.0

    y*

    1 = (1/3)(1 (1/3)) = 4/27. The bifurcation diagram is shown in Figure 1.17b.

    Figure 1.17: (a) The graph of F0(x) = x(1 x)2 (left); (b) the bifurcation diagram of dx/dt =x(1 x)2 + (right).

    0.5 1.0 1.5x

    -0.2

    0.2

    0.4

    dxdt

    -0.4 -0.2 0.2 0.4

    -0.5

    0.5

    1.0

    1.5

    x*

    Bifurcation Diagrams and Phase Portraits

    A bifurcation diagram can be interpreted as a collection of phase portraits, as illustrated by re-visiting part (a) of example 1.9.2; the only caveat is that the phase portraits now appear in thevertical direction.

    Example 1.9.3. We use the bifurcation diagram in Figure 1.16 to draw the phase portrait anddetermine the asymptotic behavior of solutions for the differential equation

    dy/dt = y3 y. (1.33)

    (a) = 0.5, y(0) = 1. If = 0.5, there is a source at y = 0. Since y(0) = 1 > 0,

  • 1.10. MATHEMATICA USE 41

    limt y(t) = and limt y(t) = 0. The phase portrait when = 0.5 is shown inFigure 1.18.

    (b) = 0.5, y(0) = 0.2. If = 0.5, there is a sink at y0 = 0 > 0.2 and a source y1 < 0.2.This means limt y(t) = 0 and limt y(t) = y1. The phase portrait when = 0.5 is alsoshown in Figure 1.18.

    Figure 1.18: The bifurcation diagram and phase portraits of dy/dt = y3 y if = 0.5 and = 0.5.

    -0.5 0.0 0.5 1.0-1.0

    -0.5

    0.0

    0.5

    1.0

    y*

    1.10 Mathematica Use

    Solving Differential Equations

    Differential equations and initial value problems can be solved symbolically using the DSolve com-mand.

    Example 1.10.1. (a) The solution to the differential equation dy/dx = xy is y = Cex2/2. The

    double equal sign must be used for equations; the single equal sign is an assignment operatorand will produce an error. Also, the solution function must be written as y[x], not just as y.

    DSolve@y'@xD x * y@xD, y@xD, xD

    99y@xD x2

    2 C@1D==

    (b) The solution to the initial value problem dy/dx = xy, y(0) = 5 is y = 5ex2/2. The first

    argument is a list containing the two equations.

    DSolve@8y'@xD x * y@xD, y@0D 5

  • 42 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    (c) The differential equation need not be solved for y(x) when entering it using DSolve.

    DSolve@Hy'@xDL^2 - y@xD 0, y@xD, xD

    99y@xD 1

    4Ix2 - 2 x C@1D + C@1D2M=, 9y@xD

    1

    4Ix2 + 2 x C@1D + C@1D2M==

    To obtain a numerical solution, use the NDSolve command. The output is an interpolatingfunction which must be evaluated separately.

    Example 1.10.2. The numerical solution to the initial value problem dy/dx = y2 x, y(0) = 1, isproduced and assigned the name solution. Note that a range must be specified for the independentvariable.

    solution = NDSolve@8y'@xD Hy@xDL^2 - x, y@0D -1

  • 1.10. MATHEMATICA USE 43

    where formula is the right-hand side of the differential equation (a function of x and y); xRange is alist that contains the minimum and maximum x-value (in that order); yRange is a list that containsthe minimum and maximum y-value (in that order); and nPoints is a list that contains the numberof grid points used to in the x-direction and the number of grid points used to in the y-direction,respectively.

    Example 1.10.3. Generate a slope field for the differential equation dy/dx = x(y x) using theviewing window 3 x 3 and 3 y 3, with 24 grid points in each direction. First, pressShift+Enter in the cell containing the definition of the PlotSlopeField function. The name ofthe function turns from blue to black. Mathematica now knows this function. Then, define theright-hand side e.g. as f1:

    f1@x_, y_D := x * Hy - xL;

    The slope field is produced as follows.

    g1 = PlotSlopeField@f1, 8-3, 3

  • 44 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    solution = NDSolve@8y'@xD Hy@xDL^2 - x, y@0D -1

  • 1.11. EXERCISES 45

    (e)dy

    dx= 3x2y, y(0) = 5

    (f)dx

    dt=x2

    t, x(1) = 1

    (g)dx

    dt+ 4x = 1, x(0) = 0

    (h) xy + 2y = 3x, y(1) = 0

    (i) xy2y y3 = x3, y(1) = 0(j) (3x2y3 + y4)dx+ (3x3y2 + y4 + 4xy3)dy = 0, y(1) = 2(k) y =

    x+ y + 1 1, y(0) = 1 (Hint: look at exercise 1.3 first.)

    (l) xdy

    dx+ 6y = 3xy4/3, y(1) = 1 (Hint: look at exercise 1.4 first.)

    (m) y dx+ (2x yey) dy = 0, y(0) = 1 (Hint: find an integrating factor of the form r(y).)

    Exercise 1.3.

    (a) Prove that a differential equation of the formdy

    dx= F (ax+ by + c)

    will become separable if the substitution v = ax+ by + c is used.

    (b) Use the substitution in (a) to solve the initial value problemdy

    dx= (x+ 4y 1)2, y(0) = 1/8.

    (c) Use the substitution in (a) to solve the initial value problem

    dy

    dx= (y + 4x+ 1)2, y(0) = 1.

    Exercise 1.4. Consider Bernoullis Equation. It is a differential equation of the form

    dy

    dx= A(x)y +B(x)yn, (n 6= 0, 1).

    (a) Show that the substitution z = y1n transforms Bernoullis Equation into a linear differ-ential equation of the form

    dz

    dx= (1 n)A(x)z + (1 n)B(x).

  • 46 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    (b) Use the substitution in (a) to solve the initial value problemdy

    dx+ x1y = xy2, y(1) = 1.

    Exercise 1.5. For each differential equation, determine all equilibrium solutions, their type (sink,source, node), and sketch the phase portrait. Also, determine the asymptotic behavior of thesolutions given by the initial conditions.

    (a) dydt

    = y2 y 6; y(0) = 0, y(0) = 4.

    (b) dydt

    = y3 2y2; y(0) = 1, y(0) = 1.

    (c)dx

    dt= x3 x2 3x+ 3; x(0) = 1, x(0) = 2.

    (d)dx

    dt= sinx; x(0) = 1, x(0) = pi.

    Exercise 1.6. Provide a justification for the following first-derivatives test for classifying equilibriumsolutions. Suppose dy/dt = F (y), and F (y) = 0.

    If F (y) > 0, then y is a source; if F (y) < 0, then y is a sink; if F (y) = 0, then the test is inconclusive.

    Also, provide one example each for a differential equation where F (y) = 0, and y is a source, asink, or a node.

    Exercise 1.7. Use Mathematica and the module provided in the file SlopeFields.nb to plot theslope fields of the following differential equations.

    (a) dydx

    = x(y x), 3 x, y 3, grid dimensions: {24, 24}.

    (b) dydx

    = x2 y, 3 x, y 3, grid dimensions: {24, 24}.

    (c) dydx

    = xy2, 3 x, y 3, grid dimensions: {24, 24}.

    (d) dydx

    = y/x, 3 x, y 3, grid dimensions: {24, 24}.

    Exercise 1.8. Use Eulers Method to approximate the solution to each initial value problem at thegiven value of the independent variable.

    (a) dydx

    = x(y x), y(0) = 1, at x = 1 if x = 0.5.

  • 1.11. EXERCISES 47

    (b) dydx

    = x2 y, y(0) = 0, at x = 1 if x = 0.25.

    (c) dydx

    = y2 x, y(0) = 1, at x = 1 if x = 0.2.

    (d)dy

    dt= y2 t2, y(1) = 1, at t = 2 if t = 0.25.

    (e)dy

    dt= ty y3, y(0) = 1, at t = 1 if t = 0.25.

    (f)dy

    dt= sec2 t, y(0) = 0, at t = 1 if t = 0.2.

    Exercise 1.9. For each of the following initial value problems, determine whether the Existenceand Uniqueness Theorem guarantees that there is a unique solution passing through the initialcondition.

    (a) dydt

    = y2, y(0) = 0.

    (b) dydt

    = 4ty3/4, y(0) = 1.

    (c) dydt

    = 4ty3/4, y(1) = 0.

    (d) dydt

    =1

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

    (e)dy

    dx= tan y, y(0) = 0.

    (f)dy

    dx=

    y

    x2, y(1) = 0.

    (g)dy

    dx=

    y

    x2, y(0) = 0.

    (h)dy

    dx=

    x

    (y 1)2 , y(0) = 0.

    Exercise 1.10. We have seen in example 1.1.1 that the initial value problem

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

    has two different solutions y = (1/4)(x2 + 4x + 4) and y = (1/4)(x2 4x + 4). Are any of theconditions in theorem 1.8.1 is violated in this case? How do you explain the result of the non-uniquesolution?

    Exercise 1.11. Draw the bifurcation diagram for each one-parameter family of differential equations.Label all axes correctly, and find all bifurcation values.

  • 48 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

    (a) dydt

    = y y2.

    (b) dydt

    = y2(1 y2) + .

    (c)dx

    dt= x3 2x2 + .

    (d)dx

    dt= (x2 + )x.

    (e)dx

    dt= x2 + x+ 2 1.

    Exercise 1.12. Write a Mathematica module that implements Eulers method. You may want toadapt the code of the SlopeFields module.

    Exercise 1.13. Show that a function y = f(x) is a solution of the initial value problem

    dy

    dx= G(x, y), y(x0) = y0 (1.34)

    precisely when y = f(x) satisfies the integral equation

    y = y0 +

    xx0

    G(t, y) dt. (1.35)

    Note that this means you need to show that if y = f(x) satisfies (1.34), then it also satisfies(1.35); and if y = f(x) satisfies (1.35), then it also satisfies (1.34).

    Exercise 1.14. (Picard Iteration) Consider again the initial value problem

    dy

    dx= G(x, y), y(x0) = y0.

    Define a sequence of functions 0(x), 1(x), 2(x), . . . as follows.

    0(x) = y0

    n+1(x) = y0 + xx0

    G(t, n(t)) dt for n = 1, 2, . . ..

    (a) Show that for dy/dx = y, y(0) = 1, 0(x) = 1, 1(x) = 1+x, 2(x) = 1+x+(x2/2!),. . . ,n(x) =

    1 + x + (x2/2!) + . . . + (xn/n!). Thus, n(x) ex, which is the solution to the initial valueproblem.

    (b) Find 0(x), 1(x), 2(x), 3(x) for the initial value problem dy/dx = y2 x, y(0) = 0, and

    use 3(x) to approximate the solution at x = 0.5.

    Exercise 1.15. The following method, called variation of parameters, is another method that canbe used to solve linear first-order differential equations of the form

    y + p(x)y = q(x). (1.36)

  • 1.11. EXERCISES 49

    (a) Let yh be the solution to the corresponding homogeneous equation; i.e. yh+p(x)yh = 0. Show

    that yh = CeP (x), where P (x) is an antiderivative of p(x) and C is a constant parameter.

    (b) The idea behind the variation of parameters method is to assume that when looking for asolution to the non-homogeneous equation (1.36), the constant C in part (a) is actually afunction of x. Thus, we assume that the solution to (1.36) is of the form

    y = c(x)eP (x).

    Show that c(x) satisfies the differential equation c(x)eP (x) = q(x), and that the solution yis given by equation (1.14). Thus, the method of variation of parameters and the integratingfactor method are equivalent.

  • 50 CHAPTER 1. FIRST-ORDER DIFFERENTIAL EQUATIONS

  • Chapter 2

    Applications of First-OrderDifferential Equations

    This chapter presents various applications of first-order differential equations. Most examples weconsider will be autonomous equations of the form dy/dt = f(y), rather than the more general formdy/dt = f(t, y) considered previously. The reason for this is that in most physical applications, thereis no absolute time-dependence of the rate of change of the quantity y (exceptions are situations inwhich there is external forcing, as for example the presence of an extraneous voltage source inelectric circuits see section 2.2). In other words, the time-evolution of, for example, a chemicalexperiment will not depend on when (in which year, at what time of day) the experiment wasconducted; the outcome will depend only on how much time has elapsed since the experiment wasstarted.

    2.1 Population Models

    We consider the following general model for the growth (or decay) of a single population.

    Let denote the birth rate of the population over a fixed period lasting one unit of time (say,a year); that is,

    =number of individuals who were born

    total number of individuals.

    Let denote the death rate of the population over the same fixed period of time; consequently,

    =number of individuals who died

    total number of individuals.

    The change in the population P over the time period t (say, one month or t = 1/12) is:

    P (t+ t) P (t) = P (t) t P (t) t, (2.1)

    orP (t+ t) P (t)

    t= ( ) P (t). (2.2)

    51

  • 52 CHAPTER 2. APPLICATIONS OF FIRST-ORDER DIFFERENTIAL EQUATIONS

    Letting t 0 in equation (2.2), we obtain the differential equationdP

    dt= ( ) P. (2.3)

    Generally, we can look at the following cases, based on how birth and death rates depend eitheron time or on the current population.

    The case , = constant. This leads to exponential growth or decay (see below). The case = (t) and = (t). This corresponds to a form of externally forced growth or

    decay which is not usually sufficiently realistic in population models. The reason for this isthat while population growth rates may be influenced by external factors (such as seasonalvariations in temperature, water supply, etc.), the are also influenced by the size to thepopulation itself.

    The case = (P ) and = (P ). In this situation there is feedback ; the current populationdetermines the birth and death rates. An important model is logistic growth, which is in-vestigated below. This is a closed model; there are no external (explicitly time-dependent)factors that influence the growth rate.

    The case = (t, P ) and = (t, P ). This is the most general situation when there isonly one isolated population. We do not analyze this situation here. However, it shouldbe pointed out that external influences can usually be easily incorporated in a differentialequations model (see e.g. exercise 2.1). In chapter 7, we will analyze higher-dimensionalpopulation models that incorporate interaction among two or more populations (for example,a predator species and a prey species).

    We now present two models based on equation (2.3).

    Exponential Growth or Decay

    Suppose both birth and death rates are constant. Then the relative growth rate (dP/dt)/P isconstant. In this situation, the initial value problem (dP/dt) = ( )P , P (0) = P0 has thesolution

    P (t) = P0 e()t. (2.4)If the net reproduction rate = is positive, then we have exponential growth of the pop-ulation; if is negative, then we have exponential decay. Exponential growth and decay modelsare applicable only under very special or artificial conditions (such as growing bacteria on a Petridish), and exponential population growth is clearly not sustainable long term. The following modelis much more realistic.

    Logistic Growth

    Now we assume that the relative growth rate is a decreasing linear function of P . This means,

    dP

    dt= (a+ bP ) P, (2.5)

  • 2.1. POPULATION MODELS 53

    where a > 0 and b < 0. If P 0, (dP/dt)/P a; so small populations growth exponentially withrelative growth rate a. As the population grows, its relative growth rate will decrease linearly. Thisdecrease can be interpreted as being due to increased competition among members of the speciesfor natural resources when the population size increases.

    Equilibrium point analysis shows that (2.5) has the two equilibrium solutions P = 0, which isa source; and P = a/b > 0, which is a sink. The equilibrium solution L = a/b is called thelimiting capacity or the carrying capacity of the population described by equation (2.5). It is thepopulation that can be supported by the environment in the long run. The solution to the initialvalue problem dP/dt = (a+ bP ) P , P (0) = P0 can be found by separation of variables. We obtain

    P (t) =aeatP0

    bP0(1 eat) + a. (2.6)

    Example 2.1.1. Five hundred animals of a species are introduced to an environment. In the be-ginning, when the population is still small, it grows exponentially with a net reproduction rate of10% per year. Eventually, the population will approach its carrying capacity of 15,000 animals.Find the values of a and b, and find the formula for the population t years after the species wasintroduced.

    Solution. a = 0.1, and L = a/b = 15000 gives b = 1/150000. Since P0 = 500, we obtain thesolution

    P (t) =0.1e0.1t 500

    (1/150000) 500 (1 e0.1t) + 0.1 ,

    which simplifies to

    P (t) =15000e0.1t

    29 + e0.1t.

    Figure 2.1 shows the graph of P (t). We observe, for example, that it takes about 60 years for thepopulation to be within 1,000 of the carrying capacity.

    Figure 2.1: The solution to example 2.1.1.

    20 40 60 80 100

    2000

    4000

    6000

    8000

    10 000

    12 000

    14 000

    Example 2.1.2. Table 2.1 shows the population of the United States, starting with the census in1790. We would like to use a logistic growth model for the data. To this end, we need to estimate

  • 54 CHAPTER 2. APPLICATIONS OF FIRST-ORDER DIFFERENTIAL EQUATIONS

    coefficients a and b so that (dP/dt)/P = a+bP . This means, we have to express the relative growthrate as a linear function of the population. This can be done using linear regression as follows. LetPi, i = 0, 1, . . . be the population in the year 1790, 1800, . . ., and let t = 10 years.

    Table 2.1: Historical U.S. populations based on census data (Source: www.wikipedia.org).

    Census Year Population

    1790 3,929,2141800 5,236,6311810 7,239,8811820 9,638,4531830 12,866,0201840 17,069,4531850 23,191,8761860 31,443,3211870 38,558,3711880 49,371,3401890 62,979,7661900 76,212,1681910 92,228,4961920 106,021,5371930 123,202,6241940 132,164,5691950 151,325,7981960 179,323,1751970 203,211,9261980 226,545,8051990 248,709,8732000 281,421,9062010 308,745,538

    The population for the midyears 1795, 1805, . . . is approximated by P i = (Pi + Pi1)/2 fori = 1, 2, . . .. For example, this means that the population in the year 1795 is approximated by theaverage of the populations of the years 1790 and 1800, which is (5.236 + 3.929)/2 = 4.583 millionpeople. The relative annual growth rate for the midyears is approximated as

    dP/dt

    P (Pi Pi1)/t

    P i. (2.7)

    For the year 1795, the relative annual growth rate would be approximately (5.2363.929)/10/4.583 =0.02852 = 2.852%. The regression line of (Pi + Pi1)/t/P i against P i has intercept a = 0.0276and the slope is b = 7.73 105. A more detailed explanation of how this calculation is done isgiven in the Mathematica section of this chapter.

    Consequently, we need to solve the initial value problem dP/dt = (0.0276 7.73 105P ) P ,P (0) = 3.929 (t = 0 corresponds to the year 1790, P is in millions). It has the solution P =

  • 2.1. POPULATION MODELS 55

    (276000e0.0276t)/(69473.9 + 773e0.0276t). Figure 2.2 shows this function, together with the actualpopulation data. There appears to be a definite break in the growth pattern around the year 1930.In exercise 2.3 you will be asked to recompute the logistic model starting with the year 1930.

    Figure 2.2: U.S. census data and its logistic approximation. The horizonal axis gives the year; thevertical axis the population in millions.

    1850 1900 1950 2000

    50

    100

    150

    200

    250

    300

    Example 2.1.3. Suppose a fish population grows logistically according to the model

    dP

    dt= (0.5 0.00025P ) P.

    If a constant rate of harvesting is introduced into the model, the differential equation becomes

    dP

    dt= (0.5 0.00025P ) P . (2.8)

    We want to investigate the bifurcations the system undergoes as the rate of harvesting is increasedstarting with = 0.

    The equilibrium solutions to the differential equation (2.8) can be found by solving (0.5 0.00025P ) P = 0 for P . This gives P = 1000 1000000 4000. Figure 2.3a shows thegraph of (2.8) when = 100. Note that the left equilibrium point P = 10001000000 4000is a source, and the right equilibrium point P = 1000 +