Closed expression for $\int_{-\pi}^{\pi}\sqrt{a^{2}-2ab\cos(x)+b^{2}}dx $ [closed]

Suppose $a, b >0$. I'm looking for closed expressions for the following integral: $$\int_{-\pi}^{\pi}\sqrt{a^{2}-2ab\cos(x)+b^{2}}dx $$ I tried to solve this by myself and got nowhere and even wolfram alpha couldn't get me an answer so maybe this is not easily solved, but might have some complicated closed expression. Any help is important. Thanks!


This does not admit a closed form in terms of elementary functions for general $a,b>0$. However, using some elementary trigonometric identities and symmetry properties, one can get a solution in terms of elliptic integrals.


Firstly, by the substitution $u=x+\pi$ and the identity $\cos(u-\pi)=-\cos(u)$, one has $$\int_{-\pi}^{\pi} \sqrt{a^2+b^2-2ab\cos(x)}~dx=\int_{0}^{2\pi} \sqrt{a^2+b^2+2ab\cos(u)}~du.$$ Using symmetry of $\cos(u)$ about $u=\pi$ and the identity $\cos(u)=1-2\sin^2(u/2)$, one has $$\begin{align} \int_{0}^{2\pi} \sqrt{a^2+b^2+2ab\cos(u)}~du&=2\int_0^{\pi} \sqrt{a^2+b^2+2ab\cos(u)}~du\\&=2\int_0^{\pi} \sqrt{(a+b)^2-4ab\sin^2(u/2)}~du\\&=4\int_0^{\pi/2} \sqrt{(a+b)^2-4ab\sin^2(v)}~dv\\&=4(a+b)\int_0^{\pi/2} \sqrt{1-\frac{4ab}{(a+b)^2}\sin^2(v)}~dv\\&=4(a+b)E\left(\frac{\sqrt{4ab}}{a+b}\right),\end{align}$$ where we have used the substitution $v=u/2$ and the definition of the complete elliptic integral of the second kind according to Wikipedia $$E(k):=\int_0^{\pi/2} \sqrt{1-k^2\sin^2(\theta)}~d\theta.$$ Note that in some conventions the argument inside the elliptic integral is $k^2$ instead of $k$ (such as the one used by Mathematica).


Sidenote: Consider a circle of radius $a$ with center at a distance $b$ to the origin of $\mathbb{R}^2$. This integral comes up when computing the average distance from the origin to the points of this circle. Namely, one considers $$\frac{1}{2\pi}\int_{0}^{2\pi} \sqrt{a^2+b^2+2ab\cos(x)}~dx.$$ Equivalently, it is distance travelled by a point at a distance of $b$ from the centre of a rolling disc with radius $a$ in one full rotation (forget the multiplicative factor outside the integral).


Mathematica yields the result shown below when executig:

Integrate[Sqrt[a^2 - 2 ab*Cos[x] + b^2], {x, -Pi, Pi}] 

$$4 \sqrt{a^2+2 \text{ab}+b^2} E\left(\frac{4 \text{ab}}{a^2+b^2+2 \text{ab}}\right)$$

where $E(\ldots)$ denote the complete Elliptic Integral.