Differential Equations: Topic 4 of 10

The Integrating
Factor Method

A single clever function μ(x) (multiplied onto both sides of your ODE) transforms a messy equation into a perfect derivative. One elegant idea that solves an entire class of first-order equations.

Full derivation 10 worked examples 5-step strategy
Share this page

§ 01The Problem — Why Separation Isn't Always Enough

Separable equations let you move all the y terms to one side and all the x terms to the other. But what happens when y appears mixed with a function of x in a way that cannot be separated?

Consider the equation dy/dx + 2xy = x. You cannot write this as f(y) dy = g(x) dx because the term 2xy mixes x and y inseparably. This equation belongs to the class of first-order linear ODEs: the most important and most common class of first-order differential equations in applications.

The standard form of a first-order linear ODE is:

Standard Form — First-Order Linear ODE
dy/dx + P(x)·y = Q(x)

Here P(x) and Q(x) are any continuous functions of x. When Q(x) = 0 the equation is called homogeneous and can be solved by separating variables directly. The interesting, and harder, case is when Q(x) ≠ 0, which is called the non-homogeneous case. The integrating factor is the key to unlocking it.

What makes an ODE "linear"? A first-order ODE is linear if y and dy/dx each appear to the first power, with no products like y·(dy/dx) or powers like y². The coefficients of y and dy/dx can be any functions of x. Examples of linear ODEs: dy/dx + 3y = ex, dy/dx − (sin x)y = x². Non-linear counter-example: dy/dx + y² = x (the y² makes it non-linear).

Real-World Motivation: Newton's Law of Cooling

When a cup of coffee cools in a room held at temperature Troom = 20°C, Newton's Law of Cooling gives the ODE:

Newton's Law of Cooling
dT/dt + k·T = k·Troom

Here T is the temperature at time t, and k > 0 is a cooling constant. This is a first-order linear ODE in standard form with P(t) = k and Q(t) = k·Troom. The integrating factor method solves it in four clean steps: and we will come back to this example later.

§ 02Derivation — Where Does μ(x) = e∫P dx Come From?

The integrating factor is not a magic trick: it falls out of one simple idea: the product rule for differentiation, run in reverse.

Start with the standard form equation:

Step 0 — Start here
dy/dx + P(x)·y = Q(x)

Now ask: is there a function μ(x) such that, when we multiply both sides by μ(x), the left-hand side becomes a perfect derivative of the form d/dx[μ(x)·y]? That would let us integrate both sides immediately.

Expand d/dx[μ·y] using the product rule:

Product Rule Expansion
d/dx[μ·y] = μ·(dy/dx) + (dμ/dx)·y

Now multiply the original ODE through by μ:

Multiply through by μ
μ·(dy/dx) + μ·P(x)·y = μ·Q(x)

Comparing the two boxed expressions: the left-hand sides match if and only if dμ/dx = μ·P(x). This is a separable ODE for μ itself:

ODE for the integrating factor
dμ/dx = μ·P(x)

(1/μ) dμ = P(x) dx

∫(1/μ) dμ = ∫P(x) dx

ln|μ| = ∫P(x) dx

μ(x) = e∫P(x) dx

We drop the constant of integration here because any particular μ will do, adding a constant would just scale μ, which cancels out when we divide at the end.

With this choice of μ, the left-hand side of the multiplied equation is exactly d/dx[μ·y], and so:

The key collapse
d/dx[μ(x)·y] = μ(x)·Q(x)

μ(x)·y = ∫μ(x)·Q(x) dx

y = (1/μ(x)) · ∫μ(x)·Q(x) dx

This single formula contains the entire method. Everything that follows is an application of these four algebraic moves: compute μ, multiply through, integrate, divide by μ.

Why e∫P dx and not something simpler? The exponential function is the only function whose derivative is proportional to itself: d/dx[ef] = f′·ef. This is precisely the property that makes dμ/dx = μ·P(x) solvable with a clean exponential answer. The product rule and the exponential function are tailor-made for each other.

§ 03The 5-Step Strategy

Every first-order linear ODE can be solved by the same five moves, in the same order, every time.

Integrating Factor — 5-Step Method

