Cracking Equations: The Integrating Factor Method for Solving y'(x) + a(x) y(x) = b(x)

When tackling differential equation, such as the one given by

(4+t)s' + s = \frac{4+t}{4},

It is easy to recognize that the left side represents the derivative of a product. Namely,

((4+t)\cdot s)'.

Then emerges from

((4+t)s)' = \frac{4+t}{4} \implies (4+t)s = \displaystyle \int \frac{4+t}{4}\;dt.

is

s = \frac{\displaystyle\int \frac{4+t}{4}\; dt}{4+t} = \frac{t+\frac{t^2}{8} + C}{4+t}.

However, not every case is as straightforward. Take, for instance,

x\cdot y' - y = x^3.

The left side does not immediately express a derivative of product.

Dividing both sides by x doesn’t help much either:

y' - \frac{1}{x}\cdot y = x^2.

Yet, by multiplying both sides by e^{-\log(x)}, we get

e^{-\log(x)}\cdot y' + \underbrace{e^{-\log(x)}\cdot (-\frac{1}{x})}_{(e^{-\log(x)})'} y =e^{-\log(x)}\cdot x^2.

The left side is evidently the derivative of e^{-\log(x)}\cdot y:

(e^{-\log(x)}\cdot y)'.

Thus, we have

(e^{-\log(x)}\cdot y) ' = e^{-\log(x)}\cdot x^2,

and it follows that

e^{-\log(x)}\cdot y = \displaystyle\int e^{-\log(x)}\cdot x^2\;dx.

Since e^{-\log(x)} = e^{\log(1/x)} = \frac{1}{x}, it gives

\frac{1}{x}y=\displaystyle\int\frac{1}{x}\;dx = \int x\;dx = \frac{x^2}{2} + C.

In other words,

y = \frac{x^3}{2} + Cx.

To solve a general 1st order linear differential equation

y' + a(x)y = b(x),

we proceed as follows:

Multiplying both sides by e^{\int a(x) dx}, we obtain the transformed equation:

\underbrace{e^{\int a(x)dx}\cdot y' + e^{\int a(x) dx} a(x)\cdot y}_ {(e^{\int a(x) dx}\cdot y)'}=b(x)\cdot e^{\int a(x) dx}.

i.e.,

(e^{\int a(x) dx}\cdot y)' = b(x)\cdot e^{\int a(x) dx}.

It implies the following integral form:

e^{\int a(x)dx}\cdot y = \displaystyle\int b(x)\cdot e^{\int a(x) dx}\;  dx + C

which can be further simplified to:

y = e^{-\int a(x)dx}\left(\displaystyle\int b(x) e^{\int b(x) dx } dx + C \right).