Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

3.2: First order linear equations

This page is a draft and is under active development. 

( \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 can't be written like this is nonlinear. We say that (???) is homogenous if f0; otherwise it's nonhomogeneous.

Since y0 is obviously a solution of the homogeneous equation y+p(x)y=0, we call it the trivial solution. Any other solution is nontrivial.

Example 3.2.1

The first order equations

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

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

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

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 (???) defines a one--parameter family of functions. For each real number c, the function defined by (???) is a solution of (???) on (,0) and (0,); moreover, every solution of (???) on either of these intervals is of the form (???) for some choice of c. We say that (???) is the general solution of (???).

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 (???) that involves x and a parameter c and has these properties:

For each fixed value of c, the resulting function of x is a solution of (???) on (a,b). If y is a solution of (???) 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 (???). 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 (???) in the form (???) with p=P1/P0 and f=F/P0, which are both continuous on (a,b).

To avoid awkward wording in examples and exercises, we won't 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 (???), or on which P0, P1, and F are continuous and P0 has no zeros, if the equation is of the form (???). 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 (???) 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 won't discuss it further.

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 3.2.2

Let a be a constant.

a) Find the general solution of yay=0.

b) Solve the initial value problem yay=0,y(x0)=y0

Answer

a) You already know from calculus that if c is any constant, then y=ceax satisfies (???). 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 (???) has the trivial solution 0. Now suppose y is a nontrivial solution of (???). Then, since a differentiable function must be continuous, there must be some open interval I on which y has no zeros.

We rewrite (???) as yy=a 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={ekif y>0,ekif y<0.

This shows that every nontrivial solution of (???) is of the form y=ceax for some nonzero constant c. Since setting c=0 yields the trivial solution, all solutions of (???) are of the form (3.2.9). Conversely, (3.2.9) is a solution of (???) for every choice of c, since differentiating (3.2.9) yields y=aceax=ay. Figure 3.2.1 shows the graphs of some solutions corresponding to various values of c

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

Fig 3.2.1.png
Figure 3.2.1: yay=0 with various values of a

Example 3.2.3

a) Find the general solution of xy+y=0.

b) Solve the initial value problem xy+y=0,y(1)=3.

Answer

a) We rewrite (???) as y+1xy=0, where x is restricted to either (,0) or (0,). If

