Solve the differential equation $(x^2+y^2+2x)dx+2ydy=0.$
My solution goes like this:
We find that the given equation is of the form $Mdx+Ndy=0$ and $\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{ N}=\frac {2y}{2y}=1.$ This means $\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{ N}$ can be considered a function of $x$, i.e $f(x)=\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{ N}=1$ and hence the integrating factor is $e^{\int f(x)dx}=e^x.$ Thus, on multiplying $e^x$ on the given equation, i.e $$e^x(x^2+y^2+2x)dx+2e^xydy=0,$$ we obtain, an exact differential equation. The solution of this exact differential equation is $$\int (e^x(x^2+y^2+2x))dx=c\implies \int e^xx^2+y^2x+x^2=c\implies x^2e^x-3xe^x+2e^x+y^2x+x^2=c.$$
Is the above solution, correct? If not, where is it going wrong?
$$e^x(x^2+y^2+2x)dx+2e^xydy=0,$$ This last line is perfectly correct but then you have to check your integral calculation : $$I=\int (e^x(x^2+y^2+2x))dx$$ $$I=\int e^x(x^2+2x)dx+e^xy^2$$ $$I=\int (e^xx^2)'dx+e^xy^2$$ $$\implies I=e^x(x^2+y^2)+C_1(y)$$ Then: $$e^x(x^2+y^2)=C$$