Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

2.1: Linear First Order Equations

( \newcommand{\kernel}{\mathrm{null}\,}\)

A first order differential equation is said to be linear if it can be written as

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

A first order differential equation that cannot be written like this is nonlinear. We say that Equation ??? is homogeneous if f0; otherwise it is nonhomogeneous. Since y0 is obviously a solution of the homgeneous equation

y+p(x)y=0,

we call it the trivial solution. Any other solution is nontrivial.

Example 2.1.1

The first order equations

x2y+3y=x2xy8x2y=sinxxy+(lnx)y=0y=x2y2

are not in the form in Equation ???, but they are linear, since they can be rewritten as

y+3x2y=1y8xy=sinxxy+lnxxy=0yx2y=2

Example 2.1.2

Here are some nonlinear first order equations:

xy+3y2=2x (because y is squared) yy=3 (because of the product yy)y+xey=12 (because of ey)

General Solution of a Linear First Order Equation

To motivate a definition that we’ll need, consider the simple linear first order equation

y=1x2.

From calculus we know that y satisfies this equation if and only if

y=1x+c,

where c is an arbitrary constant. We call c a parameter and say that Equation ??? defines a one–parameter family of functions. For each real number c, the function defined by Equation ??? is a solution of Equation ??? on (,0) and (0,); moreover, every solution of Equation ??? on either of these intervals is of the form Equation ??? for some choice of c. We say that Equation ??? is the general solution of Equation ???.

We’ll see that a similar situation occurs in connection with any first order linear equation

y+p(x)y=f(x);

that is, if p and f are continuous on some open interval (a,b) then there’s a unique formula y=y(x,c) analogous to Equation ??? that involves x and a parameter c and has the these properties:

  • For each fixed value of c, the resulting function of x is a solution of Equation ??? on (a,b).
  • If y is a solution of Equation ??? on (a,b), then y can be obtained from the formula by choosing c appropriately.

We’ll call y=y(x,c) the general solution of Equation ???.

When this has been established, it will follow that an equation of the form

P0(x)y+P1(x)y=F(x)

has a general solution on any open interval (a,b) on which P0, P1, and F are all continuous and P0 has no zeros, since in this case we can rewrite Equation ??? in the form Equation ??? with p=P1/P0 and f=F/P0, which are both continuous on (a,b).

To avoid awkward wording in examples and exercises, we will not specify the interval (a,b) when we ask for the general solution of a specific linear first order equation. Let’s agree that this always means that we want the general solution on every open interval on which p and f are continuous if the equation is of the form Equation ???, or on which P0, P1, and F are continuous and P0 has no zeros, if the equation is of the form Equation ???. We leave it to you to identify these intervals in specific examples and exercises.

For completeness, we point out that if P0, P1, and F are all continuous on an open interval (a,b), but P0 does have a zero in (a,b), then Equation ??? may fail to have a general solution on (a,b) in the sense just defined. Since this isn’t a major point that needs to be developed in depth, we will not discuss it further; however, see Exercise 2.1.44 for an example.

Homogeneous Linear First Order Equations

We begin with the problem of finding the general solution of a homogeneous linear first order equation. The next example recalls a familiar result from calculus.

Example 2.1.3

Let a be a constant.

  1. Find the general solution of yay=0.
  2. Solve the initial value problem yay=0,y(x0)=y0.
Solution a

(a) You already know from calculus that if c is any constant, then y=ceax satisfies Equation ???. However, let’s pretend you’ve forgotten this, and use this problem to illustrate a general method for solving a homogeneous linear first order equation.

We know that Equation ??? has the trivial solution y0. Now suppose y is a nontrivial solution of Equation ???. Then, since a differentiable function must be continuous, there must be some open interval I on which y has no zeros. We rewrite Equation ??? as

yy=a

fig020101.svg
Figure 2.1.1 : Solutions of yay=0, y(0)=1

for x in I. Integrating this shows that

ln|y|=ax+k,so|y|=ekeax,

where k is an arbitrary constant. Since eax can never equal zero, y has no zeros, so y is either always positive or always negative. Therefore we can rewrite y as

y=ceax

where

