A definite integral involving a logarithm and trigonometric functions.

The question is to compute a definite integral below. I have expressed it as a series expansion in powers of $r$ by expanding the integrand in a series and integrating term by term. Then I input the series into Mathematica and Mathematica returned the neat closed form expression in the last line.

I do not understand how this last closed form expression is obtained. Could anybody enlighten me on that? Thanks. \begin{eqnarray} \int\limits_0^{2 \pi} \log\left( 1+r \sin(\phi)\right) d \phi = \\ \sum\limits_{n=1}^\infty \frac{(-1)^{n+1}}{n} r^n \left(1+(-1)^n\right) \frac{\Gamma(1/2) \Gamma(\frac{1+n}{2})}{\Gamma(1+\frac{n}{2})}=\\ 2 \pi \log\left[\frac{1}{2} \left(1+\sqrt{1-r^2}\right)\right] \end{eqnarray}

• Yes, I do. The first step is obtained by expanding the log in a series and integrating term by term. In there an integral from an integer power of the sine appears and that integral is equal to the beta function that appears under the sum. Yet, how do we prove the second step? Commented Jan 24, 2017 at 13:01

Note first that if $n$ is odd, then the summand is zero. So this is effectively equivalent to the following sum over even numbers \begin{eqnarray} -\Gamma(1/2)\sum\limits_{n=1}^\infty \frac{1}{n} r^{2n} \frac{ \Gamma(1/2+n)}{\Gamma(1+n)} \end{eqnarray} Next use $$\Gamma(n+1/2)=\frac{\sqrt{\pi } (2 n)!}{4^n n!}$$ and $\Gamma(n+1)=n!$ to deduce that your sum equals $$-\Gamma(1/2)\sum\limits_{n=1}^\infty \frac{1}{n} (r/2)^{2n} \sqrt{\pi} \frac{(2n)!}{(n!)^2}\qquad (\star)\ .$$ Then use the known Taylor series for the arcsine $$\arcsin(x) = \sum\limits_{n=0}^\infty \cfrac{(2n!)x^{2n+1}}{(2^nn!)^2(2n+1)}$$ and differentiate both sides $$\frac{1}{\sqrt{1-x^2}}=\sum\limits_{n=0}^\infty \cfrac{(2n!)x^{2n}}{(2^nn!)^2}\qquad (\star\star) .$$ Then use the identity $$\frac{1}{n}=\int_0^\infty ds\ e^{-ns}\qquad n>0\ ,$$ in $(\star)$ to write for your series $$-\Gamma(1/2)\sqrt{\pi}\int_0^\infty ds\sum\limits_{n=1}^\infty (r e^{-s/2}/2)^{2n} \frac{(2n)!}{(n!)^2}$$ and equating $$\frac{x}{2}=r e^{-s/2}/2\ ,$$ we recognize the sum $(\star\star)$ inside the integrand. Therefore your sum equals $$-\Gamma(1/2)\sqrt{\pi}\int_0^\infty ds\left[\frac{1}{\sqrt{1-(r e^{-s/2})^2}}-1\right]=\pi[2 \log \left(\sqrt{1-r^2}+1\right)-\log(4)]\ ,$$ which is equivalent to your final expression.