The standard form y′ + P(x)y = Q(x) describes everything from cooling coffee to charging capacitors.
One elegant trick, the integrating factor, solves them all.
Standard formIntegrating factor derivation12 worked examplesReal-world applications
A first-order ODE is linear if y and y′ each appear to the first power and are not multiplied together. Every such equation can be written in one of two equivalent standard forms.
The most general first-order linear ODE is:
Standard Form
y′ + P(x)y = Q(x)
Here P(x) and Q(x) are any continuous functions of x. The equation is linear because y and y′ appear only to the first power and are never multiplied together: no y², no y·y′, no sin(y). That linearity is what makes a systematic solution method possible.
If you are handed an equation that looks different, the first job is always to rewrite it in standard form. For instance:
Rewriting into standard form
xy′ + 3y = x² ÷x → y′ + (3/x)y = x
y′ = 2y + ex → y′ − 2y = ex
Once in standard form, we can read off P(x) and Q(x) immediately:
First example above: P(x) = 3/x, Q(x) = x
Second example above: P(x) = −2, Q(x) = ex
What makes it solvable?
A separable equation can be solved by separating variables — but only when Q(x) = 0 or when the right-hand side factors neatly. The integrating factor method works for any first-order linear ODE, regardless of what P(x) and Q(x) look like, as long as they are continuous.
Linear vs. Non-Linear — Quick Tests
Before applying the method, check that the equation is genuinely linear. An ODE is non-linear if it contains any of: y², y³, √y, 1/y, sin(y), y·y′, or (y′)². These require different techniques entirely.
⚠ Not first-order linear
y′ + y² = x (contains y²) — this is a Bernoulli equation.
y′ = sin(y) (contains sin(y)) — non-linear, no closed-form solution in general.
y·y′ = x (y and y′ multiplied) — non-linear (though this particular one is separable).
§ 02The Integrating Factor — Full Derivation
The integrating factor is not a formula to memorise blindly. It emerges from a single clever observation about the product rule.
Start with the standard form and ask: can we multiply both sides by some function μ(x) so that the left-hand side becomes a perfect derivative?
Goal
μy′ + μP(x)y = d/dx[μy]
Expand the right-hand side using the product rule:
Product rule expansion
d/dx[μy] = μ′y + μy′
Matching the two expressions: we need μP(x)y = μ′y, which means μ′ = μP(x). This is a separable ODE for μ:
DerivationFinding the integrating factor μ(x)
dμ/dx = μP(x)
separable ODE for μ
dμ/μ = P(x) dx
separate variables
ln|μ| = ∫P(x) dx
integrate both sides
μ(x) = e∫P(x)dx
exponentiate; absorb ± into the constant (we only need one μ)
Now that we have μ, multiply the original equation through by it:
Using μ to solveCompleting the solution
μy′ + μP(x)y = μQ(x)
multiply both sides by μ
d/dx[μy] = μQ(x)
left side is now a perfect derivative
μy = ∫μQ(x) dx + C
integrate both sides with respect to x
y = (1/μ) [ ∫μQ(x) dx + C ]
divide both sides by μ to isolate y
That last line is the general solution formula. In practice, you never memorise it, you re-derive it from the μ step every time, which is fast once the method is internalized.
Why this always works
The magic is that μ transforms the left-hand side from two separate terms (μy′ and μPy) into a single derivative d/dx[μy]. Once the left side is a perfect derivative, both sides can be integrated directly. The integration on the right produces the general solution.
§ 03The 4-Step Method
Every first-order linear ODE is solved in exactly four steps. Commit these to memory and you can solve any equation of this type.
The Integrating Factor Method — 4 Steps
Write the equation in standard form.
Divide through by the coefficient of y′ if necessary, so the equation reads y′ + P(x)y = Q(x). Read off P(x) and Q(x).
Compute the integrating factor.μ(x) = e∫P(x) dx
Omit the constant of integration here, we only need one particular μ.
Multiply both sides by μ and recognise the left side.d/dx[μy] = μQ(x)
The left side is always the derivative of the product μy. Write it that way before integrating.
Integrate both sides and solve for y.μy = ∫μQ(x) dx + C → y = (∫μQ dx + C) / μ
If an initial condition is given, substitute it now to find C.
⚠ Don't skip the constant C
When you integrate both sides in Step 4, you must include +C on the right. This constant represents the entire family of solutions. An initial condition will pin it down; without one, the general solution retains C.
§ 04Real-World Applications
First-order linear ODEs govern a remarkable range of natural phenomena. Recognising these standard models lets you set up the equation before picking up a pen.
🌡
Newton's Law of Cooling
dT/dt + k(T − Tenv) = 0
Temperature of an object approaches the ambient temperature exponentially. Rewrite as dT/dt + kT = kTenv — a first-order linear ODE with P = k, Q = kTenv.
⚡
RL Electrical Circuit
L · dI/dt + RI = V(t)
Current I in a series inductor-resistor circuit. Divide by L to get standard form: dI/dt + (R/L)I = V(t)/L, with P = R/L and Q = V(t)/L.
🧪
Mixing Problems
dA/dt + (rout/V)A = rin·cin
Amount A of substance in a tank. Flow rate in minus flow rate out. The volume V may itself change with time, making P(t) = rout/V(t) non-constant.
💊
Drug Concentration
dC/dt + keC = D(t)
Concentration C of a drug in the bloodstream. ke is the elimination rate constant; D(t) is the dosing rate. Solved by the integrating factor eket.
💰
Savings with Regular Deposits
dS/dt − rS = d
Balance S growing at interest rate r with constant deposit rate d. Standard form: dS/dt + (−r)S = d. Integrating factor μ = e−rt.
🌊
Pollution Dispersal
dP/dt + k(t)P = s(t)
Pollutant concentration P with time-varying decay rate k(t) and source s(t). Only the integrating factor method handles the non-constant coefficient.
§ 05Integrating Factor Calculator
Select the form of P(x) in your equation and compute μ(x) = e^∫P dx instantly.
Find μ(x) for y′ + P(x)y = Q(x)
Integrating Factor
§ 06Worked Examples
Twelve fully solved problems: from clean constant-coefficient equations to mixing tanks and RL circuits.
Example 1Constant P — the simplest casePure
Solve: y′ − 2y = 4
Step 1 — Standard form
y′ + (−2)y = 4 → P = −2, Q = 4
Step 2 — Integrating factor
μ = e∫(−2)dx = e−2x
Step 3 — Multiply through, recognise the derivative
d/dx[e−2x y] = 4e−2x
Step 4 — Integrate both sides
e−2x y = 4 · (e−2x / −2) + C = −2e−2x + Cy = −2 + Ce2x
T(t) = 20 + 70e^(−0.05t); cools to 50°C after ≈ 16.9 min
Example 8RL Circuit — step input voltageApplied
An RL circuit has R = 4 Ω, L = 0.2 H. A constant voltage V = 12 V is switched on at t = 0 with I(0) = 0. Find I(t).
Standard form: divide by L = 0.2
dI/dt + (4/0.2)I = 12/0.2 → dI/dt + 20I = 60
μ = e20t
d/dt[e20tI] = 60e20te20tI = 3e20t + C → I = 3 + Ce−20t
Apply I(0) = 0
0 = 3 + C → C = −3
I(t) = 3(1 − e^(−20t)) A
I → 3 A (= V/R = 12/4) as t → ∞. The time constant τ = L/R = 0.05 s.
Example 9Mixing problem — constant volumeApplied
A 500 L tank contains pure water. Brine with concentration 0.1 kg/L flows in at 10 L/min. The well-mixed solution flows out at 10 L/min. Find the amount of salt A(t) after t minutes. When does A reach 40 kg?
Rate in − Rate out = dA/dt
dA/dt = (0.1)(10) − (A/500)(10) = 1 − A/50
Standard form
dA/dt + (1/50)A = 1 P = 1/50, Q = 1
μ = et/50
d/dt[et/50A] = et/50A = 50 + Ce−t/50
A(0) = 0 → C = −50
A(t) = 50(1 − e−t/50)
Solve A = 40
40 = 50(1 − e−t/50) → e−t/50 = 0.2 → t = 50 ln 5 ≈ 80.5 min
A(t) = 50(1 − e^(−t/50)) kg; reaches 40 kg after ≈ 80.5 min
Example 10Mixing problem — variable volumeApplied
A 200 L tank starts with 100 L of pure water. Brine at 0.5 kg/L flows in at 6 L/min; the mixture flows out at 4 L/min (so volume increases). Find A(t).
Example 12Equation requiring an algebraic rearrangement firstPure
Solve: (1 + x²)y′ + 2xy = cos x
Divide by (1 + x²)
y′ + [2x/(1+x²)]y = cos x/(1+x²)
μ = e∫2x/(1+x²)dx = eln(1+x²) = 1 + x²
Multiply through
d/dx[(1+x²)y] = cos x
Integrate
(1+x²)y = sin x + C → y = (sin x + C)/(1+x²)
y = (sin x + C) / (1 + x²)
§ 07Common Mistakes
⚠ Not dividing to get standard form first
If the equation is 2y′ + 6y = 10, students often write P = 6 and Q = 10. The correct first step is to divide by 2: y′ + 3y = 5, so P = 3 and Q = 5. Using the wrong P gives the wrong integrating factor and a wrong answer.
⚠ Including a constant when computing μ
When you integrate P(x) to find μ, do not add a +C. Write μ = e^∫P dx and pick the simplest antiderivative. Any constant would cancel in the end, so including one just clutters the work.
⚠ Forgetting to multiply Q by μ
After multiplying the left side by μ, the right side must also be multiplied by μ. The right-hand side becomes μQ(x), not just Q(x). Missing this is the single most common error.
⚠ Not writing the left side as a derivative before integrating
After multiplying by μ, write d/dx[μy] = μQ explicitly before integrating. Jumping straight to the integration without recognising the product-rule structure leads to errors, especially when P(x) is complicated.
⚠ Dropping the constant of integration
Every integration in Step 4 produces a +C. Omitting it gives only the particular solution, not the general solution. If no initial condition is given, C must appear in your final answer.
§ 08Practice Quiz — 10 Questions
Apply the 4-step method. Some questions ask for P(x), μ, or the final solution: read each carefully.
Score: 0 / 0
Question 1 — Standard form
Rewrite 3y′ + 9y = 12 in standard form. What is P(x)?
Divide by 3: y′ + 3y = 4
P(x) = 3, Q(x) = 4
Question 2 — Integrating factor
For y′ + 5y = e²ˣ, the integrating factor is μ = e^(ax). What is a?
μ = e^∫P dx. Here P = 5. ∫5 dx = 5x.
Question 3 — Recognising the derivative
After multiplying y′ + P(x)y = Q(x) by μ, the left-hand side becomes:
Question 4 — Solving for the constant
The general solution to y′ + 2y = 6 is y = 3 + Ce⁻²ˣ. If y(0) = 7, what is C?
Substitute x = 0 and y = 7 into y = 3 + Ce⁻²ˣ.
Question 5 — Integrating factor with P = 1/x
For xy′ + y = x³ (rewritten as y′ + (1/x)y = x²), what is μ(x)?
P(x) = 1/x
∫(1/x)dx = ln x
μ = e^(ln x) = x
Question 6 — Cooling problem
An object cools from 80°C in a 20°C room with k = 0.1 min⁻¹. The solution is T = 20 + 60e^(−0.1t). At what time (min, to 1 d.p.) does T = 40°C?
Set T = 40: 40 = 20 + 60e^(−0.1t). Solve for t using ln.
−0.1t = ln(1/3) = −ln 3 → t = ln3/0.1 = 10 ln 3 ≈ 11.0 min
Question 7 — RL circuit
For the RL circuit ODE dI/dt + (R/L)I = V/L with I(0) = 0, what does I approach as t → ∞?
Question 8 — Mixing tank
A 100 L tank starts with pure water. Salt water (0.2 kg/L) flows in at 5 L/min; solution flows out at 5 L/min. The general solution is A(t) = 20 + Ce^(−t/20). If A(0) = 0, what is A(20) in kg, to 2 d.p.?
A(0) = 0 gives C = −20. Then A(t) = 20(1 − e^(−t/20)). Evaluate at t = 20.
A(0) = 0: 0 = 20 + C → C = −20
A(t) = 20(1 − e^(−t/20))
A(20) = 20(1 − e⁻¹) = 20(1 − 0.3679) ≈ 12.64 kg
Question 9 — Finding the integrating factor
For y′ + (2/x)y = x³, the integrating factor is μ = x^n. What is n?
∫(2/x)dx = 2 ln x → μ = e^(2 ln x) = x².
Question 10 — Identifying the method
Which of the following ODEs is NOT first-order linear?
(a) Linear: P = cos x, Q = sin x ✓
(b) Linear: divide by x → y′ − (3/x)y = x³ ✓
(c) Not linear: contains y², this is a Bernoulli equation ✗
(d) Linear: y′ − 4y = e^(2x) ✓
§ 09What to Study Next
You can now solve any first-order linear ODE. The natural progression is to equations of higher order and more complex structure:
Homogeneous Equations, another class of first-order ODEs, solved via the substitution v = y/x.