c={ekify>0,ekify<0.

This shows that every nontrivial solution of Equation ??? is of the form y=ceax for some nonzero constant c. Since setting c=0 yields the trivial solution, all solutions of Equation ??? are of the form Equation ???. Conversely, Equation ??? is a solution of Equation ??? for every choice of c, since differentiating Equation ??? yields y=aceax=ay.

Solution b

Imposing the initial condition y(x0)=y0 yields y0=ceax0, so c=y0eax0 and

y=y0eax0eax=y0ea(xx0).

Figure 2.1.1 show the graphs of this function with x0=0, y0=1, and various values of a.

Example 2.1.4
  1. Find the general solution of xy+y=0.
  2. Solve the initial value problem xy+y=0,y(1)=3.
Solution a

We rewrite Equation ??? as

y+1xy=0,

where x is restricted to either (,0) or (0,). If y is a nontrivial solution of Equation ???, there must be some open interval I on which y has no zeros. We can rewrite Equation ??? as

yy=1x

for x in I. Integrating shows that

ln|y|=ln|x|+k,so|y|=ek|x|.

Since a function that satisfies the last equation can’t change sign on either (,0) or (0,), we can rewrite this result more simply as

y=cx

where

c={ekify>0,ekify<0.

We have now shown that every solution of Equation ??? is given by Equation ??? for some choice of c. (Even though we assumed that y was nontrivial to derive Equation ???, we can get the trivial solution by setting c=0 in Equation ???.) Conversely, any function of the form Equation ??? is a solution of Equation ???, since differentiating Equation ??? yields

y=cx2,

and substituting this and Equation ??? into Equation ??? yields

y+1xy=cx2+1xcx=cx2+cx2=0.

Figure 2.1.2 shows the graphs of some solutions corresponding to various values of c

Solution b

Imposing the initial condition y(1)=3 in Equation ??? yields c=3. Therefore the solution of Equation ??? is

y=3x.

The interval of validity of this solution is (0,).

The results in Examples 2.1.3a and 2.1.4b are special cases of the next theorem.

Theorem 2.1.1

If p is continuous on (a,b), then the general solution of the homogeneous equation

y+p(x)y=0

on (a,b) is

y=ceP(x),

where

P(x)=p(x)dx

is any antiderivative of p on (a,b); that is ,

P(x)=p(x),a<x<b

fig020102.svg
Figure 2.1.2 : Solutions of xy+y=0 on (0,) and (,0)
Proof

If y=ceP(x), differentiating y and using Equation ??? shows that

y=P(x)ceP(x)=p(x)ceP(x)=p(x)y,

so y+p(x)y=0; that is, y is a solution of Equation ???, for any choice of c.

Now we’ll show that any solution of Equation ??? can be written as y=ceP(x) for some constant c. The trivial solution can be written this way, with c=0. Now suppose y is a nontrivial solution. Then there’s an open subinterval I of (a,b) on which y has no zeros. We can rewrite Equation ??? as

yy=p(x)

for x in I. Integrating Equation ??? and recalling Equation ??? yields

ln|y|=P(x)+k,

where k is a constant. This implies that

|y|=ekeP(x).

Since P is defined for all x in (a,b) and an exponential can never equal zero, we can take I=(a,b), so y has zeros on (a,b) (a,b), so we can rewrite the last equation as y=ceP(x), where

c={ekif y>0 on (a,b),ekif y<0 on (a,b).

REMARK: Rewriting a first order differential equation so that one side depends only on y and y and the other depends only on x is called separation of variables. We did this in Examples 2.1.3 and 2.1.4 , and in rewriting Equation ??? and Equation ???​. We will apply this method to nonlinear equations in Section 2.2.

Linear Nonhomogeneous First Order Equations

We’ll now solve the nonhomogeneous equation

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

When considering this equation we call

y+p(x)y=0

the complementary equation.

We’ll find solutions of Equation ??? in the form y=uy1, where y1 is a nontrivial solution of the complementary equation and u is to be determined. This method of using a solution of the complementary equation to obtain solutions of a nonhomogeneous equation is a special case of a method called variation of parameters, which you’ll encounter several times in this book. (Obviously, u can’t be constant, since if it were, the left side of Equation ??? would be zero. Recognizing this, the early users of this method viewed u as a “parameter” that varies; hence, the name “variation of parameters.”)

If

y=uy1,theny=uy1+uy1.

Substituting these expressions for y and y into Equation ??? yields

uy1+u(y1+p(x)y1)=f(x),

which reduces to

uy1=f(x),

since y1 is a solution of the complementary equation; that is,

y1+p(x)y1=0.

In the proof of Theorem 2.2.1 we saw that y1 has no zeros on an interval where p is continuous. Therefore we can divide Equation ??? through by y1 to obtain

u=f(x)/y1(x).

We can integrate this (introducing a constant of integration), and multiply the result by y1 to get the general solution of Equation ???. Before turning to the formal proof of this claim, let’s consider some examples.

Example 2.1.5

Find the general solution of

y+2y=x3e2x.

By applying a of Example 2.1.3 with a=2, we see that y1=e2x is a solution of the complementary equation y+2y=0. Therefore we seek solutions of Equation ??? in the form y=ue2x, so that

y=ue2x2ue2xandy+2y=ue2x2ue2x+2ue2x=ue2x.

Therefore y is a solution of Equation ??? if and only if

ue2x=x3e2xor, equivalently,u=x3.

Therefore

u=x44+c,

fig020103.svg
Figure 2.1.3 : A direction field and integral curves for y+2y=x2e2x

and

y=ue2x=e2x(x44+c)

is the general solution of Equation ???.

Figure 2.1.3 shows a direction field and some integral curves for Equation ???.

Example 2.1.6

Find the general solution

y+(cotx)y=xcscx.

Solve the initial value problem

y+(cotx)y=xcscx,y(π/2)=1.

Solution

Here p(x)=cotx and f(x)=xcscx are both continuous except at the points x=rπ, where r is an integer. Therefore we seek solutions of Equation ??? on the intervals (rπ,(r+1)π). We need a nontrival solution y1 of the complementary equation; thus, y1 must satisfy y1+(cotx)y1=0, which we rewrite as

y1y1=cotx=cosxsinx.

Integrating this yields

ln|y1|=ln|sinx|,

where we take the constant of integration to be zero since we need only one function that satisfies Equation ???. Clearly y1=1/sinx is a suitable choice. Therefore we seek solutions of Equation ??? in the form

y=usinx,

so that

y=usinxucosxsin2x

and

y+(cotx)y=usinxucosxsin2x+ucotxsinx=usinxucosxsin2x+ucosxsin2x=usinx.

Therefore y is a solution of Equation ??? if and only if

u/sinx=xcscx=x/sinxor, equivalently,u=x.

Integrating this yields

u=x22+c, andy=usinx=x22sinx+csinx.

is the general solution of Equation ??? on every interval (rπ,(r+1)π) ( r=integer).

b. Imposing the initial condition y(π/2)=1 in Equation ??? yields

1=π28+c orc=1π28.

Thus,

y=x22sinx+(1π2/8)sinx

is a solution of Equation ???. The interval of validity of this solution is (0,π); Figure 2.1.4 shows its graph.

fig020104.svg
Figure 2.1.4 : Solution of y+(cotx)y=xcscx,y(π/2)=1

REMARK: It wasn’t necessary to do the computations ??? and ??? in Example 2.1.6 , since we showed in the discussion preceding Example 2.1.5 that if y=uy1 where y1+p(x)y1=0, then y+p(x)y=uy1. We did these computations so you would see this happen in this specific example. We recommend that you include these “unnecesary” computations in doing exercises, until you’re confident that you really understand the method. After that, omit them.

We summarize the method of variation of parameters for solving

y+p(x)y=f(x)

as follows:

  1. Find a function y1 such that y1y1=p(x).
    For convenience, take the constant of integration to be zero.
  2. Write y=uy1
    to remind yourself of what you’re doing.
  3. Write uy1=f and solve for u; thus, u=f/y1.
  4. Integrate u to obtain u, with an arbitrary constant of integration.
  5. Substitute u into Equation ??? to obtain y.

To solve an equation written as

P0(x)y+P1(x)y=F(x),

we recommend that you divide through by P0(x) to obtain an equation of the form Equation ??? and then follow this procedure.

Solutions in Integral Form

Sometimes the integrals that arise in solving a linear first order equation can’t be evaluated in terms of elementary functions. In this case the solution must be left in terms of an integral.

Example 2.1.7

Find the general solution of

y2xy=1.

Solve the initial value problem

y2xy=1,y(0)=y0.

Solution

a. To apply variation of parameters, we need a nontrivial solution y1 of the complementary equation; thus, y12xy1=0, which we rewrite as

y1y1=2x.

Integrating this and taking the constant of integration to be zero yields

ln|y1|=x2,so|y1|=ex2.

We choose y1=ex2 and seek solutions of Equation ??? in the form y=uex2, where

uex2=1,sou=ex2.

Therefore

u=c+ex2dx,

but we can’t simplify the integral on the right because there’s no elementary function with derivative equal to ex2. Therefore the best available form for the general solution of Equation ??? is

y=uex2=ex2(c+ex2dx).

b. Since the initial condition in Equation ??? is imposed at x0=0, it is convenient to rewrite Equation ??? as

y=ex2(c+x0et2dt),since00et2dt=0

Setting x=0 and y=y0 here shows that c=y0. Therefore the solution of the initial value problem is

y=ex2(y0+x0et2dt).

For a given value of y0 and each fixed x, the integral on the right can be evaluated by numerical methods. An alternate procedure is to apply the numerical integration procedures discussed in Chapter 3 directly to the initial value problem Equation ???. Figure 2.1.5 shows graphs of of Equation ??? for several values of y0.

fig020105.svg
Figure 2.1.5 : Solution of y2xy=1,y(0)=y0

An Existence and Uniqueness Theorem

The method of variation of parameters leads to this theorem.

Theorem 2.1.2 Existence and Uniqueness Theorem

Suppose p and f are continuous on an open interval (a,b), and let y1 be any nontrivial solution of the complementary equation

y+p(x)y=0

on (a,b). Then:

  1. The general solution of the nonhomogeneous equation y+p(x)y=f(x)
    on (a,b) is y=y1(x)(c+f(x)/y1(x)dx).
  2. If x0 is an arbitrary point in (a,b) and y0 is an arbitrary real number , then the initial value problem y+p(x)y=f(x),y(x0)=y0
    has the unique solution y=y1(x)(y0y1(x0)+xx0f(t)y1(t)dt)
    on (a,b).
Proof

(a) To show that Equation ??? is the general solution of Equation ??? on (a,b), we must prove that:

  1. If c is any constant, the function y in Equation ??? is a solution of Equation ??? on (a,b).
  2. If y is a solution of Equation ??? on (a,b) then y is of the form Equation ??? for some constant c.

To prove (i), we first observe that any function of the form Equation ??? is defined on (a,b), since p and f are continuous on (a,b). Differentiating Equation ??? yields

y=y1(x)(c+f(x)/y1(x)dx)+f(x).

Since y1=p(x)y1, this and Equation ??? imply that

y=p(x)y1(x)(c+f(x)/y1(x)dx)+f(x)=p(x)y(x)+f(x),

which implies that y is a solution of Equation ???.

To prove (ii), suppose y is a solution of Equation ??? on (a,b). From the proof of Theorem 2.1.1, we know that y1 has no zeros on (a,b), so the function u=y/y1 is defined on (a,b). Moreover, since

y=py+fandy1=py1,

u=y1yy1yy21=y1(py+f)(py1)yy21=fy1.

Integrating u=f/y1 yields

u=(c+f(x)/y1(x)dx),

which implies Equation ???, since y=uy1.

(b) We’ve proved (a), where f(x)/y1(x)dx in Equation ??? is an arbitrary antiderivative of f/y1. Now it is convenient to choose the antiderivative that equals zero when x=x0, and write the general solution of Equation ??? as

y=y1(x)(c+xx0f(t)y1(t)dt).

Since

y(x0)=y1(x0)(c+x0x0f(t)y1(t)dt)=cy1(x0),

we see that y(x0)=y0 if and only if c=y0/y1(x0).


This page titled 2.1: Linear First Order Equations is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by William F. Trench.

Support Center

How can we help?