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?

  • $\begingroup$ Do you mean $\frac{dy}{dx}$ rather than $\frac{dx}{dy}$? $\endgroup$
    – John_dydx
    Sep 8, 2015 at 5:17
  • $\begingroup$ yes I did thank you $\endgroup$
    – Lauren
    Sep 8, 2015 at 5:18
  • $\begingroup$ I guessed as much. $\endgroup$
    – John_dydx
    Sep 8, 2015 at 5:20

1 Answer 1


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$$


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

  • $\begingroup$ So you basically multiply by $x$ such that it becomes an exact differential equation? $\endgroup$ Sep 8, 2015 at 12:34
  • $\begingroup$ I've multiplied by $x^2$ which is the integrating factor. $\endgroup$
    – John_dydx
    Sep 8, 2015 at 12:47
  • $\begingroup$ but your first equation you divided by $x$ relative to the differential equation in OP. $\endgroup$ Sep 8, 2015 at 12:50
  • $\begingroup$ @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. $\endgroup$
    – John_dydx
    Sep 8, 2015 at 13:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .