di erential equations - penn mathdeturck/m104/notes/week5.pdf · so, for falling objects: the rate...

30
Differential Equations D. DeTurck University of Pennsylvania February 27, 2018 D. DeTurck Math 104 002 2018A: Differential Equations 1 / 30

Upload: others

Post on 03-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Differential Equations

D. DeTurck

University of Pennsylvania

February 27, 2018

D. DeTurck Math 104 002 2018A: Differential Equations 1 / 30

Differential equations

The most important application of integrals is to the solution ofdifferential equations.

From a formal mathematical point of view, a differential equationis an equation that describes a relationship among a function, itsindependent variable, and the derivative(s) of the function.

For example:dy

dx= 3xy 2

d2y

dx2− 4

dy

dx+ 3y = 1

Order = highest derivative: first order, second order. . .

D. DeTurck Math 104 002 2018A: Differential Equations 2 / 30

Differential equations

To solve a differential equation means to find a function y(x) thatmakes it true:

y = − 2

3x2solves

dy

dx= 3xy 2

y = ex +1

3solves

d2y

dx2− 4

dy

dx+ 3y = 1

In applications, differential equations arise when we can relate therate of change of some quantity back to the quantity itself:

dy

dx⇐⇒ y

D. DeTurck Math 104 002 2018A: Differential Equations 3 / 30

Example 1

The acceleration of gravity is constant (near the surface of theearth). So, for falling objects:

the rate of change of velocity is constant

dv

dt=g .

Since velocity is in turn the rate of change of position, we couldwrite this as a second-order equation:

d2x

dt2= g .

D. DeTurck Math 104 002 2018A: Differential Equations 4 / 30

Example 2

More realistically: With air resistance the acceleration of a fallingobject is the acceleration of gravity minus the acceleration due toair resistance. For some objects the air resistance is proportional tothe square of the velocity. So for such an object we have thedifferential equation:

The rate of change of velocity is gravity minus somethingproportional to velocity squared:

dv

dt=g − kv 2 or

d2x

dt2= g − k

(dx

dt

)2

.

D. DeTurck Math 104 002 2018A: Differential Equations 5 / 30

Example 3

In a different field:

Radioactive substances decompose at a rate proportional to theamount present.

Suppose y(t) is the amount of the substance present at time t.

The rate of change of the amount is proportional to the amount(and decreasing):

dy

dt=−ky .

D. DeTurck Math 104 002 2018A: Differential Equations 6 / 30

Other situations that yield the same equation

In the presence of abundant resources (food, space), the organismsin a population will reproduce as fast as they can — this meansthat

The rate of change (increase) of the population is proportional tothe population itself:

dP

dt=kP.

The balance in an interest-paying bank account increases at a rate(called the interest rate) that is proportional to the currentbalance. So

dB

dt= kB.

D. DeTurck Math 104 002 2018A: Differential Equations 7 / 30

More realistic situations for the last two problems

For populations:

An ecosystem may have a maximum capacity to support a certainkind of organism (we worry about this very thing for people on theplanet!)

In this case, the rate of change of population is proportional bothto the number of organisms present and to the amount of unusedcapacity in the environment (overcrowding will cause thepopulation to decrease).

If the carrying capacity of the environment is the constant Pmax ,then we get the equation:

dP

dt= kP(Pmax − P).

D. DeTurck Math 104 002 2018A: Differential Equations 8 / 30

and for the interest problem. . .

For annuities:

Some accounts pay interest but at the same time the ownerintends to withdraw money at a constant rate (think of a retiredperson who has saved and is now living on the savings — I thinkabout that all the time).

If the interest rate is r and the retiree wants to withdraw Wdollars per year, which is the correct differential equation for thebalance B in the account at time t?

A.dB

dt= rB + W B.

dB

dt= rB −W C.

dB

dt= rB −WB

D.dB

dt= rB + WB E.

dB

dt= r(B −W )

D. DeTurck Math 104 002 2018A: Differential Equations 9 / 30

One more application:

Newton’s law of cooling:

According to Newton’s law of cooling, the temperature of a hot orcold object will change at a rate proportional to the differencebetween the object’s temperature and the ambient temperature

If the ambient temperature is kept constant at A, and the object’stemperature is u(t), what is the differential equation for u(t)?

D. DeTurck Math 104 002 2018A: Differential Equations 10 / 30

Solving differential equations

Since the the process of solving of a differential equation recoversa function from knowing something about its derivative, it’s nottoo surprising that we have to use integrals to solve differentialequations.

And since we’re using integrals, we should also expect to see some“arbitrary” constants in the solutions of differential equations. Ingeneral, there will be one constant in the solution of a first-orderequation, two in a second-order one, etc. . .

In practice. . .

. . . we can solve for the constants by having some informationabout the value of the unknown function (and/or the value of itsderivative(s)) at some point. From an applications point of view,such initial conditions are clearly needed, since you can’t determinethe value of something just from information about how it ischanging. You also need to know its value at some (“initial”) time.

