# How do you solve 1+x-1/x=dy/dx+y(1-1/x^2)?

Aug 19, 2017

See below.

#### Explanation:

This is a non-homogeneous linear differential equation. After multiplying by ${x}^{2}$ we get

${x}^{2} y ' + \left({x}^{2} - 1\right) y = {x}^{3} + {x}^{2} - x$

Considering the homogeneous solution

${x}^{2} y {'}_{h} + \left({x}^{2} - 1\right) {y}_{h} = 0$ which is separable, we get at

$\frac{{\mathrm{dy}}_{h}}{{y}_{h}} = - \frac{{x}^{2} - 1}{x} ^ 2 \mathrm{dx}$ and after integrating both sides

${\log}_{e} {y}_{h} = - \left(\frac{1}{x} + x + {C}_{1}\right)$ and then

${y}_{h} = {C}_{2} {e}^{- x - \frac{1}{x}}$

For the particular solution we make ${y}_{p} = {C}_{2} \left(x\right) {e}^{- x - \frac{1}{x}}$ and after substituting into the complete equation we get

$x \left(1 - x \left(1 + x\right) + {e}^{- x - \frac{1}{x}} x {C}_{2} ' \left(x\right)\right) = 0$

or

${C}_{2} ' \left(x\right) = \frac{{e}^{\frac{1}{x} + x} \left(- 1 + x + {x}^{2}\right)}{x}$ and integrating

${C}_{2} \left(x\right) = x {e}^{\frac{1}{x} + x} + {C}_{3}$ and finally

$y = {y}_{h} + {y}_{p} = {e}^{- x - \frac{1}{x}} \left(x {e}^{\frac{1}{x} + x} + {C}_{3}\right) = x + {C}_{3} {e}^{- x - \frac{1}{x}}$