ODE using integrating factor

So I have started learning ODEs for the first time.

I need to find the general solution of the differential equation $$x \frac{dy}{ dx} + 2y = 3x$$ where the solution satisfying the initial condition $y(1) = 5$.

Should I be using the integrating factor method to solve this?

• Do you mean $\frac{dy}{dx}$ rather than $\frac{dx}{dy}$? Sep 8 '15 at 5:17
• yes I did thank you Sep 8 '15 at 5:18
• I guessed as much. Sep 8 '15 at 5:20

You can use the method of integrating factors:

First divide through by x:

$$\frac{dy}{dx} + \frac{2}{x}y = 3$$

Integrating factor: $e^{\ln x^2}= x^2$

Multiply through by $x^2$

$$x^2 \frac{dy}{dx}+ 2xy = 3x^2$$

$$\frac{d}{dx}\left(x^2y\right) = 3x^2$$

Integrating through wrt x:

$$x^2 y = x^3 + c$$

where $c$ is an arbitrary constant

$$y = x+cx^{-2}$$

Use the initial condition $y(1) = 5$ to find a value for c:

$$5 = 1+c$$

$$c = 4$$

Solution:

$$y = x+ \frac{4}{x^2}$$

• So you basically multiply by $x$ such that it becomes an exact differential equation? Sep 8 '15 at 12:34
• I've multiplied by $x^2$ which is the integrating factor. Sep 8 '15 at 12:47
• but your first equation you divided by $x$ relative to the differential equation in OP. Sep 8 '15 at 12:50
• @fibonatic, yes you're correct. This would make it in effect multiplying through by x. Generally speaking, you need to express the ODE in this form to make it easier to find the integrating factor. In this case, it was fairly easy to find-not always the case. Sep 8 '15 at 13:05