Unit 9, lesson 118

First-Order Linear Differential Equations

How to solve y' + P(x)y = Q(x) with an integrating factor or by variation of the parameter, and why every such problem with continuous coefficients has exactly one solution on the whole interval.

  • Theory part 235
  • Practice part 236
  • Solution Methods

A tank that drains in proportion to how full it is while being refilled at a varying rate, a body that cools toward a changing room temperature, a current pushed by a time dependent voltage. All of these lead to the same kind of equation, where the unknown appears only to the first power. For this class there is a complete recipe that always works.

Key terms

Linear equation in standard form

Definition A first order linear differential equation is one that can be written in the standard form

y′+P(x) y=Q(x),y' + P(x)\,y = Q(x),

where PP and QQ are functions of xx alone. Throughout, PP and QQ are assumed continuous on an open interval II. An equation a(x)y′+b(x)y=c(x)a(x)y' + b(x)y = c(x) is put in standard form by dividing by a(x)a(x), which is allowed only on intervals where a(x)≠0a(x) \neq 0.

In plain words The unknown yy and its derivative appear on their own, never squared, never inside a function like sin⁡y\sin y and never multiplied together.

Example The equation xy′+2y=4x2xy' + 2y = 4x^2 is linear. Dividing by xx gives y′+2xy=4xy' + \frac{2}{x}y = 4x, with P(x)=2xP(x) = \frac{2}{x} and Q(x)=4xQ(x) = 4x, valid on (0,∞)(0, \infty) or on (−∞,0)(-\infty, 0) but not across x=0x = 0. The equation y′+y2=xy' + y^2 = x is not linear.

Homogeneous and nonhomogeneous equations

Definition The equation y′+P(x)y=Q(x)y' + P(x)y = Q(x) is homogeneous if Q(x)=0Q(x) = 0 for all xx in II and nonhomogeneous otherwise. The homogeneous equation y′+P(x)y=0y' + P(x)y = 0 has general solution

yh=Ce−∫P(x) dx.y_h = Ce^{-\int P(x)\,dx}.

If ypy_p is any one solution of the nonhomogeneous equation, then every solution is y=yp+yhy = y_p + y_h.

In plain words First solve the problem with no forcing. Then any single solution of the full problem, plus all the solutions of the unforced one, gives you everything.

Example For y′+3y=6y' + 3y = 6, the constant yp=2y_p = 2 works, since 0+6=60 + 6 = 6. The homogeneous equation y′+3y=0y' + 3y = 0 gives yh=Ce−3xy_h = Ce^{-3x}. So the general solution is y=2+Ce−3xy = 2 + Ce^{-3x}. The difference of any two solutions solves y′+3y=0y' + 3y = 0, which is why nothing else can occur.

Reverse product rule

Definition By the product rule, for differentiable functions μ\mu and yy,

(μy)′=μy′+μ′y.\left(\mu y\right)' = \mu y' + \mu' y.

If the left side of an equation already has the form μy′+μ′y\mu y' + \mu' y, it can be integrated at once.

In plain words Sometimes the left side of an equation is secretly the derivative of a product. Spotting that turns the problem into a single integration.

Example For x2y′+2xy=cos⁡xx^2 y' + 2xy = \cos x, the left side is (x2y)′\left(x^2 y\right)'. So x2y=sin⁡x+Cx^2 y = \sin x + C, and on (0,∞)(0, \infty) or on (−∞,0)(-\infty, 0)

y=sin⁡x+Cx2.y = \frac{\sin x + C}{x^2}.

Integrating factor

Definition For y′+P(x)y=Q(x)y' + P(x)y = Q(x) with PP continuous on II, the function

μ(x)=e∫P(x) dx\mu(x) = e^{\int P(x)\,dx}

(any fixed antiderivative will do) is an integrating factor. It is positive and satisfies μ′=Pμ\mu' = P\mu, so multiplying the equation by μ\mu gives (μy)′=μQ\left(\mu y\right)' = \mu Q. Hence

y=1μ(x)(∫μ(x)Q(x) dx+C).y = \frac{1}{\mu(x)}\left(\int \mu(x)Q(x)\,dx + C\right).

In plain words Multiply by a cleverly chosen function so that the left side becomes the derivative of μy\mu y, then integrate both sides.

Example Solve y′−2xy=xy' - 2xy = x. Here P(x)=−2xP(x) = -2x, so μ=e−x2\mu = e^{-x^2} and

(e−x2y)′=xe−x2⟹e−x2y=−12e−x2+C⟹y=−12+Cex2.\left(e^{-x^2}y\right)' = xe^{-x^2} \quad\Longrightarrow\quad e^{-x^2}y = -\frac{1}{2}e^{-x^2} + C \quad\Longrightarrow\quad y = -\frac{1}{2} + Ce^{x^2}.

