Skip to content

Linear Differential Equations

In this lesson you’ll learn the integrating factor method for solving first-order linear differential equations. This handles equations that aren’t separable.

A first-order linear DE has the standard form

dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)\,y = Q(x)

The trick is to multiply both sides by an integrating factor that turns the left side into the derivative of a product.

The integrating factor is

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

Here’s what each piece means:

  • μ(x) (the Greek letter mu) is the integrating factor itself. It’s a function of x that you’ll multiply through the entire equation. The name “integrating factor” comes from the fact that it makes the equation integrable.
  • e is Euler’s number (approximately 2.718), the base of the natural exponential.
  • ∫ P(x) dx is the antiderivative of P(x), the coefficient of y in the standard form. You don’t need a constant of integration here because any antiderivative works (the constant would just multiply through and cancel).
  • The whole expression says: take the coefficient of y, integrate it, then raise e to that result. That’s your multiplier.

After multiplying through by this factor, the left side becomes the derivative of a product. Quick refresher on the product rule from Calculus 1: the derivative of two functions multiplied together is

ddx[uv]=uv+uv\frac{d}{dx}[u \cdot v] = u'\,v + u\,v'

The integrating factor is specifically designed so that the left side of the equation matches this pattern in reverse. After multiplying, you get

ddx[μ(x)y]=μ(x)Q(x)\frac{d}{dx}\left[\mu(x)\,y\right] = \mu(x)\,Q(x)

Integrate both sides and solve for y

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

The whole method boils down to: find the integrating factor, multiply, recognize the product rule, integrate, solve.

Example 1: Basic linear equation

Solve dy/dx + 2y = 4x.

Here P(x) = 2 and Q(x) = 4x. The integrating factor is

μ(x)=e2dx=e2x\mu(x) = e^{\int 2\,dx} = e^{2x}

Multiply both sides by e^(2x)

e2xdydx+2e2xy=4xe2xe^{2x}\frac{dy}{dx} + 2e^{2x}y = 4xe^{2x}

The left side is the derivative of the product

ddx[e2xy]=4xe2x\frac{d}{dx}\left[e^{2x}y\right] = 4xe^{2x}

Integrate both sides. The right side needs integration by parts with u = 4x, dv = e^(2x) dx

4xe2xdx=4(xe2x2e2x4)=2xe2xe2x\int 4xe^{2x}\,dx = 4\left(\frac{x\,e^{2x}}{2} - \frac{e^{2x}}{4}\right) = 2xe^{2x} - e^{2x}

So

e2xy=2xe2xe2x+Ce^{2x}y = 2xe^{2x} - e^{2x} + C

Divide both sides by e^(2x)

y=2x1+Ce2xy = 2x - 1 + Ce^{-2x}

The term 2x - 1 is the steady-state behavior, and Ce^(-2x) is a transient that decays to zero as x grows. No matter what C is, the solution eventually looks like y = 2x - 1.

Example 2: Initial value problem

Solve dy/dx + (1/x)y = x with y(1) = 0, for x > 0.

Here P(x) = 1/x and Q(x) = x. The integrating factor is

μ(x)=e(1/x)dx=elnx=x\mu(x) = e^{\int (1/x)\,dx} = e^{\ln x} = x

Multiply both sides by x

xdydx+y=x2x\frac{dy}{dx} + y = x^2

The left side is the derivative of xy

ddx[xy]=x2\frac{d}{dx}[xy] = x^2

Integrate both sides

xy=x33+Cxy = \frac{x^3}{3} + C

Divide by x

y=x23+Cxy = \frac{x^2}{3} + \frac{C}{x}

Apply the initial condition y(1) = 0

0=13+CC=130 = \frac{1}{3} + C \quad \Rightarrow \quad C = -\frac{1}{3}

The specific solution is

y=x2313xy = \frac{x^2}{3} - \frac{1}{3x}

The curve passes through (1, 0) and grows roughly like x²/3 for large x. Near x = 0 the -1/(3x) term dominates and the function drops toward negative infinity, but our solution only applies for x > 0 starting from x = 1.

Example 3: Mixing problem

A 100-liter tank initially contains pure water. Brine with 3 g/L of salt flows in at 5 L/min, and the well-mixed solution flows out at 5 L/min. Find the amount of salt A(t) in the tank at time t.

Salt comes in at 3 times 5 = 15 g/min. Salt leaves at (A/100) times 5 = A/20 g/min. The DE is

dAdt=15A20\frac{dA}{dt} = 15 - \frac{A}{20}

Rewrite in standard form

dAdt+120A=15\frac{dA}{dt} + \frac{1}{20}A = 15

The integrating factor is

μ(t)=e(1/20)dt=et/20\mu(t) = e^{\int (1/20)\,dt} = e^{t/20}

Multiply and integrate

ddt[et/20A]=15et/20\frac{d}{dt}\left[e^{t/20}A\right] = 15e^{t/20} et/20A=1520et/20+C=300et/20+Ce^{t/20}A = 15 \cdot 20\,e^{t/20} + C = 300e^{t/20} + C A(t)=300+Cet/20A(t) = 300 + Ce^{-t/20}

At t = 0, A = 0 (pure water), so C = -300

A(t)=300(1et/20)A(t) = 300\left(1 - e^{-t/20}\right)

The salt amount approaches 300 g (which is 3 g/L times 100 L) as t goes to infinity. The exponential term decays with a time constant of 20 minutes.

Linear DEs with integrating factors model situations where something accumulates or decays with a forcing term:

  • Mixing problems (salt, chemicals, pollutants flowing through tanks)
  • RC circuits (voltage across a capacitor with a driving signal)
  • Population models with constant immigration
  • Drug concentration in the bloodstream with continuous dosing
  • Game design: resource pools that fill and drain simultaneously
The standard form of a first-order linear DE is
The integrating factor for $\frac{dy}{dx} + 2y = 4x$ is
After multiplying by the integrating factor, the left side becomes
In the mixing problem, the salt amount $A(t)$ approaches
The integrating factor for $\frac{dy}{dx} + \frac{1}{x}y = x$ is