# Evaluate $\int_{0}^{\pi} \log \left(m^2-2m\cos x+1\right)\: dx$

Evaluate $$\int_{0}^{\pi} \log \left(m^2-2m\cos x+1\right)\: dx$$

My Try: I let $$f(m)=\int_{0}^{\pi} \log \left(m^2-2m\cos x+1\right)\: dx$$

Differentiating w.r.t $m$ both sides we get

$$f'(m)=2\int_{0}^{\pi}\frac{(m- \cos x)dx}{(m-\cos x)^2+\sin^2x}=2\int_{0}^{\pi}\frac{(m+ \cos x)dx}{(m+\cos x)^2+\sin^2x}$$

we get

$$f'(m)=2\int_{0}^{\pi}\frac{m \csc^2 x+\csc x \cot x}{(m\csc x+\cot x)^2+1}$$

How to proceed now?

• Try Integral calculator: $$-\dfrac{{\pi}\ln\left(\frac{m^2+2m+1}{m^2}\right)}{2}+\dfrac{{\pi}\ln\left(m^2+2m+1\right)}{2}-\mathrm{i}\operatorname{Li}_2\left(m\right)+\mathrm{i}\operatorname{Li}_2\left(-m\right)-\mathrm{i}\operatorname{Li}_2\left(\dfrac{1}{m}\right)+\mathrm{i}\operatorname{Li}_2\left(-\dfrac{1}{m}\right)+\dfrac{\mathrm{i}{\pi}^2}{2}$$ – GNUSupporter 8964民主女神 地下教會 May 5 '18 at 15:32
• Is it assumed that $|m|<1$? – user May 5 '18 at 15:39
• Not sure but any use of that assumption? – Umesh shankar May 5 '18 at 15:41
• @GNUSupporter Using integral calculator or wolfram alpha, IMO, takes out all the fun in integration problems. – Frank W. May 5 '18 at 16:22
• @FrankW. I agree. I do so because some (probability-theory) results are not so easy to verify for beginners: an argument for proving something and one for disproving something have completely different style. To choose a direction, (simulation) is needed. In this case, it's because some integrals may not have (closed-form) representation. – GNUSupporter 8964民主女神 地下教會 May 5 '18 at 17:49