1
Write in standard form
Rearrange so the equation reads dy/dx + P(x)·y = Q(x). Divide through by any coefficient on dy/dx if necessary. Identify P(x) and Q(x) explicitly before doing anything else.
2
Compute the integrating factor
Calculate μ(x) = e∫P(x) dx. You only need one antiderivative of P — omit the +C. Simplify μ as much as possible (e.g. eln x = x).
3
Multiply both sides by μ(x)
The left-hand side must now equal d/dx[μ·y]. Always verify this by expanding the product rule — it confirms you have the right μ before proceeding.
4
Integrate both sides with respect to x
The left side integrates to μ(x)·y. The right side gives ∫μ(x)·Q(x) dx + C. Include the constant of integration C — you need it for the general solution.
5
Solve for y; apply initial condition if given
Divide both sides by μ(x) to isolate y. If an initial condition y(x0) = y0 is given, substitute to find the numerical value of C.

§ 04Worked Examples

Ten fully solved problems, escalating from constant coefficients to variable P(x), IVPs, and applications.

Example 1 Constant P(x) — simplest case

Solve: dy/dx + 3y = 6

Step 1 — Standard form
P(x) = 3,   Q(x) = 6
Step 2 — Integrating factor
μ = e∫3 dx = e3x
Step 3 — Multiply through
e3x(dy/dx) + 3e3x·y = 6e3x d/dx[e3x·y] = 6e3x
Step 4 — Integrate
e3x·y = ∫6e3x dx = 2e3x + C
Step 5 — Solve for y
y = 2 + Ce−3x
y = 2 + Ce−3x

As x → ∞, the Ce−3x term decays to zero, so y → 2. The particular solution y = 2 is the steady state.

Example 2 Constant P(x) with IVP

Solve the IVP: dy/dx − 2y = 4ex,   y(0) = 1

Standard form
P(x) = −2,   Q(x) = 4ex
Integrating factor
μ = e∫(−2) dx = e−2x
Multiply and collapse
d/dx[e−2x·y] = 4ex·e−2x = 4e−x
Integrate
e−2x·y = ∫4e−x dx = −4e−x + C
Solve for y
y = −4ex + Ce2x
Apply y(0) = 1
1 = −4 + C  →  C = 5
y = −4ex + 5e2x
Example 3 Variable P(x) = 1/x — factor simplifies to x

Solve: x(dy/dx) + y = x3   (for x > 0)

Divide by x to reach standard form
dy/dx + (1/x)·y = x2 P(x) = 1/x,   Q(x) = x2
Integrating factor
μ = e∫(1/x) dx = eln x = x
Multiply and collapse
d/dx[x·y] = x·x2 = x3
Integrate
x·y = ∫x3 dx = x4/4 + C
Solve for y
y = x3/4 + C/x
y = x3/4 + C/x

Notice how μ = x cleaned up the left side instantly. Whenever P(x) = n/x, the integrating factor is xn.

Example 4 P(x) = 2x — factor is e

Solve: dy/dx + 2xy = 2x

Standard form: P(x) = 2x, Q(x) = 2x
Integrating factor
μ = e∫2x dx = e
Multiply and collapse
d/dx[e·y] = 2x·e
Integrate (recognise 2x·e as d/dx[e])
e·y = ∫2x·e dx = e + C
Solve for y
y = 1 + Ce−x²
y = 1 + Ce−x²
Example 5 P(x) = tan x — factor involves sec x

Solve: dy/dx + (tan x)·y = cos x

P(x) = tan x,   Q(x) = cos x
Integrating factor
μ = e∫tan x dx = e−ln|cos x| = eln|sec x| = sec x

Using ∫tan x dx = −ln|cos x| = ln|sec x|.

Multiply and collapse
d/dx[sec x · y] = sec x · cos x = 1
Integrate
sec x · y = x + C
Solve for y
y = (x + C) cos x
y = (x + C) cos x
Example 6 Must divide first — coefficient ≠ 1 on dy/dx

Solve: (1 + x2)(dy/dx) + 2xy = 4x3

Divide by (1 + x²) to reach standard form
dy/dx + [2x/(1+x²)]·y = 4x3/(1+x²) P(x) = 2x/(1+x²)
Integrating factor
μ = e∫[2x/(1+x²)] dx = eln(1+x²) = 1 + x2

∫2x/(1+x²) dx = ln(1+x²) by the logarithm rule for rational functions.

