# Integrate $\int \frac {\sin (2x)}{(\sin x+\cos x)^2}\,dx$

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

My Attempt: $$=\int \frac {\sin (2x)}{(\sin x + \cos x)^2} \,dx$$ $$=\int \frac {2\sin x \cos x}{(\sin x+ \cos x)^2} \,dx$$ Dividing the numerator and denominator by $$\cos^2 x$$ $$=\int \frac {2\tan x}{(1+\tan x)^2} \,dx$$

• Based off your last integral. Try multiplying and dividing by $\sec^2(x)$ and let $u=\tan(x)$. May 6, 2019 at 13:23
• Try to avoid \dfrac or \displaystyle in titles (see meta post). May 6, 2019 at 14:04

Note that \begin{align} \int \frac {\sin (2x)}{(\sin(x)+\cos(x))^2} dx &=\int \frac {2\sin(x)\cos(x)}{\cos^2(x)(1+\tan(x))^2} dx\\ &=\int\frac {2\tan(x)}{(1+\tan(x))^2} dx\\ &=\int\left(1-\frac {1+\tan^2(x)}{(1+\tan(x))^2}\right) dx\\ &=x+\frac{1}{1+\tan(x)}+c. \end{align}

$$I=\int\frac{\sin(2x)}{(\sin(x)+\cos(x))^2}dx=\int\frac{2\sin(x)\cos(x)}{\sin^2(x)+2\sin(x)\cos(x)+\cos^2(x)}dx\tag{1}$$ $$=\int\frac{2\sin(x)\cos(x)+1-1}{2\sin(x)\cos(x)+1}dx=\int dx-\int\frac{dx}{\sin(2x)+1}=x-\int\frac{1-\sin(2x)}{\cos^2(2x)}dx\tag{2}$$ $$=x-\int\sec^2(2x)dx+\int\frac{\sin(2x)}{\cos^2(2x)}dx\tag{3}$$

Enforce the substitution $$u=\cos(2x)$$ on the second integral so that $$du=-2\sin(2x)dx$$.

$$(1):\text{Recall}\space\sin(2x)=2\sin(x)\cos(x)\space\text{and}\space(a+b)^2=a^2+2ab+b^2$$

$$(2):$$ $$\frac{\sin(2x)}{\sin(2x)+1}=\frac{\left(\sin(2x)+1\right)-1}{\sin(2x)+1}=\frac{\sin(2x)+1}{\sin(2x)+1}-\frac{1}{\sin(2x)+1}=1-\frac{1}{1+\sin(2x)}\cdot\frac{1-\sin(2x)}{1-\sin(2x)}$$

$$(3):$$ For $$\int\sec^2(2x)dx$$, let $$t=2x\implies dx=\frac{dt}{2}\implies\int \sec^2(2x)dx=\frac{1}{2}\int\sec^2(t)dt$$

Then $$I=x-\int \sec^2(2x)dx-\frac{1}{2}\int\frac{du}{u^2}=\boxed{x-\frac{1}{2}\tan(2x)+\frac{1}{2}\sec(2x)+C}$$

Let, $$tanx = t, \ sec^2xdx = dt \ , (1+tan^2x)dx = dt$$

$$dx = \frac{dt}{1+t^2}$$

$$I = \int{\frac{2tdt}{(1+t^2)(1+t)^2}}$$

Applying partial fractions,

$$\frac{2t}{(1+t^2)(1+t)^2} = \frac{1}{1+t^2} - \frac{1}{(t+1)^2}$$

$$I = \int{\bigg[\frac{1}{1+t^2} - \frac{1}{(t+1)^2}}\bigg]dt = tan^{-1}t + \frac{1}{(t+1)} + c$$

$$I = x +\frac{1}{tanx+1}+c$$