Evaluate $\int \frac{\sin ^3(\theta/2)}{\cos(\theta/2)\sqrt{\cos^3\theta+\cos^2\theta+\cos \theta}}d\theta$ I came about the following practice problem in a book of integration:-
$Q.$ Evaluate $$I=\int \frac{\sin ^3(\theta/2)}{\cos(\theta/2)\sqrt{\cos^3\theta+\cos^2\theta+\cos \theta}}d\theta$$ To do this, first I substituted $\cos(\theta/2)=u \implies \frac {-1}{2}\sin (\frac{\theta}2)\ d\theta=du \implies \sin^3 (\frac{\theta}2)d\theta=-2(1-u^2)\ du$. This gives $$\begin{align}I&=\int \frac{2(u^2-1)\ du}{u\sqrt{(2u^2-1)^3+(2u^2-1)^2+(2u^2-1)}}\\&=\frac 12\int \frac {(u^2-1)(4u\ du)}{u^2\sqrt{(2u^2-1)^3+(2u^2-1)^2+(2u^2-1)}}\end{align}$$ Now substitute $z=2u^2-1 \implies dz=4u\ du$. We have $u^2=\frac {z+1}2 \implies u^2-1=\frac {z-1}2$. Hence $$\begin{align}I&=\int \frac {{{z-1}\over2}\ dz}{(\frac {z+1}2)\sqrt{z^3+z^2+z}}\\&=\int \frac{(z-1)\ dz}{(z+1)\sqrt{z^3+z^2+z}}\\&=\int \left[\frac{1}{\sqrt{z^3+z^2+z}}-\frac2{(z+1)\sqrt{z^3+z^2+z}}\right]\ dz\end{align}$$ I don't know how to proceed further. Some hints would be appreciated. Is there any easier way to integrate the given expression? I also tried substituting $\tan (\theta/2)=u$, but it becomes even more messier than what I have shown here. 
 A: Let $$\displaystyle I = \int \frac{\sin ^3(\theta/2)}{\cos(\theta/2)\sqrt{\cos^3\theta+\cos^2\theta+\cos \theta}}d\theta = \frac{1}{2}\int\frac{2\sin^2 \frac{\theta}{2}\cdot 2\sin \frac{\theta}{2}\cdot \cos \frac{\theta}{2}}{2\cos^2 \frac{\theta}{2}\sqrt{\cos^3 \theta+\cos^2 \theta+\cos \theta}}d\theta$$
So we get $$\displaystyle I = \frac{1}{2}\int\frac{(1-\cos \theta)\cdot \sin \theta}{(1+\cos \theta)\sqrt{\cos^3 \theta+\cos^2 \theta+\cos \theta}}d\theta$$
Now Put $\cos \theta = t\;,$ Then $\sin \theta d\theta = -dt$
So Integral $$\displaystyle I = -\frac{1}{2}\int\frac{(1-t)}{(1+t)\sqrt{t^3+t^2+t}}dt = -\frac{1}{2}\int\frac{(1-t^2)}{(1+t)^2\sqrt{t^3+t^2+t}}dt$$
So we get $$\displaystyle I = \frac{1}{2}\int\frac{\left(1-\frac{1}{t^2}\right)}{\left(t+\frac{1}{t}+2\right)\sqrt{t+\frac{1}{t}+1}}dt$$
Now Let $\displaystyle \left(t+\frac{1}{t}+1\right) = u^2\;,$ Then $\left(1-\frac{1}{t^2}\right)dt = 2udu$
So Integral $$\displaystyle I = \frac{1}{2}\int\frac{2u}{u^2+1}\cdot \frac{1}{u}du = \tan^{-1}(u)+\mathcal{C}$$
So we get $$\displaystyle I = \tan^{-1}\sqrt{\left(t+\frac{1}{t}+1\right)}+\mathcal{C}$$
So we get $$\displaystyle \displaystyle I = \tan^{-1}\sqrt{\left(\cos \theta+\sec \theta+1\right)}+\mathcal{C}$$
