Differential Equations · Undergraduate

First-Order Linear Equations and Integrating Factors

Quick answer

A first-order linear differential equation has the form y′ + p(x)y = q(x). Most cannot be separated, but all can be solved the same way. Multiply both sides by the integrating factor μ(x) = e^∫p(x)dx. The left side then becomes the derivative of a single product, (μy)′, so integrating both sides and dividing by μ gives y. The general solution always has one constant, which an initial condition fixes.

What you'll learn

  • Recognize a first-order linear equation and put it in standard form
  • Find the integrating factor e^∫p dx
  • Solve the equation by integrating (μy)′ = μq
  • Use an initial condition to find the constant

An equation that will not separate

Separable equations let us move all the yys to one side and all the xxs to the other. An equation such as

y′+2xy=xy' + 2xy = x

will separate, but y′+y=xy' + y = x will not: the right side x−yx - y is not a product of a function of xx and a function of yy. Both belong to a broad family, the first-order linear equations:

y′+p(x) y=q(x)y' + p(x)\,y = q(x)

Every equation in this family can be solved by the same method.

The integrating factor

Multiply both sides by a function μ(x)\mu(x), still to be chosen:

μy′+μp y=μq\mu y' + \mu p\,y = \mu q

Compare the left side with the product rule, (μy)′=μy′+μ′y(\mu y)' = \mu y' + \mu' y. They match if μ′=pμ\mu' = p\mu, and that equation is separable: μ=e∫p(x) dx\mu = e^{\int p(x)\,dx}. With this integrating factor,

(μy)′=μq⟹μy=∫μq dx+C⟹y=1μ(∫μq dx+C)(\mu y)' = \mu q \qquad\Longrightarrow\qquad \mu y = \int \mu q\,dx + C \qquad\Longrightarrow\qquad y = \frac{1}{\mu}\left(\int \mu q\,dx + C\right)

Why it works

The obstacle in y′+pyy' + py is that yy and y′y' appear separately, so neither side can be integrated directly. The integrating factor is chosen precisely so that the two terms combine into one derivative, the derivative of μy\mu y. After that, solving is a single integration. The trick is the product rule read backward, the same idea as integration by parts.

Worked examples

Common mistakes

Practice problems

  1. Solve y′+3y=6y' + 3y = 6.

    Answer

    y=2+Ce−3xy = 2 + Ce^{-3x}

    Full solution

    μ=e3x\mu = e^{3x}: (e3xy)′=6e3x(e^{3x}y)' = 6e^{3x}, so e3xy=2e3x+Ce^{3x}y = 2e^{3x} + C.

  2. Solve y′−2y=4y' - 2y = 4 with y(0)=1y(0) = 1.

    Answer

    y=−2+3e2xy = -2 + 3e^{2x}

    Full solution

    μ=e−2x\mu = e^{-2x}: (e−2xy)′=4e−2x(e^{-2x}y)' = 4e^{-2x}, so e−2xy=−2e−2x+Ce^{-2x}y = -2e^{-2x} + C and y=−2+Ce2xy = -2 + Ce^{2x}. Then C=3C = 3.

  3. Solve y′+y=xy' + y = x.

    Answer

    y=x−1+Ce−xy = x - 1 + Ce^{-x}

    Full solution

    (exy)′=xex(e^xy)' = xe^x. By parts, ∫xex dx=(x−1)ex+C\int xe^x\,dx = (x - 1)e^x + C.

  4. Solve y′+2xy=xy' + 2xy = x.

    Answer

    y=12+Ce−x2y = \tfrac{1}{2} + Ce^{-x^2}

    Full solution

    μ=ex2\mu = e^{x^2}: (ex2y)′=xex2(e^{x^2}y)' = xe^{x^2}, which integrates to 12ex2+C\tfrac{1}{2}e^{x^2} + C.

  5. Solve y′+ytan⁡x=cos⁡xy' + y\tan x = \cos x for −π2<x<π2-\tfrac{\pi}{2} < x < \tfrac{\pi}{2}.

    Answer

    y=(x+C)cos⁡xy = (x + C)\cos x

    Full solution

    μ=e∫tan⁡x dx=e−ln⁡cos⁡x=sec⁡x\mu = e^{\int\tan x\,dx} = e^{-\ln\cos x} = \sec x. Then (ysec⁡x)′=cos⁡xsec⁡x=1(y\sec x)' = \cos x\sec x = 1, so ysec⁡x=x+Cy\sec x = x + C.

  6. Solve y′+y=e−xy' + y = e^{-x}.

    Answer

    y=(x+C)e−xy = (x + C)e^{-x}

    Full solution

    (exy)′=1(e^xy)' = 1, so exy=x+Ce^xy = x + C.

  7. Which of these are first-order linear: y′=x2yy' = x^2y, y′=y2y' = y^2, xy′+y=sin⁡xxy' + y = \sin x?

    Answer

    The first and third

    Full solution

    y′−x2y=0y' - x^2y = 0 and y′+1xy=sin⁡xxy' + \tfrac{1}{x}y = \tfrac{\sin x}{x} fit the form. y′=y2y' = y^2 has yy squared.

  8. A student solves xy′+2y=10x3xy' + 2y = 10x^3 with μ=e2x\mu = e^{2x}. What went wrong?

    Answer

    The equation was not divided by xx first; the correct factor is μ=x2\mu = x^2.

    Full solution

    In standard form the coefficient of yy is p=2xp = \tfrac{2}{x}, so ∫p dx=2ln⁡x\int p\,dx = 2\ln x and μ=x2\mu = x^2.

Frequently asked questions

What is a first-order linear differential equation?

One that can be written y′ + p(x)y = q(x), where p and q depend only on x. The unknown y and its derivative appear only to the first power and are not multiplied together.

What is an integrating factor?

The function μ(x) = e^∫p(x)dx. Multiplying the equation by it makes the left side the derivative of the product μy.

Why does the integrating factor work?

By the product rule, (μy)′ = μy′ + μ′y. Choosing μ with μ′ = pμ makes that exactly μ(y′ + py), the left side times μ.

Do I need a constant when finding the integrating factor?

No. Any one integrating factor works, so leave out the constant in ∫p dx. The constant that matters appears when you integrate μq.

What if the equation is not in standard form?

Divide by the coefficient of y′ first. For xy′ + 2y = 10x³, divide by x to get y′ + (2/x)y = 10x².

What to learn next