# Calculation of Integrating factor for non exact differential equation.

Differential equation $$ydx+(2x-ye^y)dy=0$$ has an integrating factor $$\mu(x,y)=x^my^n$$ for constants $$m$$ and $$n$$. Determine $$\mu(x,y)$$.

I tried to solve using the formula $$M\frac {\partial\mu}{\partial y}-N\frac {\partial\mu}{\partial x}=(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y})\mu$$. But still I didn't managed to find the $$\mu(x,y)$$.

The answer says $$\mu(x,y)=y$$.

But I want to know the steps to find this. I can solve the differential equation with $$\mu(x,y)=y$$. So please help me for finding the integrating factor $$\mu(x,y)$$.

Another method.

Since you know the integrating factor $$\mu$$ is of the form $$x^{m}y^{n}$$, multiply the differential equation by $$x^{m}y^{n}$$ to obtain $$x^{m}y^{n+1}dx+(2y^{n}x^{m+1}-x^{m}y^{n+1}e^{y})dy=0$$

For the differential equation to be exact we want $$\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$$

that is $$(n+1)y^{n}x^{m}=2(m+1)y^{n}x^{m}-mx^{m-1}y^{n+1}e^{y}$$

Since there are no $$e^{y}$$ terms on the LHS we choose $$m=0$$ which gives $$(n+1)y^{n}x^{0}=2y^{n}x^{0}$$ $$(n+1)y^{n}=2y^{n}$$

Thus $$n=1$$ and we have $$\mu(x,y)=y$$ as required.

See this also.

Because you already know that $$\mu = x^m y^n$$, you can simply plug everything in to that formula. $$M$$ is equal to $$y$$, $$N$$ is equal to $$2x-ye^y$$, so the equation is $$y\left(nx^my^{n-1}\right)-\left(2x-ye^y\right)\left( mx^{m-1}y^n \right)=(2-1)x^my^n$$

Grouping into like terms makes it $$(n-1-2m)x^m y^n + me^y x^{m-1}y^{n+1} = 0$$

For it to be $$0$$ for all $$x, y$$, each term must be $$0$$. Therefore, $$n-1-2m=0$$ and $$m = 0$$. This then means that $$y = 1$$, and the answer is $$x^0 y^1 = y$$

Letting $$M=y, N=2x−ye^y$$ in $$M\frac {\partial\mu}{\partial y}-N\frac {\partial\mu}{\partial x}=(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y})\mu$$ one has $$y\frac {\partial\mu}{\partial y}-(2x−ye^y)\frac {\partial\mu}{\partial x}=\mu.$$ If $$\mu$$ is a function of $$x$$, one obtains $$-(2x−ye^y)\frac {\partial\mu}{\partial x}=\mu$$ which contains $$y$$; namely $$\mu$$ can't be a function of $$y$$. If $$\mu$$ is a function of $$y$$, one obtains $$y\frac {\partial\mu}{\partial y}=\mu$$ which can be solved easily to get $$\mu=Cy$$.

$$ydx+(2x-ye^y)dy=0$$ Another way: $$(ydx+2xdy)-ye^ydy=0$$ Multiply by $$y$$: $$(y^2dx+xdy^2)-y^2e^ydy=0$$ $$d(xy^2)-y^2e^ydy=0$$ $$xy^2 =\int y^2e^ydy$$ Integrate.