Example Solve the following initial value problem.

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

Write this in the standard form.

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

This is a Bernoulli's equation. Then we multiply $y^{-2}$ to both sides of the equation and simplify to get

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

Now we put $u = y^{1-2} = y^{-1}$. Then $u^{\prime} = -y^{-2}y^{\prime}$ and

$\displaystyle - u^{\prime} - \frac{1}{x} u = - \frac{1}{x} $

This differential equation is linear in $u$. Rewrite this in the standard form in $u$

$\displaystyle u^{\prime} + \frac{1}{x} u = \frac{1}{x} $

Now find the integrating factor $\mu$. Then $\mu = \exp(\int (1/x) dx) = \exp(\log{x}) = x$. We multiply $\mu$ to both sides of the equation. Then the left-side is a derivative of the product of $\mu$ times the dependent variable $x$. Thus we have

$\displaystyle ( x u)^{\prime} = 1 $

We integrate the above equation with respect to $x$

$\displaystyle xu = \int 1 dx = x + c $

$\displaystyle u = \frac{x + c}{x} $

Since $u = y^{-1}$, we have

$\displaystyle y^{-1} = \frac{x + c}{x}$

Here we apply the initial condition $y(1) = 1$ to obtain

$\displaystyle y^{-1} = \frac{x + 1}{x}$