Integrating $\int \frac{\sin x-\cos x}{(\sin x+\cos x)\sqrt{(\sin x \cos x + \sin^2x\cos^2x)}}\,dx$

I came across a question today...

Integrate $\int \dfrac{\sin x-\cos x}{(\sin x+\cos x)\sqrt{(\sin x \cos x + \sin^2x\cos^2x)}}\,dx$

How to do it? I tried
1. to take $\sin x \cos x =t$ but no result
2. to convert the thing in the square root into $\sin x +\cos x$ so that I could take $\sin x + \cos x = t$ but then something I got is $\int\frac{-2}{t|t+1|\sqrt{t-1}}\,dt$. Now I don't know how to get past through it.

• take $y = \tan^{-1}(\sqrt{t-1})$. – Yimin Mar 1 '16 at 19:56
• If your substitution is correct then define $u:=\sqrt{t-1}$ $$\int\frac{-2}{t(t+1)\sqrt{t-1}}\ dt = -4 \int \frac{1}{(u^2+1)(u^2+2)} du$$ and by partial fractions you get $$=-4 \int \left(\frac{1}{u^2+1} - \frac{1}{u^2+2} \right) du$$ These are now pretty standard integrals. – Fritz Mar 1 '16 at 20:04

Notice, $$\int\frac{\sin x-\cos x}{(\sin x+\cos x)\sqrt{\sin x\cos x+\sin^2 x\cos^2x}}\ dx$$ $$=\int\frac{\sin x-\cos x}{(\sin x+\cos x)\sqrt{\frac{(\sin x+\cos x)^4-1}{4}}}\ dx$$ $$=2\int\frac{(\sin x-\cos x)dx}{(\sin x +\cos x)\sqrt{(\sin x+\cos x)^4-1}}$$ let $\sin x+\cos x=t\implies (\cos x-\sin x)\ dx=dt$, $$=-2\int\frac{dt}{t\sqrt{t^4-1}}$$ let $t^4-1=u^2\implies 4t^3\ dt=2u\ du$, $$=-2\int\frac{udu}{2u(u^2+1)}$$ $$=-\int\frac{du}{1+u^2}$$$$=-\tan^{-1}(u)+C$$ $$=-\tan^{-1}\left(\sqrt{t^4-1}\right)+C$$ $$=-\tan^{-1}\left(2\sqrt{\sin x\cos x+\sin^2x\cos^2 x}\right)+C$$
• are you sure that numerator in the given integral is $\sin x-\cos x$ or it's $\cos x-\sin x$? – Harish Chandra Rajpoot Mar 1 '16 at 20:41