Differential Equations

Solve the differential equation $\;$ $x \; \dfrac{dy}{dx} - y = \left(1 + x\right) e^{-x}$


The given differential equation is $\;$ $x \; \dfrac{dy}{dx} - y = \left(1 + x\right) e^{-x}$

i.e. $\dfrac{dy}{dx} - \dfrac{y}{x} = \dfrac{\left(1 + x\right) e^{-x}}{x}$ $\;\;\; \cdots \; (1)$

Equation $(1)$ is a linear differential equation in the form $\;$ $\dfrac{dy}{dx} + P \left(x\right)y = Q \left(x\right)$

Here $P \left(x\right) = - \dfrac{1}{x}$ $\;\;\; \cdots \; (2a)$; $\;\;$ $Q \left(x\right) = \dfrac{\left(1 + x\right) e^{-x}}{x}$ $\;\;\; \cdots \; (2b)$

Integrating Factor (I.F) $= e^{\int P \left(x\right) \; dx}$

$\begin{aligned} \text{i.e. I.F} = e^{\int \frac{-1}{x} \; dx} & = e^{- \log \left|x\right|} \\\\ & = e^{\log \left|\frac{1}{x}\right|} \\\\ & = \dfrac{1}{x} \;\;\; \cdots \; (3) \end{aligned}$

According to the general solution,

$y \; e^{\int P \left(x\right) \; dx} = \displaystyle \int Q \left(x\right) \; e^{\int P \left(x\right) \; dx} \; dx$

$\therefore$ $\;$ In view of equations $(2a)$, $(2b)$ and $(3)$, the general solution of equation $(1)$ is

$\dfrac{y}{x} = \displaystyle \int \dfrac{\left(1 + x\right) e^{-x}}{x} \times \dfrac{1}{x} \; dx$

i.e. $\dfrac{y}{x} = \displaystyle \int \dfrac{\left(1 + x\right) e^{-x}}{x^2} \; dx$ $\;\;\; \cdots \; (4)$

$\begin{aligned} \text{Now, } \int \dfrac{\left(1 + x\right) e^{-x}}{x^2} \; dx & = \left(1 + x\right) e^{-x} \int \dfrac{1}{x^2} \; dx \\ & \hspace{4em} - \int \left\{\int \dfrac{1}{x^2} \; dx \times \dfrac{d}{dx} \left[\left(1 + x\right) e^{-x}\right] \right\} \; dx \\\\ & = \dfrac{- \left(1 + x\right) e^{-x}}{x} + \int \dfrac{1}{x} \left(- e^{-x} + e ^{-x} - x e^{-x}\right) \; dx \\\\ & = \dfrac{- \left(1 + x\right) e^{-x}}{x} - \int e^{-x} \; dx \\\\ & = \dfrac{- \left(1 + x\right) e^{-x}}{x} + e^{-x} + c \;\;\; \cdots \; (5) \end{aligned}$

$\therefore$ $\;$ In view of equation $(5)$, equation $(4)$ becomes

$\dfrac{y}{x} = \dfrac{- \left(1 + x\right) e^{-x}}{x} + e^{-x} + c$

i.e. $y = - \left(1 + x\right) e^{-x} + x e^{-x} + c x$

i.e. $y = - e^{-x} + cx$ $\;\;\; \cdots \; (6)$

Equation $(6)$ is the general solution of the given differential equation.