D. DeTurck Math 104 002 2018A: Differential Equations 11 / 30

Some examples will make this clear

Let’s go back to the very first example:

dy

dx= 3xy 2

This is an example of a separable first-order equation (the onlykind we’ll worry about at first).

If you view dy and dx as variables (so you can multiply both sidesby dx), you can get all the x ’s on one side and all the y ’s on theother by algebraic manipulation. Here, you can write:

dy

y 2= 3x dx

This is an actual “equation of differentials” . Then, simplyintegrate both sides:ˆ

dy

y 2=

ˆ3x dx ⇒ −1

y=

3

2x2 + C

D. DeTurck Math 104 002 2018A: Differential Equations 12 / 30

Solving an initial-value problem

So far, we have solved the differential equationdy

dx= 3xy 2 and

obtained −1

y=

3

2x2 + C (We only need one constant of

integration). This is called the “general solution” of the differentialequation.

We can determine C if we are given one point on the graph of thefunction y(x).

For instance, given that y(1) = 2, we would substitute 2 for y and1 for x in the general solution and get −1

2 = 32 + C and conclude

that C = −2, so the solution of the initial-value problem

dy

dx= 3xy 2 , y(1) = 2

is

−1

y=

3

2x2 − 2 , or better, y =

2

4− 3x2.

D. DeTurck Math 104 002 2018A: Differential Equations 13 / 30

Growth and decay

What is the solution of the differential equation:

y ′ = ky ?

How about the initial-value problem:

y ′ = ky , y(0) = y0 ?

As noted previously, this differential equation (of exponentialgrowth and decay) is useful for modeling radioactive decay,compound interest and unrestricted population growth.

D. DeTurck Math 104 002 2018A: Differential Equations 14 / 30

Examples

If the function y = f (x) satisfies the initial-value problem

dy

dx+ x2y = x2 , f (0) = 5 ,

then f (1) =

A. e3 − 1 B.3e

1 + eC.

5√e

D.√

2

E. 5 +1

eF. 1 +

43√

eG. 10 H.

√e

A colony of bacteria is growing exponentially (so P ′ = kP). Ifthere are 1,000 bacteria present initially, and 4,000 after 6 hours,how many bacteria will there be after 9 more hours?

A. 10,000 B. 12,000 C. 20,000 D. 32,000 E. 64,000

D. DeTurck Math 104 002 2018A: Differential Equations 15 / 30

Differential equations greatest hits, #1

The salty water in the tank problem!

A tank contains 1000 liters of brine (salty water) with 50kg ofdissolved salt. Pure water enters the tank at the rate of 25 litersper minute. The solution is kept thoroughly mixed and drains atthe same rate. How many kg of salt remain in the tank after 10minutes?

The first step in most DiffEq problems is to identify the unknownfunction. Since we want to know the amount of salt at varioustimes, we’ll write A(t) for the amount of salt (in kg) in the tank attime t (minutes).

We are given that A(0) = 50, which provides the initial condition.

Now we have to produce the differential equation. . .

D. DeTurck Math 104 002 2018A: Differential Equations 16 / 30

Mixture problem differential equation

The rate of change of A(t) could come from salt being added tothe tank (but there is none), or from salt flowing out of the tank.The solution flows out at 25 liters per minute and since there areA(t) kg of salt in all 1000 liters of brine, there are A(t)/40 kg in25 liters.

So, which of the following is the differential equation for thisproblem?

A. A′ = A/40 B. A′ = A− 40 C. A′ = 40− A

D. A′ = −A/40 E. A′ = −40/A

D. DeTurck Math 104 002 2018A: Differential Equations 17 / 30

And solve. . .

Now that we’ve set it up, what is the answer to the problem?

In other words, what is A(10) if A′ = −A/40 and A(0) = 50?

A. 0 B. 40 C. 50e1/4 D. 50e−1/4

E. 50e−1/40 F. 25e−1/10 G. 50 ln 2 H. 25

D. DeTurck Math 104 002 2018A: Differential Equations 18 / 30

One more greatest hits problem:

For obvious reasons, the dissecting room of a medical examiner iskept very cool, at a constant temperature of 5 degrees C. Whiledoing an autopsy early one morning, the medical examiner himselfis killed. At 10 am, the examiner’s assistant discovers the bodyand finds its temperature to be 23 degrees C, and at noon thebody’s temperature is down to 18.5 degrees C. Assuming that themedical examiner had a normal temperature of 37 degrees C whenhe was alive, when was he murdered?

A. 3 am B. 4 am C. 5 am D. 6 am

E. 7 am F. 8 am G. 9 am

D. DeTurck Math 104 002 2018A: Differential Equations 19 / 30

Linear differential equations

The other type of DE that we will be able to solve are linearequations. They are of the form:

y ′ + P(x)y = Q(x)

It is important that the coefficient of the y ′ term is 1.

The answer

The solution of the equation

y ′ + P(x)y = Q(x)

is

