← Back to Math 055

2.3 Linear Equations: Class Notes

2.3a

Definition

A first-order differential equation of the form a1(x)dydx+a0(x)y=g(x) is a linear equation in y (the dependent variable). This is put into standard form by dividing both sides by a1(x) to obtain

dydx+P(x)y=f(x)

The function g(x) is called the input function or forcing function. A term such as yy′ would make an equation nonlinear.

Example

Consider the DE 3dydx+12y=4. In standard form, this is dydx+4y=43.

If we multiply both sides by e4x, we get

e4xdydx+4e4xy=43e4x

Aside: differentiate e4xy with respect to x. First, a second aside to recall how this works.

Second aside: implicit differentiation

Consider x2y3+4xy2=5, where y is a function of x. Differentiate the first term with the product rule (uv)′=u′v+uv′:

ddx(x2y3)=2xy3+3x2y2dydx

The factor dydx=y′ comes from the chain rule, because y depends on x.

In the same way, by the product rule,

ddx[e4xy]=e4xdydx+4e4xy

This is exactly the left side of the equation above, so the equation can be written as ddx[e4xy]=43e4x. Integrate both sides with respect to x:

∫ddx[e4xy]dx=∫43e4xdxe4xy=13e4x+C

Answer: y=13+Ce−4x

e4x is called an integrating factor.

Where did e4x come from?

For the equation in standard form

dydx+P(x)y=f(x),(*)

suppose we have some function μ(x) (μ is the Greek letter mu) such that when we multiply both sides of (*) by μ(x), we get

μdydx+μPy=μf(x)

If it happens that dμdx=μP, then the left side becomes

μdydx+dμdxy=μf(x)

and by the product rule, μy′+μ′y=ddx(μy). Then we have

ddx(μy)=μf(x).

To find μ, solve the separable equation

dμdx=μP⇒∫dμμ=∫P(x)dx⇒ln⁡|μ|=∫P(x)dx

Answer: μ(x)=e∫P(x)dx(integrating factor)

Tip: A constant of integration is not necessary when finding or using an integrating factor: e∫Pdx+C1=eC1e∫Pdx, and any constant multiple of an integrating factor works just as well.

2.3b

Example

Find the general solution of the given differential equation. Give the largest interval I over which the general solution is defined. Determine whether there are any transient terms in the general solution.

y′+2xy=x3

Solution

This is a linear DE, so use an integrating factor. P(x)=2x, so

μ=e∫P(x)dx=e∫2xdx=ex2

Multiply both sides by ex2. The left side has the form μy′+μ′y:

ex2y′+2xex2y=x3ex2ddx(ex2y)=x3ex2ex2y=∫x3ex2dx

Integrate by parts with u=x2, dv=xex2dx, so du=2xdx, v=12ex2:

ex2y=12x2ex2−∫xex2dxex2y=12x2ex2−12ex2+C

Answer: y=12x2−12+Ce−x2

12x2−12 is the steady-state solution. The term Ce−x2 goes to 0 as x→∞, so it is a transient term.

Interval: (−∞,∞). Transient term: Ce−x2.

Example

(1+x)dydx−xy=x+x2

Solution

Standard form: divide by 1+x, using x+x2=x(1+x):

dydx−x1+xy=x

So P(x)=−x1+x. Write the numerator as x+1−1 to split the fraction:

−∫x+1−11+xdx=−∫(1−1x+1)dx=ln⁡|x+1|−x

μ=eln⁡|x+1|−x=eln⁡|x+1|e−x=(x+1)e−x

(Here we take x>−1, so |x+1|=x+1.) Multiply by μ and integrate:

∫ddx[(x+1)e−xy]dx=∫(x2+x)e−xdx

Integrate by parts with u=x2+x, dv=e−xdx, so du=(2x+1)dx, v=−e−x:

(x+1)e−xy=−(x2+x)e−x+∫(2x+1)e−xdx

Integrate by parts again with u=2x+1, dv=e−xdx, so du=2dx, v=−e−x:

(x+1)e−xy=−(x2+x)e−x−(2x+1)e−x−2e−x+C

Combine −(2x+1)−2=−(2x+3) and divide by (x+1)e−x:

Answer: y=−x−2x+3x+1+Cexx+1

No transient terms. The solution is defined on (−∞,−1)∪(−1,∞); the interval of solution is (−1,∞).

2.3c

Example

xy′+(1+x)y=e−xsin⁡2x

Solution

