Example Solve the following initial value problem.

$\displaystyle xy^{\prime} + 2y = x^{2}, y(1) = 1$

Answer This differential equation is 1st-order linear.Write this in the standard form.

$\displaystyle y^{\prime} + \frac{2}{x}y = x $

Integrating factor $\mu$ is

$\displaystyle \mu = e^{\int \frac{2}{x}}dx = e^{2\log{x}} = x^{2} . $

Multiply $\mu$ to both sides of the equation.

$\displaystyle x^{2}y^{\prime} + 2xy = x^{3} . $

Now the left hand side can be expressed by the derivative of the product of the integrating factor and a dependent variable $y$.

$\displaystyle \frac{d(x^{2}y)}{dx} = x^{3} . $

Now integrate with respect to $x$ to get

$\displaystyle x^{2}y = \int x^{3}dx = \frac{x^{4}}{4} + c . $

Thus, the general solution is as follows:

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

We now apply the initial condition $y(1) = 1$ to obtain

$\displaystyle y = \frac{x^{2}}{4} - \frac{3}{4x^{2}}$