<s>[INST] Wolframalpha step-by-step of $\int\frac{\cos(x)}{\sqrt{2+\cos(2x)}}dx$ I wonder, where the minus sign goes after the first $u$-substitution of integral  $\displaystyle\int\frac{\cos(x)}{\sqrt{2+\cos(2x)}}dx$?
 [/INST] Rewrite $2+\cos 2x$ as $3-2\sin^2 x$ and let $u=\sin x$. We end up at 
$$\int \frac{du}{\sqrt{3-2u^2}}.$$
Let $\sqrt{2}u=\sqrt{3}{v}$. Then $du=\frac{\sqrt{3}}{\sqrt{2}}\,dv$, and we end up with 
$$\int\frac{1}{\sqrt{2}}\frac{dv}{\sqrt{1-v^2}}.$$
Thus our integral is $\frac{1}{\sqrt{2}}\arcsin v+C$. Replace $v$ by $\frac{\sqrt{2}\sin x}{\sqrt{3}}$.
</s>