y is a nontrivial solution of (3.2.12), there must be some open interval I on which y has no zeros. We can rewrite (3.2.12) 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={ekif y>0,ekif y<0.

We've now shown that every solution of (3.2.12) is given by (3.2.13) for some choice of c. (Even though we assumed that y was nontrivial to derive (3.2.13), we can get the trivial solution by setting c=0 in (3.2.13).) Conversely, any function of the form (3.2.13) is a solution of (3.2.12), since differentiating (3.2.13) yields y=cx2, and substituting this and (3.2.13) into (3.2.12) yields

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

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

Fig 3.2.2.png
Figure 3.2.2: xy+y=0 with various values of c

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

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

The results in Example 3 are special cases of the next theorem.

Theorem 3.2.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.

Proof

If y=ceP(x), differentiating y and using (???) 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 (???), for any choice of c.

Now we'll show that any solution of (???) 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 (???) as yy=p(x) for x in I. Integrating (3.2.17) and recalling (???) 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) 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).

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. In rewriting (???) as (3.2.17). We'll apply this method to nonlinear equations in Section 3.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 (???) 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 (???) 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 then y=uy1+uy1. Substituting these expressions for y and y into (???) 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 3.2.1 we saw that y1 has no zeros on an interval where p is continuous. Therefore we can divide (???) 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 (???). Before turning to the formal proof of this claim, let's consider some examples.

Example 3.2.4:

Find the general solution of y+2y=x3e2x.

Answer

By applying part(a) of Example 3.2.3 with a=2, we see that y1=e2x is a solution of the complementary equation y+2y=0. Therefore we seek solutions of (???) in the form y=ue2x, so that y=ue2x2ue2x and y+2y=ue2x2ue2x+2ue2x=ue2x

Therefore y is a solution of (???) if and only if ue2x=x3e2x or, equivalently, u=x3.

Therefore u=x44+c and y=ue2x=e2x(x44+c) is the general solution of (???).

Figure 3.2.3 shows some integral curves for (???).

clipboard_eac8f2f91836174747880936105a4465c.png
Figure 3.2.3: Some solutions to y+2y=x3e2x

Example 3.2.5:

(a) Find the general solution y+(cotx)y=xcscx.

(b) Solve the initial value problem y+(cotx)y=xcscx,y(π/2)=1.

Answer

(a) 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 (???) 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 (3.2.24). Clearly y1=1/sinx is a suitable choice. Therefore we seek solutions of (???) in the form y=usinx, so that y=usinxucosxsin2x

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

Therefore y is a solution of (???) if and only if usinx=xcscx=xsinx or, equivalently, u=x.

Integrating this yields

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

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

(b) Imposing the initial condition y(π/2)=1 in (3.2.27) yields 1=π28+c or c=1π28.

Thus,y=x22sinx+(1π2/8)sinx is a solution of (???). The interval of validity of this solution is (0,π);

Figure 3.2.4 shows its graph.

clipboard_e30374dfd27db3253d6a8503f0ff1c307.png
Figure 3.2.4: y+cot(x)y=xcsc(x)

It wasn't necessary to do the computations (3.2.25) and (3.2.26) in Example 3.2.5 since we showed in the discussion preceding Example 3.2.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:

(a) Find a function y1 such that y1y1=p(x).

For convenience, take the constant of integration to be zero.

(b) Write y=uy1 to remind yourself of what you're doing.

(c) Write uy1=f and solve for u; thus, u=f/y1.

(d) Integrate u to obtain u, with an arbitrary constant of integration.

(e) Substitute u into (???) 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 (???) 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 3.2.6:

(a) Find the general solution of y2xy=1.

(b) Solve the initial value problem y2xy=1,y(0)=y0.

Answer

(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,|y1|=ex2.

We choose y1=ex2 and seek solutions of (???) in the form y=uex2, where uex2=1,u=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 (???) is y=uex2=ex2(c+ex2dx).

(b) Since the initial condition in (???) is imposed at x0=0, it is convenient to rewrite (3.2.31) as y=ex2(c+x0et2dt),00et2dt=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 (???).

Figure~??? shows graphs of (3.2.32) for several values of y0.

\begin{figure}[H]

\centering

\scalebox{.9}{

\includegraphics[bb=-78 148 689 643,width=5.67in,height=3.66in,keepaspectratio]{fig020105} }

\color{blue}

\caption{Solutions of $y'-2xy=1$, $y(0)=y_{0}$}

\label{figure:2.1.5}

\end{figure}

An Existence and Uniqueness Theorem

The method of variation of parameters leads to this theorem.

Theorem 3.2.2

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:

(a) 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)

(b) 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 (???) is the general solution of (???) on (a,b), we must prove that:

(i) If c is any constant, the function y in (???) is a solution of (???) on (a,b).

(ii) If y is a solution of (???) on (a,b) then y is of the form (???) for some constant c.

To prove \part{i}, we first observe that any function of the form (???) is defined on (a,b), since p and f are continuous on (a,b). Differentiating (???) yields y=y1(x)(c+f(x)/y1(x)dx)+f(x).

Since y1=p(x)y1, this and (???) 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 (???).

To prove \part{ii}, suppose y is a solution of (???) on (a,b). From the proof of Theorem~???, 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+fy1=py1,

\begin {eqnarray*}u'&=&{y_1y'-y_1'y\over y_1^2}\\&=&{y_1(-py+f)-(-py_1)y\over y_1^2}={f\over y_1}\end{eqnarray*}

Integrating u=f/y1 yields u=(c+f(x)/y1(x)dx), which implies (???), since y=uy1.

(b) We've proved \part{a}, where f(x)/y1(x)dx in (???) is an arbitrary antiderivative of f/y1. Now it's convenient to choose the antiderivative that equals zero when x=x0, and write the general solution of (???) 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).


3.2: First order linear equations is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by LibreTexts.

Support Center

How can we help?