1. Linear Equations; Method of Integrating Factors

The General Case

A linear, first-order ordinary differential equation has the form

((d y)/(d x))+P(x)y=Q(x),

where P and Q are functions that are continuous on an open interval I.  The idea behind Integrating Factors is to find a function μ(x), such that

μ(x)·((d y)/(d x))+μ(x)P(x)y(x)=(d/(d x))[μ(x)y(x)].   (1)

Then the differential equation can be written as

(d/(d x))[μ(x)y(x)]=μ(x)Q(x),

and the family of solutions would be

y(x)=(1/(μ(x)))∫μ(x)Q(x)dx.

Ok.  Let’s go back and see what μ(x) must be.  First expand

(d/(d x))[μ(x)y(x)]=μ'(x)y(x)+μ(x)y'(x)

and compare with (1) above.  Simplifying, we get

μ'(x)=P(x)μ(x).

We can solve this equation for μ as follows

((d μ)/μ)=P(x) d x ⇒ ∫(1/μ)dμ=∫P(x)dx ⇒ Log[μ]=∫P(x)dx.

So the integrating factor is given by

μ(x)=Exp[∫P(x)dx].

Examples

Example 1.  The population growth with harvesting equation:

((d P)/(d t))=r P-h.

Example 2.

x y'(x)-y(x)=(x^3).

2. Separable Equations

In the previous section we considered linear, first-order equations.  In that case there was a method, or procedure, to find a family of solutions.  Namely,

y'(x) + P(x) y(x) = Q(x) ⇒ y(x) = (1/(μ(x)))∫μ(x)Q(x)dx,

where μ(x) = exp(∫P(x)dx).

In general, for nonlinear first-order differential equations, there are no set ways of finding the family of equations.  In the sections that follow we will look at some particular cases that, sometimes, have solution techniques.  A first-order, ordinary differential equation has the form,

y'(x) = f(x,y(x)).

We can rewrite this equation in the form,

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

where f(x,y) = -((M(x,y) )/(N(x,y))).  This is always possible.  For example, set N(x.y)=1 and then M(x,y) = -f(x,y).

Now consider the case where M(x,y) = M(x) and N(x,y) = N(y), then the differential equation becomes,

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

This is called “separable” and has a family of solutions, given implicitly by

∫M(x)dx + ∫N(y)dy = C,

where C is an arbitrary constant.  A first-order differential equation is separable if it can be written in the above form, or the form,

y'(x) = G(x) H(y).

Examples

Example 1.	y' = ((x^2)/y).

In this example, it is straight forward to rewrite the equation in a separable form, namely

y dy = (x^2) dx.

Now integrate both sides to get

(1/2)(y^2) = (1/3)(x^3) + C ⇔ 2(x^3) - 3(y^2) = C.

We could use Mathematica to graph some of these solutions as follows:

ContourPlot[2(x^3)-3(y^2),{x,-5,5},{y,-5,5},
Contours->{-100,-75,-50,-25,0,25,50,75,100},
PlotLegends->Automatic,
Axes->True, AxesLabel->{"x","y"},
FrameLabel->"Implicit Solutions"]

Example 2. 	y' = (x^2)(1 + (y^2)).

Again, we can rewrite this equation as

(dy/(1+(y^2))) = (x^2) dx.

Integrating both sides gives

ArcTan[y] = (1/3)(x^3) + C ⇔ y(x)=Tan[(1/3)(x^3) + C].

Notice that in this case, we could solve for the dependent variable explicitly.

We will work the following examples in class.

Example 3.	y' = ((2x)/(y + (x^2)y)), with y(0) = -2.

Example 4.	x dx + y (e^(-x)) dy = 0, with y(0) = 1.

2.3 Modeling with First-Order Equations

In this section we look at how differential equations are built to model physical situations.  Since derivatives are mathematical operators that represent instantaneous rates of change, we use differential equations to model how things change.

Example: Isotopes are called radioactive if they are unstable.  That is, there are some elements that can not maintain their integrity due to having a high number of neutrons or protons relative to the atomic forces involved in the isotope.  Some types of radioactive materials that are common known are uranium, plutonium, and carbon-14.  In each of these materials, there is a probability that any one atom will “decay” by releasing neutrons and/or protons to become a more stable atom.

Overall, with radioactive decay, the rate of change in the amount of the material is proportional to the amount of material present.  That is, if Q is the amount of radioactive material at time t, then

(dQ/dt) = -r Q, with Q(0) = (Subscript[Q, 0])

forms the initial value problem that models the situation.  Note that for different types of materials the value of r, the “decay rate” differs.  Also note that we explicitly indicate that the rate of change is negative.  That is, both Q and r are assumed to be positive and the negative sign is used in the equation to indicate that the amount of material is decreasing.

