Let \( g \) and \( h \) be continuous functions. The form of the following first order linear differential equation is solvable using an integrating factor.
$$\frac{dy}{dx} + g y = h$$
The left side of the equation almost looks like the result of the product rule. For example, if \(j\left(x \right) = \mu \left(x \right) y\left(x \right)\) then
$$\frac{dj}{dx} = \mu \frac{dy}{dx} + \frac{d \mu }{dx} y$$
Comparing
suggests that if there exists a function \( \mu \left(x \right) \) such that
$$\frac{d \mu}{dx} = \mu g$$
then multiplying both sides of the original differential equation by \( \mu \left(x \right) \) yields
$$\mu \frac{dy}{dx} + \mu g y = \mu h$$
and since \(\frac{d \mu}{dx} = \mu g \)
$$\mu \frac{dy}{dx} + \mu g y = \frac{d \mu}{dx} y + \mu \frac{dy}{dx} = \frac{d}{dx} \left( \mu y \right)$$
which yields the integrable equation
$$\frac{d}{dx} \left( \mu y \right) = \mu h$$
Integrating yields a formula the for the solution to the differential equation in question
$$y = \frac{1}{\mu} \left( \int \! \mu h \ dx + C \right)$$
If this formula is to be of any practical use \( \mu \) must be determined. Recall that
$$\frac{d \mu}{dx} = \mu g$$
which is a separable differential equation. Therefore,
$$\mu = e^{ \int \! g\left(x \right) \ dx + K} = A e^{ \int \! g\left(x \right) \ dx}$$
Since the arbitrary constant will not affect the final answer it is convention to let \( A = 1 \). \( \mu \) is called the integrating factor. Substituting \( \mu \) into the general solution yields
$$y\left(x \right) = e^{ -\int \! g\left(x \right) \ dx} \left( \int \! e^{ \int \! g\left(x \right) \ dx} h\left(x \right) \ dx + C \right)$$