As a check, y′=2Cxex2y' = 2Cxe^{x^2} and

y′−2xy=2Cxex2+x−2Cxex2=x.y' - 2xy = 2Cxe^{x^2} + x - 2Cxe^{x^2} = x.

Variation of the parameter

Definition Let yhy_h be a nowhere zero solution of the homogeneous equation on II, for example

yh(x)=e−∫P(x) dx.y_h(x) = e^{-\int P(x)\,dx}.

Look for a solution of the form y=u(x) yh(x)y = u(x)\,y_h(x). Substituting and using yh′+Pyh=0y_h' + Py_h = 0 leaves

u′(x) yh(x)=Q(x),sou(x)=∫Q(x)yh(x) dx+C.u'(x)\,y_h(x) = Q(x), \qquad\text{so}\qquad u(x) = \int \frac{Q(x)}{y_h(x)}\,dx + C.

For the choice above 1yh=μ\frac{1}{y_h} = \mu, so this gives the same formula as the integrating factor.

In plain words Take the homogeneous solution CyhCy_h and let the constant CC become a function. The equation then tells you exactly which function.

Example Solve y′+y=exy' + y = e^x. Here yh=e−xy_h = e^{-x}, so u′e−x=exu'e^{-x} = e^x, which means u′=e2xu' = e^{2x} and u=12e2x+Cu = \frac{1}{2}e^{2x} + C. Then

y=(12e2x+C)e−x=12ex+Ce−x.y = \left(\frac{1}{2}e^{2x} + C\right)e^{-x} = \frac{1}{2}e^{x} + Ce^{-x}.

Initial conditions and the existence theorem

Definition If PP and QQ are continuous on an open interval II, x0x_0 is in II and y0y_0 is any real number, then the problem

y′+P(x)y=Q(x),y(x0)=y0y' + P(x)y = Q(x), \qquad y(x_0) = y_0

has exactly one solution, and it is defined on all of II. That solution is

y(x)=1μ(x)(y0+∫x0xμ(t)Q(t) dt),μ(x)=e∫x0xP(t) dt.y(x) = \frac{1}{\mu(x)}\left(y_0 + \int_{x_0}^{x}\mu(t)Q(t)\,dt\right), \qquad \mu(x) = e^{\int_{x_0}^{x} P(t)\,dt}.

In plain words Linear equations never blow up on their own. The solution lasts as long as the coefficients stay continuous, and the starting value fixes the constant.

Example Solve xy′+2y=4x2xy' + 2y = 4x^2, y(1)=2y(1) = 2. On I=(0,∞)I = (0, \infty) the standard form is y′+2xy=4xy' + \frac{2}{x}y = 4x, and μ=e2ln⁡x=x2\mu = e^{2\ln x} = x^2. Then (x2y)′=4x3\left(x^2 y\right)' = 4x^3, so x2y=x4+Cx^2 y = x^4 + C and y=x2+Cx2y = x^2 + \frac{C}{x^2}. From y(1)=1+C=2y(1) = 1 + C = 2 we get C=1C = 1, so

y=x2+1x2,x>0.y = x^2 + \frac{1}{x^2}, \qquad x > 0.

The interval is (0,∞)(0, \infty) because it is the largest interval containing x0=1x_0 = 1 on which P(x)=2xP(x) = \frac{2}{x} is continuous.

Check yourself

  1. Solve y′+2y=4y' + 2y = 4 with y(0)=5y(0) = 5.
Show the answer

The integrating factor μ=e2x\mu = e^{2x} gives (e2xy)′=4e2x\left(e^{2x}y\right)' = 4e^{2x}, so e2xy=2e2x+Ce^{2x}y = 2e^{2x} + C and y=2+Ce−2xy = 2 + Ce^{-2x}. Then y(0)=2+C=5y(0) = 2 + C = 5, so y=2+3e−2xy = 2 + 3e^{-2x}.

  1. Solve y′+1xy=3xy' + \frac{1}{x}y = 3x for x>0x > 0.
Show the answer

The integrating factor is μ=x\mu = x, so (xy)′=3x2(xy)' = 3x^2 and xy=x3+Cxy = x^3 + C. The general solution is y=x2+Cxy = x^2 + \frac{C}{x} on (0,∞)(0, \infty).

  1. On what interval is the solution of (x−3)y′+y=sin⁡x(x - 3)y' + y = \sin x, y(1)=0y(1) = 0 guaranteed to exist?
Show the answer

In standard form P(x)=1x−3P(x) = \frac{1}{x - 3} and Q(x)=sin⁡xx−3Q(x) = \frac{\sin x}{x - 3}, both continuous except at x=3x = 3. The interval containing x0=1x_0 = 1 is (−∞,3)(-\infty, 3).

How this lesson connects