The general solution of the differential equation $e^{x} d y+\left(y e^{x}+2 x\right) d x=0$ is
A. $x e^{y}+x^{2}=C$
B. $x e^{y}+y^{2}=C$
C. $y e^{x}+x^{2}=C$
D. $y e^{y}+x^{2}=C$
The given differential equation is:
$e^{x} d y+\left(y e^{x}+2 x\right) d x=0$
$\Rightarrow e^{x} \frac{d y}{d x}+y e^{x}+2 x=0$
$\Rightarrow \frac{d y}{d x}+y=-2 x e^{-x}$
This is a linear differential equation of the form
$\frac{d y}{d x}+P y=Q$, where $P=1$ and $Q=-2 x e^{-x} .$
Now, I.F $=e^{\int P d x}=e^{\int d x}=e^{x}$
The general solution of the given differential equation is given by,
$y($ I.F. $)=\int($ Q $\times$ I.F. $) d x+\mathrm{C}$
$\Rightarrow y e^{x}=\int\left(-2 x e^{-x} \cdot e^{x}\right) d x+\mathrm{C}$
$\Rightarrow y e^{x}=-\int 2 x d x+\mathrm{C}$
$\Rightarrow y e^{x}=-x^{2}+\mathrm{C}$
$\Rightarrow y e^{x}+x^{2}=\mathrm{C}$
Hence, the correct answer is C.