y = e−´P

(ˆe´PQ + C

)where

´P is any anti-derivative of P.

Why does this work? Because e´Py ′ + Py =

(e´Py

)′.

D. DeTurck Math 104 002 2018A: Differential Equations 20 / 30

Linear equation example

Example: Find the general solution of (1 + x)y ′ + y =√

x .

Solution: First we have to divide through by (1 + x) so that theequation is in proper form:

y ′ +1

1 + xy =

√x

1 + x.

So P(x) = 1/(1 + x) and Q(x) =√

x/(1 + x).

Therefore´

P = ln(1 + x) and so e´P = 1 + x .

We conclude that

y =1

1 + x

ˆ √x dx =

1

1 + x

(2

3x3/2 + C

).

D. DeTurck Math 104 002 2018A: Differential Equations 21 / 30

Geometry of differential equations

All of our first-order differential equations can be put into the form

dy

dx= F (x , y)

and in this form, the equation gives us geometric informationabout the graph of the solution y(x).

The equation y ′ = F (x , y) tells us:

If the graph of y(x) goes through the point (x , y), then the slopeof the graph at that point is equal to F (x , y)

For example, for the differential equationdy

dx= y − x we have:

• If the graph goes through (2, 3) the slope must be 1 there.

• If the graph goes through (0, 0) the slope must be 0 there.

• If the graph goes through (−1,−2) the slope must be −1there.

D. DeTurck Math 104 002 2018A: Differential Equations 22 / 30

Direction field for y ′ = y − x

In this graph, the slope of each arrow is the value of y − x at thepoint at the tail of the arrow. This kind of picture is called thedirection field for the differential equation (in this case, theequation y ′ = y − x).

We can use this to solve the differential equation geometrically andrecover the graph of the unknown function.

D. DeTurck Math 104 002 2018A: Differential Equations 23 / 30

Direction field for y ′ = y − x

The idea is to start anywhere on the direction field and simplyfollow the arrows:

This graphical technique is useful for getting qualitativeinformation about solutions of differential equations, especiallywhen they cannot be integrated.

D. DeTurck Math 104 002 2018A: Differential Equations 24 / 30

Here a a couple for you to try.

y ′ = 2(y − y 2) y ′ = 3x sin(2y)

D. DeTurck Math 104 002 2018A: Differential Equations 25 / 30

Numerical methods

Another way to gain insight into solutions of differential equationsis to use numerical methods to approximate them. The simplestnumerical method is called Euler’s method .

Euler’s method is easy to understand if you relate it to two thingsyou already know:

1 The left endpoint (rectangle) method for estimating integrals,and

2 The fundamental theorem of calculus.

Or, you can think of Euler’s method in terms of differentials:

y(x + ∆x) ≈ y(x) + y ′(x)∆x

D. DeTurck Math 104 002 2018A: Differential Equations 26 / 30

Euler’s method

You can algebraically manipulate most first-order equations to bein the form

y ′(x) = F (x , y).

Euler’s method then combines the formula for the differentialapproximation with the differential equation:

y(x + ∆x) ≈ y(x) + F (x , y)∆x .

In Euler’s method, we simply ignore the small approximation errorsand repeatedly use this equation with a small value of ∆x togenerate a table of values of y(x), starting from a given initialvalue. The table can then be used to create a graph of thesolution, for instance.

D. DeTurck Math 104 002 2018A: Differential Equations 27 / 30

An Example: The initial-value problem y = y − x ,y(0) = 2

This is the example we graphed before. We will choose ∆x = 0.1.The choice of ∆x is often dictated by the problem or situation.The smaller ∆x is the more accurate the approximate solution willbe, but of course you will need to do more work to cover aninterval of given length.

For the first step, we have from the initial values that x = 0 andy = 2, and therefore y ′ = 2− 0 = 2 at that point. Euler’s methodthen tells us that:

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

y(0.1) = 1 + 0.1 (2− 0) = 1.2

D. DeTurck Math 104 002 2018A: Differential Equations 28 / 30

Continue. . .

For the second step, we have x = 0.1 and y = 2.2, thereforey ′ = 2.2− 0.1 = 2.1 at that point. Euler’s method then gives:

y(0.2) = 2.2 + (0.1)2.1 = 2.41.

We continue in this manner (Excel is really good for this) and fillin the following table:

D. DeTurck Math 104 002 2018A: Differential Equations 29 / 30

Comparison with exact solution of y ′ = y − x , y(0) = 2

Since y ′ = y − x is a linear equation, we can solve it and get thatthe exact solution of the initial-value problem is

y(x) = x + 1 + ex

and so y(1) = 2 + e = 4.718281828 . . ..

So the Euler’s method approximation y(1) ≈ 4.5937 . . . is prettyclose (certainly within 10%). We could do better by decreasing∆x , but of course then we would need more steps to reach x = 1.

You get to try a couple of these on this week’s homework.

D. DeTurck Math 104 002 2018A: Differential Equations 30 / 30