Multiply and collapse
d/dx[(1+x²)·y] = (1+x²)·4x³/(1+x²) = 4x³
Integrate
(1+x²)·y = x4 + C
Solve for y
y = (x4 + C) / (1 + x²)
y = (x⁴ + C) / (1 + x²)
Example 7 IVP — Newton's Law of Cooling

A cup of coffee at 90°C is placed in a room at 20°C. After 5 minutes it is 70°C. Find T(t) and the time it reaches 40°C. Use dT/dt + kT = 20k.

Standard form: P(t) = k, Q(t) = 20k
Integrating factor
μ = ekt
Multiply and integrate
d/dt[ekt·T] = 20k·ekt ekt·T = 20ekt + C T = 20 + Ce−kt
Apply T(0) = 90 → C = 70
T(t) = 20 + 70e−kt
Apply T(5) = 70 to find k
70 = 20 + 70e−5k  →  50/70 = e−5k k = −(1/5)·ln(5/7) ≈ 0.0673 min⁻¹
Find t when T = 40
40 = 20 + 70e−kt  →  t = −(1/k)·ln(2/7) ≈ 18.6 min
T(t) = 20 + 70e−kt, reaches 40°C after ≈ 18.6 min
Example 8 Mixing problem — salt in a tank

A 100 L tank contains 10 g of salt. Pure water enters at 2 L/min; the well-mixed solution drains at 2 L/min. Find the amount of salt Q(t) at time t.

Set up the ODE (rate in − rate out)
dQ/dt = 0 − 2·(Q/100) = −Q/50 dQ/dt + (1/50)Q = 0
Integrating factor
μ = et/50
Multiply and integrate
d/dt[et/50·Q] = 0  →  et/50·Q = C Q = Ce−t/50
Apply Q(0) = 10
Q(t) = 10e−t/50
Q(t) = 10e−t/50 grams

The salt decays exponentially. After 50 minutes Q ≈ 3.68 g, and after 115 minutes Q ≈ 1 g.

Example 9 Q(x) requires integration by parts

Solve: dy/dx − y = xe2x

P(x) = −1, so μ = e−x
Multiply and collapse
d/dx[e−x·y] = xe2x·e−x = xex
Integrate ∫xex dx by parts (u = x, dv = ex dx)
∫xex dx = xex − ex + C = (x−1)ex + C
Solve for y
e−x·y = (x−1)ex + C y = (x−1)e2x + Cex
y = (x − 1)e2x + Cex
Example 10 Full IVP with variable P(x) and Q(x)

Solve the IVP: dy/dx − (2/x)y = x2sin x,   y(π) = 0   (x > 0)

P(x) = −2/x, so ∫P dx = −2 ln x = ln(x−2)
Integrating factor
μ = eln(x⁻²) = x−2 = 1/x²
Multiply and collapse
d/dx[y/x²] = (1/x²)·x2sin x = sin x
Integrate
y/x² = ∫sin x dx = −cos x + C y = x²(−cos x + C) = −x²cos x + Cx²
Apply y(π) = 0
0 = −π²cos π + Cπ² = π² + Cπ²  →  C = −1
y = −x²cos x − x² = −x²(cos x + 1)

§ 05Quick Reference — Common Integrating Factors

These patterns cover the majority of exam questions. Recognise the form of P(x) and write down μ immediately.

P(x) in dy/dx + P(x)y = Q(x) ∫P(x) dx μ(x) = e∫P dx Simplification used
k (constant) kx ekx
1/x ln x eln x = x eln f = f
n/x n ln x xn en ln x = xn
2x e
tan x −ln|cos x| sec x e−ln|cos x| = 1/|cos x|
2x/(1+x²) ln(1+x²) 1 + x² eln f = f
−1/x −ln x 1/x e−ln x = 1/x
cot x ln|sin x| sin x eln|sin x| = |sin x|
The exponential simplification rule The most important simplification: whenever your integral ∫P(x) dx produces a logarithm, write eln(f(x)) = f(x) immediately. This turns abstract exponentials into recognisable functions and makes the subsequent integration far easier.

§ 06Common Mistakes

