# Finding an integrating factor and solving: $(2x \sin(x + y) + \cos(x + y))dx + \cos(x + y)dy = 0$

I am trying to find an integrating factor and solve the following differential equation:

$$(2x \sin(x + y) + \cos(x + y))dx + \cos(x + y)dy = 0$$

These are my steps:

$$(2x \sin(x + y) + \cos(x + y)) + \cos(x + y)dy/dx = 0$$

I check if the equation is exact:

$$$$\partial U_{xy} = \partial U_{xy}$$$$

$$$$2x\cos \left(x+y\right)-\sin \left(x+y\right) \neq -\sin \left(x+y\right),$$$$

Its not so I need to find an integrating factor such that

$$\frac{d}{dy} \left( μ(x)2x\cos \left(x+y\right)-\sin \left(x+y\right) \right)= \frac{d}{dx} \left( μ(x)-\sin \left(x+y\right) \right)$$

And at this point I simply get stuck. Any help or advice would be appreciated.

$$(2x \sin(x + y) + \cos(x + y))dx + \cos(x + y)dy = 0$$ $$2x \sin(x + y)dx +( \cos(x + y))(dx +dy) = 0$$ Substitute $$v=x+y$$ $$2x \sin(v)dx + \cos(v)dv = 0$$ It's not exact. Multiply by $$\mu=e^{x^2}$$ as integrating factor $$2xe^{x^2} \sin(v)dx + e^{x^2}\cos(v)dv = 0$$ The diffrential is exact.. $$\boxed{e^{x^2} \sin(x+y)=K}$$
Divide by $$\cos(x+y)$$. Then we have $$\big(2x+\cot(x+y)\big)\,dx+\cot(x+y)\,dy=0 \tag{1}$$ Note that $$\big(\log(\sin x)\big)'=\cot x.$$ So $$(1)$$ is equivalent to $$\frac{d}{dx}\Big(x^2+\log\big(\sin \big(x+y(x)\big)\big)\Big)=0$$
Note. You get the answer by looking for an integrating factor of the form $$\mu=\mu(x+y)$$.