<s>[INST] Integrating trig function I'm stuck at this problem:
$$ \int{\sqrt{(\sin^2 x)^2 + (2\sin x \cos x)^2}dx} = \int{\sqrt{\sin^2 x \sin^2 x + 4\sin^2 x \cos^2 x} dx}$$
I tried a few trig identities: $\sin^2 x = \frac{1-\cos 2x}{2}  $ and $ \cos^2 x = \frac{1+\cos 2x}{2} $ and $\sin^2 x + \cos^2 x = 1$. Keep hitting dead end. Any tips?
 [/INST] $$\begin{align} &\int{\sqrt{\sin^2x \sin^2x + 4\sin^2 x \cos^2 x} dx} \\ &
=\int{\sqrt{\sin^2x( \sin^2x + 4\cos^2 x)} dx} \\ &
=\begin{cases}\int{\sin x\sqrt{( \sin^2x + 4\cos^2 x)} dx} & & & &, \sin x \geq 0 \\ -\int{\sin x\sqrt{( \sin^2x + 4\cos^2 x)} dx} & & & &, \sin x < 0\end{cases} \\ &
=\begin{cases}\int{\sin x\sqrt{(1 + 3\cos^2 x)} dx} & & & & & &, \sin x \geq 0 \\ -\int{\sin x\sqrt{(1 + 3\cos^2 x)} dx} & & & & & &, \sin x < 0\end{cases} \\ &
=\begin{cases}-\frac{1}{\sqrt3}\int{\sin x\sqrt{(1 + 3\cos^2 x)} d(\sqrt3\cos x)} & , \sin x \geq 0 \\ \frac{1}{\sqrt3}\int{\sin x\sqrt{(1 + 3\cos^2 x)} d(\sqrt3\cos x)} & , \sin x < 0\end{cases}\end{align}$$
Now say $z=\sqrt3\cos x$. Then the integration becomes
$$=\begin{cases}-\frac{1}{\sqrt3}\int{\sin x\sqrt{1 + z^2} dz} & , \sin x \geq 0 \\ \frac{1}{\sqrt3}\int{\sin x\sqrt{1 + z^2} dz} & , \sin x < 0\end{cases}$$
I hope you can finish it now, using the necessary formula. The formula can be deduced using integration by parts and proper substitutions and is denoted in the linked page as no. 8. 

</s>