Definite Integrals – Compute Integral of ln(2-cos(x)) from 0 to pi

calculusdefinite integralsintegration

Compute:$$\int_{0}^{\pi}\ln(2-\cos(x))dx$$

Here was my attempt:

$$I(n)=\int_{0}^{\pi}\ln(n-\cos(x))dx$$$$I'(n)=\int_{0}^{\pi}\frac{dx}{n-\cos(x)}$$Let $u=\tan(\frac{x}{2})$.
$$\int_{0}^{\infty}\frac{2}{u^2(1+n)+n-1}du=\frac{\pi}{\sqrt{n^2-1}}$$
Because of this, I got $I(n) = \pi\cosh^{-1}(n)$.
However, the answer is not $\pi\cosh^{-1}(2)$ according to WolframAlpha.

What did I do wrong here???

Note:- after pointing out my mistake if any other ways to compute this integral then please share.
Credit:- silver

Best Answer

Keep in mind the "+ C" of the antiderivative: $I(n) = \pi\cosh^{-1}(n) + C$. Many problems that have an integration-by-differentiation solution end up having $C = 0$, but in this case, we don't have that.

Write $I(n)$ as $I(1) + \int_{1}^{n} I'(z)\,dz = \int_{0}^{\pi} \ln(1 - \cos x)\,dx + \pi(\cosh^{-1}(n) - \cosh^{-1}(1)) = \int_{0}^{\pi} \ln(1 - \cos x)\,dx + \pi\cosh^{-1}(n)$. We take our reference point to be $1$ because (1) $\cosh^{-1}$ becomes non-real for inputs less than $1$ and (2) the integral $I(1)$ has a nice computation: $$I(1) = \int_{0}^{\pi} \ln\left(2\cdot\frac{1 - \cos x}{2}\right)dx = \pi\ln(2) + \int_{0}^{\pi} \ln(\sin^2(x/2))\,dx = \pi\ln(2) + 4\int_{0}^{\pi/2} \ln\sin u\,du,$$where we used the half-angle identity for sine and the substitution $u = x/2$. The integral $\int_{0}^{\pi/2} \ln\sin u\,du$ is well known and evaluates to $-\frac{\pi}{2}\ln(2)$ (there are many ways to derive this, including some pretty "elementary" ways that only rely on clever algebra, function symmetries, and double-angle identities). Hence, $$I(1) = \pi\ln(2) + 4\cdot\left(-\frac{\pi}{2}\ln(2)\right) = -\pi\ln(2),$$so $I(n) = \pi(\cosh^{-1}(n) - \ln(2))$.

-kgator