For this equation, it is easy to see that the solution is

Q(t) = (Subscript[Q, 0])Exp[-r t].

One common way to classify radioactive materials is to refer to it’s “half-life”.  That is the time it takes for half of the material to decay.  Half-life is given by solving for τ in the equation Q(τ) = (1/2)(Subscript[Q, 0]).

Example: Exponential growth.  One example of exponential growth is continuous compound interest.  Here the rate of change in the account (due to interest) is proportional to the amount of money in the account.  If A is the amount of money in the account at time t and P is the initial investment, then the initial value problem that models this is

(dA/dt) = r A, with A(0)=P.

The solution to this problem is the familiar A = P (e^(r t)), where r is the interest rate and t is measured in years.  As a side note, recall that if the investment is compounded n times per year, then A = P (((1+(r/n)))^(n t)).  The connection between compound interest and continuous compound interest is made when you recall that (lim_(n->∞)) (((1+(1/n)))^n) = e.

Example: Mixing.  See page 52 - 54 in the book.

In a mixing problem, the volume of fluid in a container is modeled by (dV/dt)=rate in - rate out, with the initial volume of (Subscript[V, 0]).  In the case where the rate in and the rate out are the same, then the volume of the fluid in the container remains constant, namely V(t) = (Subscript[V, 0]).

Now consider a situation where we are adding a dissolved material to the container in the fluid.  Then the amount of the dissolved material in the tank changes in a similar fashion, (dQ/dt) = rate in - rate out, where the rate in is the concentration of the dissolved material in the solution being poured in times the volume per unit time of the solution being poured in the container.  The rate out is the concentration of the dissolved material in the tank times the volume per unit time leaving the container.

For instance, consider the following problem:

Mixing Problem:

Suppose that a sugar solution of 0.1 grams per milliliter of water is being added to a container at a rate of 5 milliliters per minute.  The container starts with 100 milliliters of solution that has 15 grams of dissolved sugar in it and 5 milliliters of solution is being drawn out of the container per minute.  What is the concentration of sugar in the container after 10 minutes?  What will the amount of sugar approach as t->∞ ?  Assume that the solution is well mixed, i.e. we always have a uniform concentration of solution in the container.

To answer these questions we need to model the amount of sugar in the container as a function of time (in minutes).  If we let V be the volume of solution in the container and Q be the quantity of sugar in the container.  Then the initial conditions would be

Q(0) = 15 grams, and V(0) = 100 ml of solution.

The rate of sugar entering the container would be

rate in = (((0.1 grams)/ml))(((5 ml)/minute)),

The rate of sugar leaving the container would be

rate out = (((Q grams)/(100 ml)))(((5 ml)/minute)).

Note that the volume of solution in the container remains constant at 100 ml because the volume in is the same as the volume out.  So the concentration of sugar in the container is Q(t)/100 grams per milliliter.  Putting this together gives the differential equation that models the amount of sugar in the container as

(dQ/dt)=(1/2)-(1/20)Q.

This is separable and linear, first-order, so you should be able to verify by hand that

