A cumbersome integral I'm trying to self-study calculus of variation, and while solving a physics problem of cycloid motion I have encountered an integral I don't know how to fully solve. I know from the textbook the final answer should be $\pi \sqrt\frac{a}{g}$ but I get nowhere near:
$$t = \sqrt{\frac{a}{g}} \int_{\theta_0}^{\pi} \sqrt{\frac{1-\cos\theta}{\cos\theta_0 - \cos\theta}} \, \mathrm{d}\theta $$
I changed variable to $\theta = \pi -2\alpha$:
$$t = \sqrt{\frac{a}{g}} \int_{\frac{\pi-\theta_0}{2}}^{0} \sqrt{\frac{1+\cos(2\alpha)}{\cos\theta_0 + \cos(2\alpha)}} \, (-2\mathrm{d}\alpha)$$
Now using $\cos(2\alpha) = 2\cos^2\alpha -1$ and $\cos(2\alpha) = 1-2\sin^2\alpha$ I got:
$$t = \sqrt{\frac{a}{g}} \int_{\frac{\pi-\theta_0}{2}}^{0} \frac{\cos\alpha}{\sqrt{\cos\theta_0 + 1 - 2\sin^2\alpha }} \, (-2\mathrm{d}\alpha)$$
Now I changed variable $u = \sin\alpha$:
$$t = -2\sqrt{\frac{a}{g}} \int_{\sin\left(\frac{\pi-\theta_0}{2}\right)}^{0} \frac{\mathrm{d}u}{\sqrt{\cos\theta_0 + 1 - 2u^2 }}$$
Trying to get an $\operatorname{arcosh}$ won't help me I guess, How do I proceed? Thanks alot!
 A: Here is another method: Multiplying $\sqrt{1+\cos\theta}$ and substituting $u = \cos\theta$ to write
$$ t = \sqrt{\frac{a}{g}} \int_{-1}^{\cos\theta_0} \frac{\mathrm{d}u}{\sqrt{(\cos\theta_0 - u)(u + 1)}}. $$
Now we appeal to the following general observation with $p = -1$ and $q = \cos\theta_0$:

Observation. Let $p < q$ and write $c=\frac{p+q}{2}$ and $r = \frac{q-p}{2}$. Then the upper semicircle of radius $r$ centered at $(c, 0)$ is given by the equation
$$ y = \sqrt{r^2 - (x - c)^2} = \sqrt{(q-x)(x-p)}. $$
So, the arc-length differential along the upper-semicircle satisfies
$$ \mathrm{d}s = \sqrt{1 + (y')^2} \, \mathrm{d}x = \frac{r}{\sqrt{(q-x)(x-p)}} \, \mathrm{d}x. $$
This tells that
$$ \int_{p}^{q} \frac{\mathrm{d}x}{\sqrt{(q-x)(x-p)}} = \frac{\text{[length of the upper semicircle]}}{r} = \pi. \tag{*} $$

Of course, $\text{(*)}$ can be derived purely by calculus. Motivated by the geometric observation above, we may substitute $x = c + ru = \frac{p+q}{2} + \frac{q-p}{2}u$ to write
$$ \int_{p}^{q} \frac{\mathrm{d}x}{\sqrt{(q-x)(x-p)}}
= \int_{-1}^{1} \frac{\mathrm{d}u}{\sqrt{1-u^2}}
= \left[\arcsin(u)\right]_{-1}^{1}
= \pi. $$
A: Without checking all the details, your steps seem correct.
Now, the integral at the very end is of the form
$$\int\frac{1}{\sqrt{a^2-b^2x^2}}\,dx$$
which you can compute via a simple substitution using the tabulated integral
$$\int\frac{1}{\sqrt{1-x^2}}\,dx=\arcsin(x)+C$$