⚠ Not dividing through first — coefficient on dy/dx ≠ 1 If the equation is 2(dy/dx) + 6y = 4, then P(x) = 3, not 6. Always divide every term by the coefficient of dy/dx before reading off P(x). If you skip this step μ will be wrong and the left side will not collapse to a perfect derivative.
⚠ Dropping the constant of integration When you integrate both sides in Step 4, the right side produces a +C. This constant is essential — it generates the full family of solutions. Without it, you only have a particular solution, not the general solution. The constant gets determined by an initial condition if one is given.
⚠ Adding +C when computing the integrating factor Conversely, when computing μ = e∫P dx, do NOT include the +C. Any particular antiderivative of P works. Adding a constant would give μ = e∫P dx + C = eC · e∫P dx, and since eC is just another constant that factors out harmlessly, it is convention to set it to 1.
⚠ Forgetting to multiply Q(x) by μ After multiplying the left side by μ(x), the right side must also be multiplied by μ(x). The new right side is μ(x)·Q(x), not Q(x) alone. Then the integral you compute is ∫μ(x)·Q(x) dx, which may be more complex than ∫Q(x) dx.
⚠ Treating the method as a formula to memorise, not a process The formula y = (1/μ)∫μQ dx is a useful shortcut once you understand why it works, but relying on it without understanding the five steps leads to errors with harder equations. Work through the steps explicitly — write d/dx[μy] on the left side — until the method feels natural.

§ 07Practice Quiz — 10 Questions

Find integrating factors, identify standard forms, compute solutions, and apply initial conditions.

Score: 0 / 0
Question 1 — Standard Form

Which of the following is a first-order linear ODE in standard form?

Question 2 — Integrating Factor

For dy/dx + 5y = ex, the integrating factor is μ = ekx. What is k?

P(x) = 5. Compute μ = e∫5 dx.
Question 3 — Factor Simplification

For the ODE dy/dx + (3/x)y = x², what is the integrating factor?

  1. P(x) = 3/x, so ∫P dx = 3 ln x
  2. μ = e3 ln x = eln(x³) =
Question 4 — Steady State

The general solution to dy/dx + 4y = 8 is y = A + Ce−4x. What is the steady-state value A (i.e. the value as x → ∞)?

Solve using the integrating factor method: μ = e4x. Alternatively, set dy/dx = 0 in the original ODE to find the equilibrium.
Question 5 — Process

After multiplying dy/dx + P(x)y = Q(x) through by integrating factor μ(x), what does the left-hand side always equal?

Question 6 — IVP Constant

Solve dy/dx + 2y = 0 with y(0) = 5. The solution is y = Ce−2x. What is C?

Question 7 — Identify P(x)

For the ODE 3(dy/dx) + 9y = 12x, what is P(x) after writing in standard form?

  1. Divide every term by 3: dy/dx + 3y = 4x
  2. P(x) = 3, Q(x) = 4x
Question 8 — Evaluate Solution

The solution to dy/dx + y = ex with y(0) = 0 is y = (ex/2)(ex − 1)·e−x... actually y = (ex − e−x)/2. Evaluate y(0).

  1. μ = ex, so d/dx[exy] = ex·ex = e2x
  2. exy = e2x/2 + C → y = ex/2 + Ce−x
  3. y(0) = 0: 0 = 1/2 + C → C = −1/2
  4. y = ex/2 − e−x/2 = (ex − e−x)/2 = sinh x
  5. y(0) = (1 − 1)/2 = 0
Question 9 — Physical Application

Newton's Law of Cooling gives dT/dt + kT = kT. The integrating factor for this ODE (treating t as the variable) is:

Question 10 — Full Solve

Solve the IVP: x(dy/dx) + 2y = 4x², y(1) = 2. The solution has the form y = x² + C/x². What is C?

Divide by x first: dy/dx + (2/x)y = 4x. Then μ = x². After solving, apply y(1) = 2.
  1. Standard form: dy/dx + (2/x)y = 4x → P(x) = 2/x
  2. μ = e∫(2/x)dx = e2 ln x = x²
  3. d/dx[x²y] = 4x·x² = 4x³
  4. x²y = ∫4x³ dx = x⁴ + C
  5. y = x² + C/x²
  6. y(1) = 2: 2 = 1 + C → C = 1
  7. Solution: y = x² + 1/x²

§ 08What to Study Next

The integrating factor method solves first-order linear ODEs completely. The natural next steps take you to harder classes of equations:

Cookie Settings