# Finding $\int^{\pi}_{0}\frac{1}{\sqrt{a-\cos x}}dx$

Finding $$\int^{\pi}_{0}\frac{1}{\sqrt{a-\cos x}}dx$$

Try: using $$\cos x =\frac{1-\tan^2\frac{x}{2}}{1+\tan^2\frac{x}{2}}$$

$$\int^{\pi}_{0}\frac{\sec \frac{x}{2}}{\sqrt{(a-1)+(a+1)\tan^2\frac{x}{2}}}dx$$

Could some help me to solve it , thanks

Starting from

$$I(a)=\int^{\pi}_{0}\frac{\sec \frac{x}{2}}{\sqrt{(a-1)+(a+1)\tan^2\frac{x}{2}}}\mathrm{d}x$$

Let us consider the map $x\mapsto 2x$ and factor out the $(a-1)$ term, so that

$$I(a)=\frac{2}{\sqrt{a-1}}\int_{0}^{\pi/2}\frac{\sec x}{\sqrt{1+\dfrac{a+1}{a-1}\tan^2 x}}\mathrm{d}x \\ =\frac{2}{\sqrt{a-1}}\int_{0}^{\pi/2}\frac{1}{\sqrt{\cos^2x+\dfrac{a+1}{a-1}\sin^2 x}}\mathrm{d}x \\ =\frac{2}{\sqrt{a-1}}\int_{0}^{\pi/2}\frac{1}{\sqrt{1-\sin^2x+\dfrac{a+1}{a-1}\sin^2 x}}\mathrm{d}x \\ =\frac{2}{\sqrt{a-1}}\int_{0}^{\pi/2}\frac{1}{\sqrt{1-\dfrac{2}{1-a}\sin^2 x}}\mathrm{d}x$$

By defining $m=\dfrac{2}{1-a}$, the last integral reads

$$\int_{0}^{\pi/2}\frac{1}{\sqrt{1-m\sin^2 x}}\mathrm{d}x = K(m)$$

where $K(m)$ is the complete elliptic integral of the first kind.

Finally

$$I(a) = \frac{2}{\sqrt{a-1}}K\left(\frac{2}{1-a}\right)$$

Using the substitution $t=\pi - x$ transforms the integral into $$\int_{0}^{\pi}\frac{dt}{\sqrt{a+\cos t}} =\int_{0}^{\pi}\frac{dx}{\sqrt{a+1-2\sin^2(x/2)}}=\frac{2}{\sqrt{1+a}}\int_{0}^{\pi/2}\frac{dt}{\sqrt{1-k^2\sin^2t}}$$ where $k^2=2/(a+1)$ and thus if $a>1$ then the above integral is equal to $$\frac{2}{\sqrt{1+a}}K\left(\sqrt{\frac{2}{1+a}}\right)$$