Steps

1. Put the equation in standard form.

2. Find and use μ.

3. Integrate.

4. Isolate y.

Standard form (divide by x):

y′+(1x+1)y=sin⁡2xxex

μ=e∫(1x+1)dx=eln⁡x+x=xex

Multiplying by xex turns the right side into xex·sin⁡2xxex=sin⁡2x:

ddx[xexy]=sin⁡2xxexy=−12cos⁡2x+C

Answer: y=−12xe−xcos⁡2x+Cxe−x

Interval of solution: (0,∞). It's all transient: both terms go to 0 as x→∞.

Example

dPdt+2tP=P+4t−2

Solution

Here the independent variable is t and the dependent variable is P. Move the P term to the left to get standard form:

dPdt+(2t−1)P=4t−2

μ=e∫(2t−1)dt=et2−t

Multiply both sides by et2−t. The left side has the form μP′+μ′P:

et2−tP′+(2t−1)et2−tP=(4t−2)et2−tddt[et2−tP]=(4t−2)et2−t=2(2t−1)et2−t

Integrate with the substitution u=t2−t, so du=(2t−1)dt:

∫ddt[et2−tP]dt=∫2(2t−1)et2−tdtet2−tP=2et2−t+C

Answer: P(t)=2+Cet−t2

Transient term: Cet−t2. Interval: (−∞,∞).

Example

(x2−1)dydx+2y=(x+1)2

Solution

The equation is linear if its standard form is dydx+P(x)y=f(x). Divide by x2−1=(x+1)(x−1):

dydx+2x2−1y=x+1x−1

So P(x)=2x2−1. To find ∫P(x)dx, use partial fractions:

2(x+1)(x−1)=Ax+1+Bx−1⇒2=A(x−1)+B(x+1)

Setting x=−1 gives A=−1. Setting x=1 gives B=1.

μ=e∫(1x−1−1x+1)dx=eln⁡|x−1|−ln⁡|x+1|=eln⁡|x−1x+1|=x−1x+1

(On the interval (1,∞), x−1x+1 is positive, so the absolute value can be dropped.) Multiply the standard form by μ:

x−1x+1dydx+x−1x+1·2x2−1⏟μ′y=x−1x+1·x+1x−1

The left side is μy′+μ′y=ddx[μy] and the right side simplifies to 1:

∫ddx[x−1x+1y]dx=∫1dxx−1x+1y=x+C

Answer: y=x2+xx−1+C(x+1)x−1

No transient terms. Interval: (1,∞).

2.3d

Example

Solve the given initial-value problem. Use a graphing utility to graph the continuous function y(x).

(1+x2)dydx+2xy=f(x),y(0)=0, where

f(x)={x,0≤x<1−x,x≥1

Solution

(A graphing utility is a program such as Desmos or GeoGebra.) Solve the DE separately on each piece of f. Standard form on each piece:

0≤x<1:dydx+2x1+x2y=x1+x2

x≥1:dydx+2x1+x2y=−x1+x2

Both pieces have the same integrating factor:

μ=e∫2x1+x2dx=eln⁡(1+x2)=1+x2

For 0≤x<1:

ddx[(1+x2)y]=x(1+x2)y=12x2+C1y=x22(1+x2)+C11+x2

For x≥1:

ddx[(1+x2)y]=−x(1+x2)y=−12x2+C2y=−x22(1+x2)+C21+x2

The initial condition is at x=0, which is in the first piece: y(0)=0⇒C1=0. So

y={x22(1+x2),0≤x<1−x22(1+x2)+C21+x2,x≥1

To find C2, use the requirement that y is continuous, so y is continuous at x=1.

Recall

f is continuous at a if limx→af(x)=f(a), and limx→af(x) exists when limx→a−f(x)=limx→a+f(x).

At x=1, the formula on the left and the formula on the right must give the same limit:

limx→1−y=limx→1+y⇒14=−14+C22⇒C2=1

With C2=1, the second formula becomes −x22(1+x2)+11+x2=2−x22(1+x2):

Answer: y={x22(1+x2),0≤x<12−x22(1+x2),x≥1

Graph of the continuous piecewise solution, rising from 0 to one fourth at x = 1, then decreasing

For 0≤x<1, the graph rises from the origin to (1,14). For x≥1, it decreases from (1,14), crosses the x-axis at x=2, and levels off toward y=−12. The two pieces meet at (1,14) with a corner, so y is continuous but not differentiable there.