Let's denote the desired integral as$$I(z)=\int\limits_0^{\pi}dx\,\log\left(z^2-2z\cos x+1\right)$$And use Feynman's Trick to turn the integral into something that we can manage. Differentiating with respect to $z$ gives$$I'(z)=\int\limits_0^{\pi}dx\,\frac {2z-2\cos x}{z^2-2z\cos x+1}=\frac 1z\int\limits_0^{\pi}dx\,\left(1-\frac {1-z^2}{z^2-2z\cos x+1}\right)$$The first integral is trivial. The second one can be easily evaluated using a Weierstrass Substitution of t=\tan\tfrac x2\begin{align*}I'(z) & =\frac {\pi}z-\frac {2(1-z^2)}z\int\limits_0^{\infty}dt\space\frac {1}{\left[t(1+z)\right]^2+(1-z)^2}\\ & =\frac {\pi}z-\frac 2z\left.\arctan\left(\frac {1+z}{1-z}\tan\frac x2\right)\right|_0^{\pi}\end{align*} The expression inside the arctangent function takes on two different values asx$varies from zero to$\pi$. When$|z|<1$, the fraction is always positive, even when$z$is negative. Therefore, the whole expression evaluates to$\frac {\pi}2$. So$$I'(z)=0\qquad\qquad I(z)=C_1$$ And when$|z|>1$, the fraction is less than zero (can you see why?). So the expression actually evaluates to$-\frac {\pi}2$and we get a different answer than before$$I'(z)=\frac {2\pi}z\qquad\qquad I(z)=2\pi\log z+C_2$$ To find the two constants, we make a substitution for$z$that reduces the integral down to something we can easily evaluate. When$|z|<1$, the substitution$z=0$gives$I(z)=0$, so we immediately see that$C_1=0$. When$|z|>1$, we first make a substitution$z=\frac 1w$where$|w|<1$and use the result previously to get that$C_2is also equal to zero. Finally, we're left with \int\limits_0^{\pi}dx\,\log\left(z^2-2z\cos x+1\right)=\left\{\begin{align*}2\pi\log z\qquad |z|>1\\\\0\qquad\space\space\qquad |z|\leq1\end{align*}\right. For|m|<1$, we have $$\log(1+m^2-2m\cos x) = \log(1-me^{ix})(1-me^{-ix}) = \log{(1-me^{ix})}+\log(1-me^{-ix}) \\ = -\sum_{k=1}^{\infty} \frac{1}{k}m^k (e^{ikx}+e^{-ikx}) = -2\sum_{k=1}^{\infty} \frac{m^k}{k} \cos{kx}.$$ Thus: $$\int_0^\pi\log(1+m^2-2m\cos x) dx=-2\sum_{k=1}^{\infty} \frac{m^k}{k}\int_0^\pi \cos{kx} dx=0.$$ For$|m|>1$, we can write: $$\log(1+m^2-2m\cos x)=\log(1+m^{-2}-2m^{-1}\cos x)+\log m^2,$$ so that after integration one obtains$\pi \log m^2$. Thus, finally $$\int_0^\pi\log(1+m^2-2m\cos x) dx=\begin{cases} 0,& |m|<1,\\ \pi\log m^2,& |m|>1.\\ \end{cases}$$ • What if$m=1$like your last equality states? Is it zero or$\pi\log m^2$? – Frank W. May 5 '18 at 21:51 • @FrankW. Observe that$\log 1=0$, so that both answers are the same. – user May 5 '18 at 22:00 Note that $$I(m)=\int_{0}^{\pi} \log \left(m^2-2m\cos x+1\right)\: dx=\frac12\int_{0}^{2\pi} \log \left(m^2-2m\cos x+1\right)\: dx$$ and hence $$I(m)=\frac12\int_0^{2\pi}\frac{2m-2\cos x}{(m^2+1)-2m\cos x}\;dx.$$ Let$z=e^{ix}$and then \begin{eqnarray} I'(m)&=&\frac12\int_0^{2\pi}\frac{2m-2\cos x}{(m^2+1)-2m\cos x}\;dx\\ &=&\frac12\int_{|z|=1}\frac{2m-(z+\frac1z)}{(m^2+1)-m(z+\frac1z)}\;\frac{dz}{iz}\\ &=&\frac1{2i}\int_{|z|=1}\frac{2mz-(z^2+1)}{z\bigg[(m^2+1)z-m(z^2+1)\bigg]}\;dz\\ &=&-\frac1{2mi}\int_{|z|=1}\frac{2mz-(z^2+1)}{z(z-m)(z-\frac1m)}\;dz. \end{eqnarray} Let $$f(z)=\frac{2mz-(z^2+1)}{z(z-m)(z-\frac1m)}.$$ If$m<1$, then$f(z)$has two poles$z=0$and$z=m$inside$|z|=1$and hence $$I'(m)=-\frac1{2mi}\cdot2\pi i\bigg[\text{Res}\bigg(f(z),z=m\bigg)+\text{Res}\bigg(f(z),z=0\bigg)\bigg]=0$$ and hence $$I(m)=C.$$ Since$I(0)=0$, so$C=0$and hence$I(m)=0$. If$m>1$, then$f(z)$has two poles$z=0$and$z=\frac1m$inside$|z|=1$and hence $$I'(m)=-\frac1{2mi}\cdot2\pi i\bigg[\text{Res}\bigg(f(z),z=\frac1m\bigg)+\text{Res}\bigg(f(z),z=0\bigg)\bigg]=\frac{2\pi}{m}$$ and hence $$I(m)=2\pi\log m+C.$$ Since$I(1)=0$, so$C=0$and hence$I(m)=2\pi\log m$. • In your solution different from the other two, the final expression has the same form both for$m <1$and$m>1$. How can you explain this? – user May 5 '18 at 18:44 • @user, I don't know. – xpaul May 5 '18 at 20:25 • It seems that the argument goes wrong as soon as$z=m \$ is inside the integration contour. – user May 6 '18 at 7:46