This page is a stress test of the method from the parent derivation . We will not just repeat the recipe — we will deliberately hit every kind of situation a first-order linear ODE can throw at you: the friendly ones, the ones where signs flip, the ones where a coefficient is zero, the ones that secretly aren't linear until you rearrange them, and a real-world word problem.
Before touching a single example, we lay out the map of all cases so you can see, at every moment, exactly which corner of the territory we are standing in.
Each row below is one class of problem. The whole point of this page is that no cell is left empty — every example is tagged with the cell it fills.
Cell
What makes it distinct
Where it bites
Example
A. Constant P , Q
P and Q are plain numbers
trivial ∫ P d x = P x
Ex 1
B. Non-standard leading coefficient
equation starts as a ( x ) y ′ + …
must divide first or method breaks
Ex 2
C. Negative P
sign of P flips the exponent
$\mu = e^{-\int
P
D. P produces ln / power μ
P = n / x gives μ = x n
absolute values, domain x > 0 vs x < 0
Ex 4
E. Degenerate: P = 0
no y term at all
method still works but reduces to plain integration
Ex 5
F. Initial-value problem (IVP)
a condition y ( x 0 ) = y 0 pins C
apply IC only at the end
Ex 6
G. Real-world word problem
mixing / cooling — you must build the ODE
translating words to P , Q
Ex 7
H. Exam twist — looks non-linear
y appears "wrongly"; swap roles of x , y
treat x as the unknown function
Ex 8
Intuition The one idea that unifies all cells
No matter how ugly the equation, the method is the same three heartbeats: ==put it in standard form, multiply by μ = e ∫ P d x , then integrate the single derivative d x d ( μ y ) ==. Everything below is that same heartbeat under different disguises.
Worked example Example 1 —
d x d y + 3 y = 6
Forecast: Before reading on, guess: what will y look like as x → ∞ ? (Hint: does y ′ = 0 give a steady value?)
Step 1 — Identify P , Q . Standard already: P = 3 , Q = 6 .
Why this step? Every formula assumes the coefficient of y ′ is 1 ; here it is, so we may read off P , Q directly.
Step 2 — Integrating factor. ∫ 3 d x = 3 x , so μ = e 3 x .
Why this step? μ = e ∫ P d x is built so that μ y ′ + μ P y = d x d ( μ y ) . With constant P the integral is just P x .
Step 3 — Collapse. d x d ( e 3 x y ) = 6 e 3 x .
Why this step? The left side is guaranteed to be a single derivative once we used the correct μ ; multiply the right side Q = 6 by μ .
Step 4 — Integrate. e 3 x y = 3 6 e 3 x + C = 2 e 3 x + C .
Step 5 — Divide by μ . y = 2 + C e − 3 x .
Why this step? We had μ y , not y ; divide the whole right side by e 3 x .
Verify: As x → ∞ , e − 3 x → 0 so y → 2 — the steady state where y ′ = 0 ⇒ 3 y = 6 ⇒ y = 2 . ✓ And plugging back: y ′ = − 3 C e − 3 x , so y ′ + 3 y = − 3 C e − 3 x + 6 + 3 C e − 3 x = 6 . ✓
Worked example Example 2 —
( x 2 ) d x d y + 2 x y = 1
Forecast: The left side x 2 y ′ + 2 x y — does it remind you of a derivative you already know from the Product Rule ? Guess d x d ( x 2 y ) before continuing.
Step 1 — Standardize. Divide by x 2 : d x d y + x 2 y = x 2 1 . So P = x 2 , Q = x 2 1 .
Why this step? If we skip this, the coefficient of y ′ is x 2 , not 1 , and the term meant to match μ P y is wrong — the collapse fails.
Step 2 — Integrating factor. ∫ x 2 d x = 2 ln ∣ x ∣ = ln x 2 , so μ = e l n x 2 = x 2 .
Why this step? ∫ x n d x = n ln ∣ x ∣ , and exponentiating undoes the log.
Step 3 — Collapse. d x d ( x 2 y ) = x 2 ⋅ x 2 1 = 1 .
Why this step? Note the cancellation — a healthy sign the standardization was correct. And μ = x 2 confirms your forecast: the original left side was already d x d ( x 2 y ) .
Step 4 — Integrate. x 2 y = x + C .
Step 5 — Divide. y = x 1 + x 2 C (for x = 0 ).
Verify: y ′ = − x 2 1 − x 3 2 C . Then x 2 y ′ + 2 x y = − 1 − x 2 C + 2 x ( x 1 + x 2 C ) = − 1 − x 2 C + 2 + x 2 C = 1 . ✓
Worked example Example 3 —
d x d y − 2 y = e 4 x
Forecast: With P = − 2 (negative!), will μ = e − 2 x shrink or grow as x increases? And does that make the collapse still work?
Step 1 — Identify. P = − 2 , Q = e 4 x .
Step 2 — Integrating factor. ∫ ( − 2 ) d x = − 2 x , so μ = e − 2 x .
Why this step? The sign of P carries straight into the exponent. μ here decays , but that is fine — we only need any function satisfying μ ′ = μ P .
Step 3 — Collapse. d x d ( e − 2 x y ) = e − 2 x e 4 x = e 2 x .
Why this step? Multiply Q = e 4 x by μ = e − 2 x ; exponents add: − 2 + 4 = 2 .
Step 4 — Integrate. e − 2 x y = 2 1 e 2 x + C .
Step 5 — Divide by μ (i.e. multiply by e 2 x ): y = 2 1 e 4 x + C e 2 x .
Verify: y ′ = 2 e 4 x + 2 C e 2 x . Then y ′ − 2 y = 2 e 4 x + 2 C e 2 x − e 4 x − 2 C e 2 x = e 4 x . ✓
Common mistake The sign trap in Cell C
A very common slip is to write μ = e 2 x "because it looks nicer." That is the integrating factor for y ′ + 2 y = … , a different equation. Keep the minus: the exponent is literally ∫ P d x , sign included.
Worked example Example 4 —
d x d y − x 3 y = x 3
Forecast: P = − 3/ x . Will μ be x 3 , x − 3 , or something with an absolute value? Guess the sign of the exponent first.
Step 1 — Identify. Already standard: P = − x 3 , Q = x 3 .
Step 2 — Integrating factor. ∫ − x 3 d x = − 3 ln ∣ x ∣ = ln ∣ x ∣ − 3 , so μ = ∣ x ∣ − 3 . On the domain x > 0 we write μ = x − 3 .
Why the absolute value? ∫ x 1 d x = ln ∣ x ∣ is valid for both signs of x , but ln of a negative number isn't real. Since a solution curve lives on one side of x = 0 (the ODE is singular there — look at the red dashed line in the figure), we pick the branch and drop the bars.
Step 3 — Collapse. d x d ( x − 3 y ) = x − 3 ⋅ x 3 = 1 .
Why this step? Again a clean cancellation confirms μ is right.
Step 4 — Integrate. x − 3 y = x + C .
Step 5 — Divide. y = x 4 + C x 3 (for x > 0 ; the mirror branch x < 0 has the same algebra).
Verify: y ′ = 4 x 3 + 3 C x 2 . Then y ′ − x 3 y = 4 x 3 + 3 C x 2 − x 3 ( x 4 + C x 3 ) = 4 x 3 + 3 C x 2 − 3 x 3 − 3 C x 2 = x 3 . ✓
Worked example Example 5 —
d x d y = cos x (there is no y term!)
Forecast: With no P y term, is the integrating factor method even needed? What is μ when P = 0 ?
Step 1 — Identify. P = 0 , Q = cos x .
Step 2 — Integrating factor. ∫ 0 d x = 0 , so μ = e 0 = 1 .
Why this step? When P = 0 the "special mittens" are just the identity — multiplying by 1 changes nothing. This shows the method degrades gracefully into ordinary integration; it never breaks , it just does the obvious thing.
Step 3 — Collapse. d x d ( 1 ⋅ y ) = cos x , i.e. y ′ = cos x .
Step 4 — Integrate. y = sin x + C .
Verify: y ′ = cos x . ✓ (This is exactly a separable / direct-integration problem — the linear machinery collapses to it when P = 0 .)
Worked example Example 6 — IVP:
d x d y + y = x , y ( 0 ) = 3
Forecast: The general solution will contain C e − x . Guess: after applying y ( 0 ) = 3 , will C be positive or negative?
Step 1 — Identify. P = 1 , Q = x .
Step 2 — Integrating factor. ∫ 1 d x = x , so μ = e x .
Step 3 — Collapse. d x d ( e x y ) = x e x .
Step 4 — Integrate by parts. ∫ x e x d x = x e x − ∫ e x d x = x e x − e x + C .
Why parts? The integrand is a product of x (algebraic) and e x (exponential); parts is the tool that peels off the polynomial factor one derivative at a time. So e x y = x e x − e x + C .
Step 5 — Divide. y = x − 1 + C e − x .
Step 6 — Apply the initial condition last . y ( 0 ) = 0 − 1 + C = 3 ⇒ C = 4 .
Why last? C is only meaningful once the general solution exists; pinning it earlier would corrupt the integration.
Answer: y = x − 1 + 4 e − x .
Verify: y ′ = 1 − 4 e − x . Then y ′ + y = 1 − 4 e − x + x − 1 + 4 e − x = x . ✓ And y ( 0 ) = 0 − 1 + 4 = 3 . ✓
Worked example Example 7 — Salt mixing
A tank holds 100 litres of pure water. Brine containing 2 grams of salt per litre flows in at 5 L/min, and the well-stirred mixture flows out at the same 5 L/min. Let y ( t ) be the grams of salt in the tank. Find y ( t ) .
Forecast: The inflow adds salt at a constant rate; the outflow removes salt proportional to how much is there. Guess the long-run amount of salt (steady state) before solving. (Tank volume = 100 L, incoming concentration 2 g/L…)
Step 1 — Build the ODE. Rate in = ( 2 g/L ) ( 5 L/min ) = 10 g/min. Rate out = ( 100 y g/L ) ( 5 L/min ) = 20 y g/min. So
d t d y = 10 − 20 y .
Why this step? "Rate of change = in − out" is the physical law; the concentration in the tank is y /100 because volume stays 100 L (equal flow rates).
Step 2 — Standardize. d t d y + 20 1 y = 10 . So P = 20 1 , Q = 10 .
Step 3 — Integrating factor. ∫ 20 1 d t = 20 t , so μ = e t /20 .
Step 4 — Collapse & integrate. d t d ( e t /20 y ) = 10 e t /20 , so
e t /20 y = 10 ⋅ 20 e t /20 + C = 200 e t /20 + C .
Why the × 20 ? ∫ e t /20 d t = 20 e t /20 (divide by the inner coefficient 1/20 ).
Step 5 — Divide. y = 200 + C e − t /20 .
Step 6 — Initial condition. Pure water at t = 0 means y ( 0 ) = 0 : 0 = 200 + C ⇒ C = − 200 .
Answer: y ( t ) = 200 ( 1 − e − t /20 ) grams.
Verify (steady state + units): As t → ∞ , y → 200 g. Check physically: at steady state y ′ = 0 ⇒ y /20 = 10 ⇒ y = 200 g. That is 200/100 = 2 g/L — the inflow concentration, exactly as intuition demands. ✓ Units: [ 10 ] = g/min, [ y /20 ] = g/min ✓.
Worked example Example 8 —
d x d y = x + y 2 1
Forecast: As written, the right side has y 2 — it looks non-linear , and no μ formula fits. But what if we flip the fraction and think of x as a function of y ? Guess what d y d x becomes.
Step 1 — Invert the derivative. Since d x d y = d x / d y 1 , flipping gives
d y d x = x + y 2 .
Why this step? Reciprocating a derivative is legal wherever d y / d x = 0 . This is the key move: the equation is non-linear in y but linear in x .
Step 2 — Rewrite as linear in x ( y ) . d y d x − x = y 2 . Now the unknown function is x , the variable is y , and P ( y ) = − 1 , Q ( y ) = y 2 .
Why this step? Compare to standard form d y d x + P ( y ) x = Q ( y ) — it matches with x playing the role y usually plays.
Step 3 — Integrating factor (in y ). μ = e ∫ − 1 d y = e − y .
Step 4 — Collapse. d y d ( e − y x ) = y 2 e − y .
Step 5 — Integrate by parts (twice).
∫ y 2 e − y d y = − y 2 e − y − 2 y e − y − 2 e − y + C = − ( y 2 + 2 y + 2 ) e − y + C .
Why parts twice? y 2 needs two derivatives to vanish; each application drops the polynomial degree by one.
So e − y x = − ( y 2 + 2 y + 2 ) e − y + C .
Step 6 — Divide by μ (multiply by e y ): x = − ( y 2 + 2 y + 2 ) + C e y .
Answer: x = C e y − y 2 − 2 y − 2 (an explicit formula for x in terms of y ).
Verify: d y d x = C e y − 2 y − 2 . Then d y d x − x = ( C e y − 2 y − 2 ) − ( C e y − y 2 − 2 y − 2 ) = y 2 . ✓
y looks non-linear but x looks linear
"Flip the fraction, follow x ." If d x d y is messy in y but d y d x is linear in x , solve for x ( y ) instead.
Recall Which cell needed the sign kept in the exponent, and why?
Cell C (P = − 2 ): the integrating factor is e ∫ P d x = e − 2 x . Dropping the minus solves a different ODE. ::: Keep the sign of P inside ∫ P d x .
Recall What is
μ when P = 0 , and what does the method reduce to?
μ = e 0 = 1 ; the method degrades to ordinary direct integration (Cell E). :::
Recall In the mixing problem, why was the tank concentration
y /100 ?
Inflow and outflow rates were equal (5 L/min), so the volume stayed constant at 100 L. :::
Recall Exam twist: what tells you to solve for
x ( y ) instead of y ( x ) ?
The equation is non-linear in y but becomes linear once you reciprocate to get d y d x . :::
Separable ODEs — Cell E collapses to this; also used to solve for μ itself.
Product Rule — the collapse μ y ′ + μ P y = d x d ( μ y ) seen directly in Cell B (d x d ( x 2 y ) ).
Exact ODEs — the "swap roles" move in Cell H is close in spirit to finding integrating factors that make equations exact.
Bernoulli Equations — the next level of "looks non-linear, becomes linear" via v = y 1 − n .
Linear Constant-Coefficient ODEs — Cell A is exactly this special case.
Standard form dy/dx + Py = Q
Compute mu = exp integral P
Integrate and divide by mu