# How to Solve a Differential Equation Using Integrating Factors

### First-Order Nonhomogeneous Differential Equations

In physics and engineering problems, differential equations of the form

y' + f(x)y = g(x)

often arise. These first-order nonhomogeneous equations may look difficult at first glance, but they can be quickly solved by multiplying both sides of the equation by an integrating factor.

The integrating factor converts the left-hand side into a derivative, so the whole problem can be solved by integration.

### The Method

First, multiply both sides of the diff. eq. by the function eF(x), where F(x) = f(x) dx, or equivalently F'(x) = f(x).

eF(x)y' + eF(x)f(x)y = eF(x)g(x)

Notice that the left-hand side is now the derivative of eF(x)y by the product rule for differentiation. This means that we can rewrite the equation as

[eF(x)y]' = [eF(x)g(x) dx]'

And now it can be solved by integration and simple algebra:

eF(x)y = eF(x)g(x) dx
y = [eF(x)g(x) dx]/eF(x)

### Example 1

Solve y' + 4x3y = ex-x4. In this case, the integrating factor is ex4 since the integral of 4x3 is x4. So we have

y' + 4x3y = ex-x4
ex4y' + ex44x3y = ex
[ex4y]' = [ex]'
ex4y = ex + c
y = ex-x4 + ce-x4

### Example 2

Solve y' - (1/x)y = ln(x). First, since the anti-derivative of -1/x is -ln(x), we determine that the integrating factor is e-ln(x) = 1/x.

y'/x - y/x2 = ln(x)/x
y/x = (1/2)ln(x)2 + c
y = (x/2)ln(x)2 + cx