# Evaluating $\int_{0}^{\pi} \frac{1}{\sqrt{u^2+2u\cos x +1}} \mathrm{d}x$

Does the integral $$\int_0^{\pi} \frac{1}{\sqrt{u^2+2u\cos x +1}} \text d x \hspace{30pt} (u \le 1)$$ has a closed form? If it has, how do we evaluate it?

I was solving a physics problem which I have asked on physics SE as well (here), and this integral popped out. How do I solve it?

• Any restrictions on $u$? – Parcly Taxel Jan 16 at 16:35
• $u \le 1$ I suppose... – Light Yagami Jan 16 at 16:36
• Using the substitution $x=2t$ and $\cos 2t=2\cos^2t-1=1-2\sin^2t$ you can reduce it to standard elliptic integrals of first kind. – Paramanand Singh Jan 17 at 9:15
• im sorry but are you light yagami from phods? – Aditya_math Jan 19 at 15:20
• Then he might be a different person, but it is just a coincidence that I also happen to be on that server..lol (though I don't participate in it). – Light Yagami Jan 19 at 15:25

You'll need an elliptic integral for this. (I love them a lot. So much that I put together a whole monograph on them.)

Let the integral be $$I(u)$$. By symmetry we easily see that $$I(u)=I(-u)$$, so we may restrict to $$u\ge0$$. Byrd and Friedman 289.00 then gives $$I(u)=\frac2{u+1}K\left(\frac{4u}{(u+1)^2}\right)$$ If $$|u|<1$$ this may be simplified by a descending Gauss transformation to just $$2K(u^2)$$. Note that I am using the parameter $$m$$ rather than the elliptic modulus $$k=\sqrt m$$.

• I got the same with Mathematica. – Gary Jan 16 at 16:53
• I haven't studied elliptic integrals yet so I'm unable to understand what's written but at least I came to know that it doesn't have a closed form in elementary functions...xD – Light Yagami Jan 16 at 16:54
• @LightYagami See edit. – Parcly Taxel Jan 16 at 16:59
• @ParclyTaxel I found your article very useful, thank you! – Henry Lee Jan 16 at 17:09


If you are not too familiar with elliptic integrals or have problems to compute them, you could use $$2\,K(u^2)=\pi\, \sum_{n=0}^\infty a_n u^{2n}$$ with

$$a_n=\Bigg[\frac{ (2 n)!}{2^{2 n}\,(n!)^2}\Bigg]^2$$ the computation being simple since $$a_{n+1}=\frac{(2 n+1)^2}{4 (n+1)^2}\, a_n$$

For the case where $$u$$ is close to $$1$$, it is much better to use $$2\,K(u^2)=\log \left(\frac{8}{1-u}\right)+\frac{1}{2} (u-1) \left(\log \left(\frac{1-u}{8}\right)+1\right)+\frac{1}{16} (u-1)^2 (-5 \log (1-u)-7+15 \log (2))+\frac{1}{96} (u-1)^3 (21 \log (1-u)+34-63 \log (2))+\frac{(u-1)^4 (-1014 \log (1-u)-1775+3042 \log (2))}{6144}+O\left((u-1)^5\right)$$ which is extremely good for $$u \geq \frac 34$$.

• It is nice but would it work for $u>1?$ – Light Yagami Jan 17 at 7:46
• @LightYagami. In comments, you wrote $u\leq 1$; I shall check if I can do something. – Claude Leibovici Jan 17 at 7:50
• Yeah, that's true, but later on I realised $u$ could be greater than $1$ also...are all the answers answered by taking $u\le 1$? – Light Yagami Jan 17 at 7:55
• @LightYagami. I am writinga second answer for $u>1$. Just wait. – Claude Leibovici Jan 17 at 8:25

I prefer to write another answer for the case where $$u>1$$.

In the most general case, $$\int_{0}^{\pi} \frac{1}{\sqrt{u^2+2u\cos x +1}} \,dx=\frac{2 }{u-1}K\left(-\frac{4 u}{(u-1)^2}\right)$$ and we can expand the rhs as a series built around $$u=1$$. This would give $$\frac{2 }{u-1}K\left(-\frac{4 u}{(u-1)^2}\right)=\sum_{n=0}^\infty a_n \, u^n$$ where the first $$a_n$$'s are $$\left\{d,\frac{1}{2}-\frac{d}{2},\frac{5 d}{16}-\frac{7}{16},\frac{17}{48}-\frac{7 d}{32},\frac{169 d}{1024}-\frac{1775}{6144},\frac{14789}{61440}-\frac{269 d}{2048},\frac{1781 d}{16384}-\frac{100741}{491520},\frac{244835}{1376256}-\frac{3035 d}{32768},\frac{338377 d}{4194304}-\frac{276441853}{1761607680},\frac{1482803963}{10569646080}-\frac{59 9569 d}{8388608}\right\}$$ where $$d=\log \left(\frac{8}{u-1}\right)$$.

Uisng the above terms, the result is quite decent up to $$u=2$$. For this value, the exact result is $$2 K(-8) \sim 1.68575$$ while the expansion gives $$1.68208$$