# Prove that an integral is real and ignore complex parts

(This question comes from this video)

Imagine we are trying to solve the integral :

$$I=\int_{0}^{\pi/2} \ln(2\cos x)\,dx$$ This integral is defined on the real numbers. However, if I decide to use eulers complex cosine formula ($$\cos \theta = \frac{e^{i\theta}+e^{-i\theta}}{2}$$), I can reduce the integral to this (this is shown in the video) :

$$I = \frac{i\pi^2}{8} - i( 1+\frac{1}{3^2}+\frac{1}{5^2}+\frac{1}{7^2}+\frac{1}{9^2}+\cdots)$$

As you can the the result found this way is a pure imaginary number. In the video, it is then explained that since the integral is defined on the real numbers, therefor the complex result is simply a "residue" of the calculations. My question is, is this reasoning valid ? If not, what could bring us to the same result, that $$I = 0$$ (I doubt the youtube video would assume something wrong)

I turns out that the result is correct and saying that the result is equal to zero means that $$1+\frac{1}{3^2}+\frac{1}{5^2}+\frac{1}{7^2}+\frac{1}{9^2}+\cdots = \frac{\pi^2}{8}$$. We can the continue and use this result to show that $$\sum_{k=1}^\infty \frac{1}{k^2} = \frac{\pi^2}{6}$$.

• When dealing with complex numbers, it's better to avoid using $i$ as a summation index. Commented Mar 3, 2021 at 21:02
• I edited the summation to be more comprehensible. Commented Mar 3, 2021 at 21:25
• Which "the same result"? That the integral is $0$?
– user
Commented Mar 3, 2021 at 21:44
• Yes, that the integral is equal to zero Commented Mar 3, 2021 at 21:54
• The video looks okay. The results $\frac{\pi^2}{8}= \sum_{k=1}^\infty \frac{1}{(2k-1)^2}$ and $\sum_{k=1}^\infty \frac{1}{k^2} = \frac{\pi^2}{6}$ can also be found via Fourier series.
– mjw
Commented Mar 3, 2021 at 22:05

First using the substitution $$t=\frac\pi2-x$$ observe: $$I=\int_0^{\pi/2}\log(2\cos x)dx=\int_0^{\pi/2}\log(2\sin x)dx.$$
Next add both above integrals to obtain \begin{align} 2I&=\int_0^{\pi/2}\log(4\cos x\sin x)dx\tag1\\ &=\int_0^{\pi/2}\log(2\sin 2x)dx\tag2\\ &=2\int_0^{\pi/4}\log(2\sin 2x)dx\tag3\\ &=\int_0^{\pi/2}\log(2\sin t)dt\tag4\\ &=I \end{align} where we used:
1. $$\log a+\log b=\log(ab)$$
2. $$2\cos x\sin x=\sin 2x$$
3. $$\sin(x)=\sin(\pi-x)$$
4. $$x\mapsto \frac t2$$
Finally: $$2I=I\implies I=0.$$