Integral $\int \frac{\cos x }{2+\sin 2x} dx$ I have tried to find antiderivative of
$$ \frac{\cos x\  }{2+\sin 2x} $$
using the variable change $t= \cos x -\sin x$ with sin $\sin2x=2\sin x\cos x $. But i don't come up to its closed-form result as shown below.
How can I find its antiderivative? Thanks in advance


You can do the change $t=\dfrac{1+\sin(x)}{\cos(x)}$ to arrive to $\displaystyle \int\dfrac{2t\mathop{dt}}{t^4+2t^3+2t^2-2t+1}$
I'm joking, in fact this comes from successive changes:

*

*$\displaystyle u = \sin(x)\quad\to\quad\int\dfrac{\mathop{du}}{2+2u\sqrt{1-u^2}}$


*$\displaystyle \tanh(v)=u\quad\to\quad\int\dfrac{\mathop{dv}}{2\sinh(v)+\cosh(v)^2}$


*Finally $t=e^v$ gives the rational fraction above.

Then calculate your rational parts, and this is going ugly, but you'll find the result with all these $\sqrt{3}$ stuff: [parfrac on WoframAlpha][1]
The substitution $t=\tan(\frac x2)$ gives a similar result:
$\displaystyle \int\dfrac{(1-t^2)\mathop{dt}}{t^4-2t^3+2t^2+2t+1}$ with a not much more appealing rational fraction.
I guess both results should differ only by a constant.

Edit:
The result from WA presented by OP appears to be simpler but in fact notice that the quantities $\pm\sin(x)\mp\cos(x)+\sqrt{3}>0$, therefore $\log(-\sec(\frac x2)^2\cdots)$ is complex valued. The antiderivative has cancelling imaginary parts, only the real part should remains after simplification.
The rational fraction is more complicated but since it has only complex roots, it means the polynomials on denominator do not annulate for real values of $t$ and the antiderivative logs will be real valued.
$$\int\dfrac{2t\,dt}{\Big(t^2+t(1-\sqrt{3})+(2-\sqrt{3})\Big)\Big(t^2+t(1+\sqrt{3})+(2+\sqrt{3})\Big)}$$
Here is the final result:
$$\frac{\sqrt{3}}{12}\ln\Big(t^2+t(1-\sqrt{3})+(2-\sqrt{3})\Big)-\frac{\sqrt{3}}{12}\ln\Big(t^2+t(1+\sqrt{3})+(2+\sqrt{3})\Big)\\-\frac 12\arctan\left(\frac{\sqrt{3}-1-2t}{\sqrt{3}-1}\right)-\frac 12\arctan\left(\frac{\sqrt{3}+1+2t}{\sqrt{3}+1}\right)$$