DSolve[{Q'[t]==1/2-Q[t]/20,Q[0]==15},Q[t],t]

Now to answer the questions that were asked.

sugar[t_]=5 (E^(-t/20)) (1+2 (E^(t/20)))

N[sugar[10]]

So at after 10 minutes the concentration of sugar in the container is 0.13 grams per milliliter.  Why?

Limit[sugar[t],t->∞]

So the amount of sugar in the container approaches 10 grams as t->∞.

2.4 Differences Between Linear and Nonlinear Equations.

There are several differences between linear first-order ordinary differential equations and nonlinear first-order ODE’s.  In this section we point out a few of those differences.

For linear first-order ODE’s, y'+P(x) y=Q(x), y((Subscript[x, 0]))=(Subscript[y, 0]), there is a solution form:

y(x)=(1/(μ(x)))((∫_(Subscript[x, 0])^x)μ(s)Q(s)ds+(Subscript[y, 0])), where μ(x)=exp[(∫_(Subscript[x, 0])^x)P(s)ds].

For nonlinear ODE’s we have no such form.

Theorem:  Suppose that f(x,y) and (Subscript[f, y])(x,y) are continuous in some rectangle a<x<b, c<y<d containing the point ((Subscript[x, 0]),(Subscript[y, 0])).  Then there exists h>0 with a<(Subscript[x, 0])-h<x<(Subscript[x, 0])+h<b such that y=ϕ(x) is a unique solution to the initial value problem y'=f(x,y), y((Subscript[x, 0]))=(Subscript[y, 0]) on the interval (Subscript[x, 0])-h<x<(Subscript[x, 0])+h.

Example:	y'=(y^(1/5)), y(0)=0.

Note that this IVP does not satisfy the above theorem.  While solutions to this IVP exist, there are in fact an infinite number of solutions.  Use separation of variables to show that the IVP has the following solutions:

y(x)=((4/5)(x^(5/4))) and also y(x)=-((4/5)(x^(5/4))).

Also note that y(x)=0 is a solution to the IVP and that

y(x)=({{{, ({{0, ,0⩽x<a}, {±((4/5)(((x-a))^(5/4)), ,a⩽x}})}})

are all solution for any positive choice of a.

Interval of definition:

Linear: depends on P and Q.  That is, the interval of definition is the largest open interval containing (Subscript[x, 0]) such that both P and Q are continuous on the interval.

Nonlinear: can not be determined from the DE.

Example:	y'=1+(y^2), y(0)=0.

Use separation of variables to show that the DE has the family of solutions y(x)=Tan[x+C].  Then the IC ⇒ C=0, ±π, ±2π,... .  Since tangent is π periodic, the choice of the constant does not matter.  That is, the IVP has a unique solution.  However, that solution is only differentiable on the interval -(π/2)<x<(π/2), but the DE is well defined everywhere.

General Solutions:

Linear: we get one general solution (family of solutions) for all particular solutions to the IVP.

Nonlinear: a general solution may not result in a solution to a particular IVP.

Implicit vs Explicit:

Linear: generates explicit solutions to the IVP.

Nonlinear: if a solution exists, it might not have an explicit form.

Numerical Approximations:

Linear: plays nice with approximating algorithms.

Nonlinear: may not play nice with algorithms, even if a unique solution exists.

2.5 Autonomous Equations and Population Dynamics

An autonomous DE is one where the independent variable does not appear except possibly in the denominator using Leibniz notation.  For first order equations, that is:

(dy/dx)=f(y) or F(y,y')=0.

Several population models are autonomous.

Malthusian Growth Model

Here the rate of change in the population is proportional to the population:

P'=r P,  P(0)=(Subscript[P, 0]),

where r is a constant.  Note that t, the independent variable does not appear in the DE.  This IVP has a solution of

P(t)=(Subscript[P, 0])(e^(r t)).

The only equilibrium solution for this model is the extinction solution, P(t)=0, which only happens when the initial condition is zero.

Logistic Growth Model

This model adds a “competition” term to the Malthusian model.

P'=r P-a (P^2),  P(0)=(Subscript[P, 0]).

Often this model is rewritten in the following way where k is called the carrying capacity for the population:

P'=r P(1-(P/k)).

This equation has equilibrium solutions given by P(t)=0 and P(t)=k.  Note that for both of those solutions, P'=0.  The direction field for r=0.3 and k=2 is:

points=Table[{0,0.2*j},{j,-3,15}];
VectorPlot[
{1, 0.3y(1-y/2)}, {x, -1, 10}, {y, -1, 3.2},
FrameLabel->{t,P},
Axes->True,
VectorScale->{Small, Small, None},
VectorStyle->Gray,
StreamPoints->points,
StreamStyle->{Blue, Thick, "Line"},
StreamScale->Full,
PlotLabel->"Direction Field For Logistic Model",
Epilog->{PointSize[Large],Red, Point[points]}
]

Note that the stream lines move away from the extinction equilibrium and towards the nontrivial equilibrium.  We classify these two behaviors as being “unstable” for the P(t)=0 solution and “locally asymptotically stable” for the nontrivial equilibrium.

Logistic with a Threshold

If k>T, then

P'=r P(1-(P/k))((P/T)-1),  P(0)=(Subscript[P, 0]).

If r=0.3, k=2.4, and T=1, then the direction field looks like:

points={{0,-0.8},{0,0},{0,0.6},{0,1},{0,1.4},{0,2.4},{0,3}};
VectorPlot[
{1, 0.3y(1-y/2.4)(y-1)}, {x, -1, 10}, {y, -1, 3.2},
FrameLabel->{t,P},
Axes->True,
VectorScale->{Small, Small, None},
VectorStyle->Gray,
StreamPoints->points,
StreamStyle->{Blue, Thick, "Line"},
StreamScale->Full,
PlotLabel->"Direction Field For Logistic Model with Threshold",
Epilog->{PointSize[Large],Red, Point[points]}
]

Here the P(t)=0, and P(t)=k are locally asymptotically stable and P(t)=T is unstable.

More Examples will be covered in class.

2.6 Exact Equations and Integrating Factors

In this section we will be looking at a class of first-order ODE’s for which the solution is given implicitly by

ψ(x,y)=C,

where C is an arbitrary constant.  To start our discussion, we first state (without proof) some results from Multivariable Calculus:

Theorem (C1):  F(x,y) is said to be differentiable at ((Subscript[x, 0]),(Subscript[y, 0])) if

F((Subscript[x, 0])+Δx,(Subscript[y, 0])+Δy)=F((Subscript[x, 0]),(Subscript[y, 0])) + (Subscript[F, x])((Subscript[x, 0]),(Subscript[y, 0]))Δx + (Subscript[F, y])((Subscript[x, 0]),(Subscript[y, 0]))Δy + (Subscript[ϵ, 1])Δx + (Subscript[ϵ, 2])Δy

where ((Subscript[ϵ, 1]),(Subscript[ϵ, 2]))⟶(0,0) as (Δx,Δy)⟶(0,0).

This theorem is the basses for directional derivatives, linear approximations, and the chain rule for multivariable calculus.  Another way of saying this is in differential form:

dF=(Subscript[F, x])(x,y) dx + (Subscript[F, y])(x,y) dy.

The second result that we need from multivariable calculus is the following:

Theorem (C2): Suppose that M and N are differentiable functions in an open rectangle R={(x,y):a<x<b,c<y<d}, and that (Subscript[M, y])=(Subscript[N, x]) in R, then there exist F such that (Subscript[F, x])=M and (Subscript[F, y])=N in R.

Now back to DE land.

Theorem: Suppose that M and N are differentiable functions in an open rectangle R={(x,y):a<x<b,c<y<d} and that (Subscript[M, y])=(Subscript[N, x]) in R,then the differential equation

M(x,y)+N(x,y) y'=0

is said to be exact and a family of implicit solutions exist of the form ψ(x,y)=C, where C is a constant and

(Subscript[ψ, x])=M and (Subscript[ψ, y])=Nin R.

Note that if ψ(x,y)=C, then differentiate both side by x to get (Subscript[ψ, x])(x,y) + (Subscript[ψ, y])(x,y) (dy/dx)=0.

Example:  (2x (y^2)+ 2x) + (2(x^2)y + 2y) y'=0.

In this case, M(x,y)=2x (y^2)+2x and N(x,y)=2(x^2)y+2y.  Then we have

(Subscript[M, y])(x,y)=4x y  and  (Subscript[N, x])(x,y)=4x y.

So the DE is exact and a family of solutions exists of the form ψ(x,y)=C, where

(Subscript[ψ, x])=M=2x (y^2)+2x  and  (Subscript[ψ, y])=N=2(x^2)y+2y.

If we integrate the first equations with respect to x (thinking of y as a constant), then

ψ(x,y)=(x^2)(y^2)+(x^2)+K(y),

where K(y) is the “constant” of integration with respect to x.  Now take a partial with respect to y

(Subscript[ψ, y])=2(x^2)y+K'(y)

and compare it to the second equations above to get that K'(y)=2y and then K(y)=(y^2).  Thus the solution to the DE is

(x^2)(y^2)+(x^2)+(y^2)=C.

Example:  ((e^x)Cos[y]+(e^(2y))Cos[x]) dx - ((e^x)Sin[y]-2(e^(2y))Sin[x]-3) dy =0.  To be done in class.

Integrating factors

Suppose that the DE M(x,y) dx + N(x,y) dy = 0 is not exact.  We may be able to use an integrating factor to make it exact.  That is, find μ(x,y) so that

μ M dx + μ N dy = 0

is exact.  That means that (Subscript[(μ M), y])=(Subscript[(μ N), x]) or

(Subscript[μ, y])M+μ (Subscript[M, y])=(Subscript[μ, x])N+μ (Subscript[N, x]).

In general, this is hard to solve, so we will look at some special cases:  where μ is a function of only one variable either x or y, but not both.  For example, if μ is a function of only x, then the above equation reduces to

μ (Subscript[M, y])=(Subscript[μ, x])N+μ (Subscript[N, x]) ⟹ ((dμ)/dx)=(((Subscript[M, y])-(Subscript[N, x]))/N)μ.

So, if (((Subscript[M, y])-(Subscript[N, x]))/N) is a function of x only, then we can solve the linear, first-order equation for μ.

Similarly, if μ is a function of y only then

((dμ)/dy)=(((Subscript[N, x])-(Subscript[M, y]))/M)μ.

So, if (((Subscript[N, x])-(Subscript[M, y]))/M) is a function of y only, then we can solve for μ.

Example:  (3(x^2)y+2x y+(y^3)) dx+((x^2)+(y^2)) dy =0.  To be done in class.