Linear differential equations have a fixed recipe that works every single time, which makes them some of the most dependable marks in the Calculus unit. After reading this article you will be able to recognise a linear equation (even when it is disguised), find its integrating factor, solve it, and handle the less familiar form where \(x\) is the dependent variable.
What makes an equation “linear”?
A first-order linear differential equation in \(y\) can be written as
\[\frac{dy}{dx} + P\,y = Q,\]
where \(P\) and \(Q\) are functions of \(x\) alone (or constants). “Linear” means \(y\) and \(\frac{dy}{dx}\) appear only to the first power and are not multiplied together. There must be no \(y^2\), \(\sqrt{y}\), \(\sin y\) or \(y\frac{dy}{dx}\).
The second form swaps roles: \(\dfrac{dx}{dy} + P_1\,x = Q_1\), where \(P_1, Q_1\) are functions of \(y\) alone. This is used when the equation is linear in \(x\) but not in \(y\).
Why the integrating factor works
The left side \(\frac{dy}{dx} + Py\) is almost the derivative of a product. Multiply both sides by a function \(\mu(x)\):
\[\mu\frac{dy}{dx} + \mu P y = \mu Q.\]
We want the left side to equal \(\frac{d}{dx}(\mu y) = \mu\frac{dy}{dx} + \mu’ y\). That needs \(\mu’ = \mu P\), i.e. \(\frac{\mu’}{\mu} = P\), so \(\ln\mu = \int P\,dx\) and
\[\mu = \text{I.F.} = e^{\int P\,dx}.\]
Now the equation reads \(\frac{d}{dx}(y\cdot\text{I.F.}) = Q\cdot\text{I.F.}\), and integrating both sides gives the solution:
\[y\cdot\text{I.F.} = \int Q\cdot\text{I.F.}\,dx + C.\]
So the integrating factor is not a trick to memorise blindly. It is the multiplier that turns the left side into an exact product derivative.
The five-step procedure
- Standard form: divide so the coefficient of \(\frac{dy}{dx}\) is exactly 1. Read off \(P\) and \(Q\) with their signs.
- I.F. \(= e^{\int P\,dx}\). Simplify using \(e^{\ln u} = u\). No constant is needed here.
- Write \(y\cdot\text{I.F.} = \int Q\cdot\text{I.F.}\,dx + C\).
- Integrate the right side (often by substitution or by parts) and add \(+C\).
- Solve for \(y\), and if an initial condition is given, substitute it to find \(C\).
Remember: the sign of \(P\) goes into the integrating factor. For \(\frac{dy}{dx} – \frac{2}{x}y = \dots\), \(P = -\frac{2}{x}\), not \(\frac{2}{x}\). Getting this sign wrong ruins every line that follows.
Worked example 1: constant coefficient
Solve \(\dfrac{dy}{dx} + 3y = e^{2x}\).
Here \(P = 3\), \(Q = e^{2x}\). I.F. \(= e^{\int 3\,dx} = e^{3x}\).
\[y\,e^{3x} = \int e^{2x}\cdot e^{3x}\,dx = \int e^{5x}\,dx = \frac{e^{5x}}{5} + C.\]
Dividing by \(e^{3x}\): \(\;y = \dfrac{e^{2x}}{5} + C e^{-3x}\).
Check: \(y’ = \frac{2}{5}e^{2x} – 3Ce^{-3x}\), so \(y’ + 3y = \frac{2}{5}e^{2x} + \frac{3}{5}e^{2x} = e^{2x}\). Correct.
Worked example 2: getting into standard form first
Solve \(x\dfrac{dy}{dx} – 2y = x^4\) for \(x > 0\), given \(y = 3\) when \(x = 1\).
Divide by \(x\): \(\dfrac{dy}{dx} – \dfrac{2}{x}y = x^3\). So \(P = -\dfrac{2}{x}\), \(Q = x^3\).
\[\text{I.F.} = e^{\int -\frac{2}{x}dx} = e^{-2\ln x} = x^{-2} = \frac{1}{x^2}.\] \[y\cdot\frac{1}{x^2} = \int x^3\cdot\frac{1}{x^2}\,dx = \int x\,dx = \frac{x^2}{2} + C \quad\Rightarrow\quad y = \frac{x^4}{2} + Cx^2.\]
Using \(y(1) = 3\): \(3 = \frac{1}{2} + C\), so \(C = \frac{5}{2}\). The particular solution is \(y = \dfrac{x^4}{2} + \dfrac{5x^2}{2}\).
Worked example 3: trigonometric coefficient
Solve \(\dfrac{dy}{dx} + y\cot x = 4\cos x\), \(0 < x < \pi\), given \(y = 1\) when \(x = \frac{\pi}{2}\).
\(P = \cot x\), so I.F. \(= e^{\int\cot x\,dx} = e^{\ln\sin x} = \sin x\) (positive on \((0,\pi)\)).
\[y\sin x = \int 4\cos x\sin x\,dx = 2\sin^2 x + C.\]
(Substitute \(t = \sin x\): \(\int 4t\,dt = 2t^2\).) At \(x = \frac{\pi}{2}\): \(1\cdot 1 = 2 + C\), so \(C = -1\). Hence
\[y = \frac{2\sin^2 x – 1}{\sin x} = 2\sin x – \operatorname{cosec} x.\]
Worked example 4: linear in \(x\), not in \(y\)
Solve \(y\,dx = (x + y^2e^{y})\,dy\), \(y > 0\).
Written as \(\frac{dy}{dx} = \frac{y}{x + y^2e^{y}}\), this is not linear in \(y\) because \(y\) also appears inside the denominator. Flip it:
\[\frac{dx}{dy} = \frac{x + y^2e^{y}}{y} = \frac{x}{y} + ye^{y} \quad\Rightarrow\quad \frac{dx}{dy} – \frac{1}{y}x = ye^{y}.\]
Now \(P_1 = -\frac{1}{y}\), \(Q_1 = ye^{y}\), and I.F. \(= e^{-\ln y} = \frac{1}{y}\).
\[x\cdot\frac{1}{y} = \int ye^{y}\cdot\frac{1}{y}\,dy = e^{y} + C \quad\Rightarrow\quad x = ye^{y} + Cy.\]
If the question had also said \(x = e + 2\) when \(y = 1\), you would substitute into this general solution: \(e + 2 = e + C\), so \(C = 2\) and the particular solution is \(x = ye^{y} + 2y\). Any correct line that contains \(C\) gives the same value, but substituting into the final form is the least error-prone.
Whenever the \(y\)-form looks hopeless, try writing \(\frac{dx}{dy}\); the equation is often linear in \(x\).
Integrating factors you will meet often
Most board-level questions use a small family of coefficients. Knowing these saves time and avoids slips with logarithms.
| \(P\) | \(\int P\,dx\) | I.F. |
|---|---|---|
| \(k\) (constant) | \(kx\) | \(e^{kx}\) |
| \(\frac{n}{x}\) | \(n\ln x\) | \(x^n\) |
| \(-\frac{n}{x}\) | \(-n\ln x\) | \(\frac{1}{x^n}\) |
| \(\tan x\) | \(\ln\sec x\) | \(\sec x\) |
| \(\cot x\) | \(\ln\sin x\) | \(\sin x\) |
| \(\frac{2x}{1+x^2}\) | \(\ln(1+x^2)\) | \(1+x^2\) |
(The logarithm rows assume the expression inside is positive on the interval in the question.) After finding the I.F., glance at \(Q\cdot\text{I.F.}\) before integrating. In well-set questions it usually simplifies nicely, as \(x^3\cdot\frac{1}{x^2} = x\) did in Example 2. If it turns into something you cannot integrate, recheck \(P\) and its sign before going further.
How to tell it apart from other types
- If you can separate \(x\) and \(y\) completely, variables separable is usually quicker.
- If \(\frac{dy}{dx} = F\!\left(\frac{y}{x}\right)\), it is homogeneous — use \(y = vx\).
- If it fits \(\frac{dy}{dx} + Py = Q\) (or the \(x\)-version), use the integrating factor.
Common mistakes
- Not dividing first. In \(x\frac{dy}{dx} – 2y = x^4\), \(P\) is \(-\frac{2}{x}\), not \(-2\).
- Losing the sign of \(P\) when writing the integrating factor.
- Adding a constant inside the I.F. It is unnecessary and only complicates things.
- Forgetting \(+C\), or adding it only at the very end. In Example 1, adding \(C\) after dividing by \(e^{3x}\) gives \(y = \frac{e^{2x}}{5} + C\), which does not satisfy the equation; the correct term is \(Ce^{-3x}\).
- Mixing forms: in the \(\frac{dx}{dy}\) form, the solution is \(x\cdot\text{I.F.} = \int Q_1\cdot\text{I.F.}\,dy + C\).
Practise next
Solve more equations on the linear differential equations topic page, and compare with the homogeneous method so you can identify the type quickly. The integration by parts page helps when \(\int Q\cdot\text{I.F.}\,dx\) needs it. Register for a free student account to take practice tests on the full Differential Equations chapter.
Frequently asked questions
Do I need to add a constant when finding the integrating factor?
No. Any one integrating factor is enough, so take \(e^{\int P\,dx}\) without a constant. The single constant \(C\) is added when you integrate \(Q\cdot\text{I.F.}\).
What if \(\int P\,dx\) gives \(\ln|x|\)?
Then the I.F. is \(|x|\). If the question restricts \(x > 0\) (or you can assume it), you may simply write \(x\); mentioning the domain keeps the step precise.
How do I know whether to use dy/dx or dx/dy form?
Check whether the equation fits \(\frac{dy}{dx} + Py = Q\) with \(P, Q\) in \(x\) only. If terms like \(y^2\) block that, rewrite as \(\frac{dx}{dy}\) and see if it fits \(\frac{dx}{dy} + P_1x = Q_1\) with \(P_1, Q_1\) in \(y\) only.
Can I verify my answer quickly?
Yes. Differentiate your solution and substitute into the original equation; both sides should match. This takes under a minute for most questions.