# What is a solution to the differential equation dy/dx=x-y?

Jul 10, 2016

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

#### Explanation:

$\frac{\mathrm{dy}}{\mathrm{dx}} = x - y$

not separable, not exact, so set it up for an integrating factor

$\frac{\mathrm{dy}}{\mathrm{dx}} + y = x$

the IF is ${e}^{\int \mathrm{dx}} = {e}^{x}$ so

${e}^{x} \frac{\mathrm{dy}}{\mathrm{dx}} + {e}^{x} y = x {e}^{x}$

or

$\frac{d}{\mathrm{dx}} \left({e}^{x} y\right) = x {e}^{x}$

so

${e}^{x} y = \int x {e}^{x} \setminus \mathrm{dx} q \quad \triangle$

for the integration, we use IBP: $\int u v ' = u v - \int u ' v$

$u = x , u ' = 1$
$v ' = {e}^{x} , v = {e}^{x}$

$\implies x {e}^{x} - \int {e}^{x} \setminus \mathrm{dx}$

$= x {e}^{x} - {e}^{x} + C$

so going back to $\triangle$

${e}^{x} y = x {e}^{x} - {e}^{x} + C$

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