Evaluate the indefinite integral $\int \frac{\sin^3\frac\theta 2}{\cos\frac\theta2 \sqrt{\cos^3\theta + \cos^2\theta + \cos\theta}} d\theta$ $$\int \frac{\sin^3\frac\theta 2}{\cos\frac\theta2 \sqrt{\cos^3\theta + \cos^2\theta + \cos\theta}} d\theta$$
My Attempt:
$$I = \int \frac{\sin^2\frac\theta2\cdot\sin\frac\theta2\cos\frac\theta2}{\cos^2\frac\theta2 \sqrt{\cos^3\theta + \cos^2\theta + \cos\theta}} 
d\theta \\ = \frac12 \int \frac{(1-\cos\theta)\sin\theta}{(1+\cos\theta)\sqrt{\cos^3\theta + \cos^2\theta + \cos\theta}} 
d\theta$$
$$\text{let }\cos\theta = t \implies -\sin\theta d\theta = dt$$
$$I = \frac12 \int \frac{t-1}{(t+1) \sqrt{ t^3+t^2+t } } dt $$
I am not sure how to proceed further from here. Any hints/solutions on how to resolve the cubic expression under the square root?
 A: Set $\sqrt t=y,t=y^2,dt=2y\ dy$
$$I =\int\dfrac{(y^2-1)2y}{(y^2+1)y\sqrt{y^2(y^4+y^2+1)}}dy$$
$$=2\int\dfrac{1-1/y^2}{(y+1/y)\sqrt{y^2+1+1/y^2}}dy$$
Set $\int(1-1/y^2)dy =z$
Then $\sqrt{z^2+1}=u\implies z^2+1=u^2$
A: Use $s = \frac{t-1}{t+1} \implies t = \frac{1+s}{1-s}$
$$I = \frac{1}{2}\int \frac{2s}{\sqrt{3-2s^2-s^4}}\:ds = \frac{1}{2}\int\frac{2s}{\sqrt{4-(s^2+1)^2}}\:ds = \frac{1}{2}\sin^{-1}\left(\frac{s^2+1}{2}\right)$$
Then keep reversing the substitutions
$$I = \frac{1}{2}\sin^{-1}\left(\frac{\left(\frac{t-1}{t+1}\right)^2+1}{2}\right) = \frac{1}{2}\sin^{-1}\left(\frac{t^2+1}{(t+1)^2}\right)$$
$$\implies I = \frac{1}{2}\sin^{-1}\left[\frac{1}{4}\sec^4\left(\frac{\theta}{2}\right)-\tan^2\left(\frac{\theta}{2}\right)\right]+C$$
A: Following from your approach
\begin{align}I=\frac{1}{2}\int \frac{(t-1)(t+1)}{(t+1)^2\sqrt{t^3+t^2+t}}\,dx=\frac{1}{2}\int \frac{t^2(1-\frac{1}{t^2})}{t(t+\frac{1}{t}+2)t\sqrt{t+\frac{1}{t}+1}}\,dx\\=\frac{1}{2}\int \frac{(1-\frac{1}{t^2})}{(t+\frac{1}{t}+2)\sqrt{t+\frac{1}{t}+1}}\,dx\end{align}
Let $t+\frac{1}{t}=u; \,du=1-\frac{1}{t^2}$ Then:
\begin{align}I=\frac{1}{2}\int\frac{\,du}{(u+2)\sqrt{u+1}}\end{align}
Let $u+1=t^2, 2\,dt=\frac{\,du}{t}$. Then:
\begin{align}I=\int \frac{\,dt}{t^2+1}=\arctan(\sqrt{u+1})=\arctan(\sqrt{\cos(x)+\sec(x)+1})\end{align}
