In short
A first-order linear differential equation has the form \dfrac{dy}{dx} + P(x)y = Q(x) — linear because y and y' appear only to the first power. The standard solution method is to multiply both sides by the integrating factor \mu(x) = e^{\int P(x)\,dx}, which turns the left side into (\mu y)'. One integration later, you have y = \frac{1}{\mu}\int \mu Q\,dx. This is the single technique that solves every first-order linear ODE.
A cup of tea sits on a table at 90°\mathrm C. The room is at 20°\mathrm C. Newton's law of cooling says the tea loses heat at a rate proportional to how much hotter it is than the room. Let T(t) be the temperature of the tea at time t. Then
for some positive constant k that depends on the cup. This is a differential equation you can solve by separating variables — but there is a small twist: what if the room itself is warming up? Say T_{\text{room}}(t) = 20 + 2t because sunlight is pouring in. Now the equation becomes
Rearranging:
This is not separable anymore. The t on the right side and the T on the left are tangled through an addition rather than a product. You cannot split the variables to opposite sides.
But there is a single trick — clever but mechanical, once you know it — that solves this equation and every other one that has this shape. The shape is called first-order linear, and the trick is called the integrating factor method. This article shows you exactly where the trick comes from and why it always works.
The standard form
Before you can apply the method, write the equation in a standard form.
First-Order Linear Form
A first-order linear differential equation is one that can be written as
where P(x) and Q(x) are functions of x alone. The equation is called linear because y and its derivative appear only to the first power — no y^2, no \sin y, no (dy/dx)^2.
How to recognise it. You need dy/dx to appear with a coefficient of 1, a term with y multiplied by something that is purely a function of x, and a right-hand side that is also purely a function of x. Any linear equation can be massaged into this form by dividing through by the coefficient of dy/dx.
Example. Is x\,\frac{dy}{dx} + 3y = x^2 linear? Yes. Dividing by x:
This matches the standard form with P(x) = 3/x and Q(x) = x.
Example. Is \frac{dy}{dx} + y^2 = x linear? No — the y^2 makes it nonlinear. You cannot solve it with the integrating factor method.
The trick: multiply by the right thing
Here is the core idea. Look at the left-hand side:
This looks kind of like a derivative of a product — specifically, the derivative of y times something. By the product rule,
If you multiply the left side of your equation by \mu(x), you get
For this to equal \frac{d}{dx}(\mu y) = \mu y' + \mu' y, you need
That is a differential equation for \mu. And it is a really simple one — it is separable:
This \mu(x) is called the integrating factor. It is the magic function that, when you multiply the original equation by it, turns the left side into a single derivative.
The full method in four steps
Integrating Factor Method
To solve \dfrac{dy}{dx} + P(x)\,y = Q(x):
Step 1. Compute the integrating factor \mu(x) = e^{\int P(x)\,dx}.
Step 2. Multiply both sides of the equation by \mu(x). The left side becomes \dfrac{d}{dx}\bigl(\mu(x)\,y\bigr).
Step 3. Integrate both sides with respect to x:
Step 4. Divide by \mu(x):
That is the general solution.
Why this always works. The integrating factor \mu(x) = e^{\int P\,dx} was constructed precisely so that \mu' = \mu P. When you multiply the equation by \mu, the left side
is exactly \mu y' + \mu' y, which is (\mu y)' by the product rule. So the equation collapses into
and you can integrate directly. No separation, no cleverness beyond the one-time construction of \mu.
The method at work
Back to the cup of tea with k = 0.1 (so the equation is T' + 0.1 T = 2 + 0.2 t):
Step 1. Compute \mu(t). Here P(t) = 0.1 (a constant), so \int P\,dt = 0.1 t and \mu(t) = e^{0.1 t}.
Step 2. Multiply:
The left side is \frac{d}{dt}(e^{0.1 t}\,T).
Step 3. Integrate:
The right-hand integral: by parts or direct antidifferentiation,
(the second uses integration by parts: u = 0.2 t, dv = e^{0.1 t}\,dt). Adding:
So e^{0.1 t}\,T = 2t\,e^{0.1 t} + C.
Step 4. Divide by e^{0.1 t}:
At t = 0 the tea is 90°C, so 90 = 0 + C, giving C = 90. The solution:
As t \to \infty, the exponential decays and T(t) tracks 2t — the tea's temperature eventually matches the linearly-rising room. The starting 90° slowly bleeds away; after that, the tea follows the room.
This is the kind of problem you cannot solve by separation. The integrating factor method handles it in one pass.
Worked examples
Example 1: Solve dy/dx + 2y = e^x
Step 1. Identify P and Q.
The equation is already in standard form: P(x) = 2, Q(x) = e^x.
Why: the left side is y' + 2y, matching \frac{dy}{dx} + P(x)y with P(x) = 2 (a constant). The right side is e^x, so Q(x) = e^x. The equation is linear.
Step 2. Compute the integrating factor.
Why: \int 2\,dx = 2x + C, and any constant in the exponent just multiplies \mu by a harmless constant factor, so drop it. The integrating factor is e^{2x}.
Step 3. Multiply both sides by \mu.
The left side collapses to a derivative:
Why: by construction, multiplying by \mu makes the left side equal to (\mu y)'. You should always verify this mentally or on paper: (e^{2x}y)' = 2e^{2x}y + e^{2x}y', which matches what is on the left.
Step 4. Integrate both sides with respect to x.
Why: the integral of e^{3x} is \frac{e^{3x}}{3}. The constant of integration C records all the possible particular solutions.
Step 5. Solve for y.
Why: dividing by e^{2x} is the same as multiplying by e^{-2x}. The e^{3x} and e^{-2x} combine to give e^x.
Result: y = \dfrac{e^x}{3} + C\,e^{-2x} where C is arbitrary.
The structure of the answer — particular solution plus decaying transient — is typical of linear ODEs. You will see this pattern everywhere in physics and engineering: the long-term behaviour is the particular solution, and the initial conditions only affect the transient.
Example 2: Solve x·dy/dx − 3y = x³, with y(1) = 0
Step 1. Put the equation in standard form.
Divide both sides by x (assuming x \neq 0):
Now P(x) = -3/x and Q(x) = x^2.
Why: the standard form requires a coefficient of 1 in front of dy/dx. Dividing through by x achieves this and reveals the true P and Q.
Step 2. Compute the integrating factor.
Why: using the log identity a\ln b = \ln b^a lets you collapse the logarithm inside the exponential. e^{\ln u} = u, so the integrating factor is x^{-3}. This is much cleaner than leaving it as e^{-3\ln|x|}.
Step 3. Multiply through by \mu.
The left side equals \frac{d}{dx}(x^{-3}y):
Why: by the product rule, (x^{-3}y)' = -3x^{-4}y + x^{-3}y', which matches the left side of the equation after multiplication. The integrating factor has done its job.
Step 4. Integrate both sides.
Why: the integral of 1/x is \ln|x|. The constant of integration appears on the right.
Step 5. Solve for y and apply the initial condition.
At x = 1: y = 1 \cdot (\ln 1 + C) = C. The initial condition y(1) = 0 gives C = 0.
Particular solution: y = x^3 \ln|x|.
Why: the initial condition pins down one specific member of the solution family. Substituting the condition into the general solution and solving for C is the standard last step of every IVP.
Result: y = x^3 \ln|x|.
Common confusions
-
"The integrating factor is unique." It is only unique up to a multiplicative constant. If \mu is an integrating factor, so is c\mu for any nonzero constant c. You drop the constant of integration when computing \int P\,dx because it would only multiply \mu by a harmless factor that cancels out in the final answer.
-
"I can apply the method to nonlinear equations." No — the trick depends on the equation being linear. If you see y^2 or \sin y or (y')^2, the integrating factor method does not apply directly. Some of those equations can be transformed into linear form (Bernoulli's equation is the classic example, covered in the next article), but the original nonlinear equation cannot be solved this way.
-
"The integrating factor has to contain \ln or e." It does contain e — by definition \mu = e^{\int P\,dx} — but the exponential often simplifies. For example, \mu = e^{\ln x} = x. Or \mu = e^{2x} stays as is. The exponential is just a bookkeeping device; the actual function can be anything.
-
"I should integrate both sides without multiplying by \mu first." The whole point of \mu is to make the left side a perfect derivative. If you skip the multiplication, the left side is not (uv)' of anything — you have a term P(x)y that is not the derivative of anything you can easily write down. Always multiply first, then integrate.
-
"If P is hard to integrate, the method fails." The method technically still works, but your integrating factor will contain an unevaluated integral. If P(x) = \sin(x^2), then \mu(x) = e^{\int\sin(x^2)\,dx}, and \int\sin(x^2)\,dx is not elementary. In such cases you may have to leave the answer in integral form or evaluate numerically.
Going deeper
If you can execute the integrating factor method on any linear ODE you meet, you have the essentials. The rest of this section connects the technique to the wider theory of linear operators and explains why the method is not really a trick at all.
The linear operator view
Define L to be the operator "take the derivative and then add P(x) times the original": L[y] = y' + Py. Then the equation is simply L[y] = Q.
The key property of L: it is linear. That means for any two functions y_1 and y_2 and any constants a and b,
This is exactly the property that makes superposition work. If y_p is any particular solution to L[y] = Q, and y_h is any solution to the homogeneous equation L[y] = 0, then
So y_p + y_h is also a solution. And every solution is of this form. The general solution to L[y] = Q is
For first-order linear equations, y_h is the solution to y' + Py = 0 — which is separable. Its general solution is y_h = Ce^{-\int P\,dx}. And a particular solution y_p can be found by the variation-of-parameters formula (which the integrating factor method is essentially a shortcut for). This structure — general = particular + homogeneous — generalises to higher-order linear equations and systems.
Where the exponential comes from
Why an exponential integrating factor? Because the homogeneous equation y' + Py = 0 is solved by y = e^{-\int P\,dx}, and multiplying through by the reciprocal of this is what turns the left side of the original equation into a perfect derivative.
Another way to see it: the integrating factor \mu is a change of variable. Setting u = \mu y, the equation becomes u' = \mu Q, which is a trivial integration. The integrating factor is the change of variable that trivialises the equation.
Integrating factor for equations in differential form
Linear equations are sometimes written as M(x, y)\,dx + N(x, y)\,dy = 0. In this form, linearity means M and N have specific shapes: M = P(x)y - Q(x) and N = 1, so the equation is
The integrating factor method can be rephrased: multiply by \mu(x) = e^{\int P\,dx}, and the equation becomes exact (the subject of a later article). So the integrating factor method for linear equations is a special case of the integrating factor method for exact equations — which you will meet soon. All roads lead to exact equations eventually.
Existence and uniqueness
A foundational theorem for ODEs guarantees that the initial value problem y' + Py = Q, y(x_0) = y_0 has a unique solution on any interval where P and Q are continuous. This is the Picard-Lindelöf theorem applied to the linear case. The integrating factor method not only finds the solution — it finds the unique solution, and proves it exists by explicit construction.
The full Picard theorem applies to nonlinear first-order equations too, but existence is only guaranteed locally (in a small interval around x_0) and the proof uses an iterative method that rarely produces a closed-form answer. Linear equations are the best-behaved family of ODEs, and the integrating factor method exploits their structure completely.
Where this leads next
You now have a complete method for first-order linear ODEs. The next few articles extend this power in two directions: to equations that look nonlinear but can be reduced to linear form, and to equations that are not linear at all but still admit closed-form solutions.
- First Order - Reducible to Linear — Bernoulli's equation y' + Py = Qy^n is nonlinear, but a simple substitution turns it into a linear equation.
- First Order - Exact Equations — equations where the left side is already a total differential, so you integrate once directly.
- First Order - Variable Separable — the simpler cousin of linear equations, which you should try first whenever the equation permits.
- Differential Equations Introduction — the overview of what a differential equation is, what "solving" means, and where these methods fit.
- Second Order - Homogeneous — the next step up, where the linear operator L has two derivatives instead of one.