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$?
 A: Integrate
$$\int \frac{\cos x}{\sqrt{2+\cos(2x)}}dx$$
Known Identity
$$\cos(2x)=1-2\sin^2(x)$$
Replacing
$$\int \frac{\cos x}{\sqrt{3-2\sin^2(x)}}dx$$
Let $u = \sin(x)$, $du = \cos(x)dx$
Substituting
$$\int \frac{u}{\sqrt{3-2u^2}}du$$
Let $z = \sqrt{3-2u^2}$
$$dz = \frac{1}{2}\frac{-4u}{\sqrt{3-2u^2}}du$$
$$dz = -\frac{2u}{\sqrt{3-2u^2}}du$$
Substituting
$$-\int \frac{1}{2}dz$$
$$=-\frac{z}{2} + C$$
Substituting back
$$=- \frac{1}{2} \sqrt{- 2 u^{2} + 3}+ C$$
Substituting back $u = \sin(x)$
$$=-\frac{1}{2}\sqrt{-2\sin^2(x)+3}+ C$$
Simplifying 
$$=-\frac{1}{2}\sqrt{2(1-\sin^2(x))+1}+ C$$
$$=-\frac{1}{2}\sqrt{2\cos^2(x)+1}+ C$$
$$=-\frac{1}{2}\sqrt{1+2\cos^2(x)}+ C$$
A: 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}}$.
