I would like to know if the integral $$\int_0^\pi \ln^2(\sin x)dx$$ could be attacked with contour integration. I have seen the integral evaluated using the Fourier series for $\ln(\sin x)$ and Cauchy product for infinite sums, but this method gets extremely hard for higher degrees than 2, which is why I want to see it evaluated using complex analysis.
- 3,462
- 3,415
- 8
- 32
-
Is this $\ln(\ln(\sin(x))$ or is this $\ln(\sin(x))*\ln(\sin(x)))$? – Thomas Jan 30 '22 at 20:16
-
2It’s squared. It’s quite widely accepted notation from what I knew. – chroma24 Jan 30 '22 at 20:17
-
@intellect4 - both are widely accepted notation. Hence the question. For instance, while $\sin^2x$ usually means $(\sin(x))^2$, $d^2y$ usually means $d(d(y))$. – johnnyb Jan 31 '22 at 00:03
-
For "higher degrees" use $\int_0^\pi\ln^n\sin x,dx=f^{(n)}(0)$ where $f(\lambda)=\int_0^\pi\sin^\lambda x,dx$ is a "beta" integral; this gives expressions in terms of the polygamma functions (or, finally, values of the $\zeta$-function). – metamorphy Jan 31 '22 at 04:35
-
Thanks, I’ll look into it – chroma24 Feb 01 '22 at 00:24
-
1Another idea: substituting $y=\tan\frac x2$ converts this integral to$$2\int_0^\infty\log^2\left(\frac{2y}{1+y^2}\right)^2,\frac{dy}{1+y^2}$$Expanding the squared log results in two terms that somehow cancel each other, leaving us with$$\frac12\int_0^\infty\log^2\left(1+y^2\right),\frac{dy}{1+y^2}$$which I suspect can be integrated by considering a function like$$f(z)=\frac{\log^2\left(1+z^2\right)\color{red}{\log z}}{1+z^2}$$with suitable choice of branch of $\log z$ along a circular contour. See also this answer using a rectangular path. – user170231 Jun 13 '25 at 19:29
-
@user170231 thank you – chroma24 Jun 13 '25 at 21:56
-
On second thought, the log integral I suggested may not be the best way to go. It boils down to evaluating$$2\pi\left(\int_0^1\frac{(1-x)\log\left(1-x^2\right)-2\log x}{1-x^2},dx+\lim_{a\to1^-}\int_0^1\frac{\log\left(1-x^2\right)-\log\left(1-a^2x^2\right)}{1-a^2x^2},dx\right).$$While the first integral is doable with Taylor series (I think), the limit appears more challenging. (A similar problem) – user170231 Jun 25 '25 at 19:19
2 Answers
There is a method to evaluate your integral using contour integration, though I'm unsure if it generalises neatly to higher powers. First, let \begin{equation} \begin{split} I&=\int_0^\pi\log^2(\sin(\theta))d\theta\\ &=\frac12 \int_0^{2\pi}\log^2(\sin(\theta /2))d\theta\\ &=\frac12 \int_0^{2\pi}\left[\log(1-e^{i\theta})-\log(2) -\frac{i}{2}(\theta-\pi)\right]^2d\theta\\ \end{split} \end{equation} (Note that we're taking the principal branch of the logarithm) Expanding the square, and taking real parts (which we may do since $I$ is real valued), we see that $I=\frac{1}{2}(J_1+J_2+J_3)$, where \begin{equation} \begin{split} J_1&=\mathfrak{R}\int_0^{2\pi}\left[\log^2(2)-\frac14(\theta-\pi)^2\right]d\theta\\ J_2&=\mathfrak{R}\int_0^{2\pi}[-i\log(1-e^{i\theta})(\theta-\pi)]d\theta\\ J_3&=\mathfrak{R}\int_0^{2\pi}[\log^2(1-e^{i\theta})-2\log(2)\log(1-e^{i\theta})]d\theta\\ \end{split} \end{equation} It is easy to evaluate $J_1=2\pi\log^2(2)-\frac{\pi^3}{6}$. To evaluate $J_2$, note that $\mathfrak{R}[-i\log(1-e^{i\theta})]=\frac{1}{2}(\theta-\pi)$ for $\theta\in(0,2\pi)$, so \begin{equation} J_2=\int_0^{2\pi}\frac{1}{2}(\theta-\pi)^2d\theta=\frac{\pi^3}{3} \end{equation} Finally, to evaluate $J_3$, note that \begin{equation} \begin{split} J_3&=\mathfrak{R}\lim_{r\rightarrow 1^{-}}\int_0^{2\pi}[\log^2(1-re^{i\theta})-2\log(2)\log(1-re^{i\theta})]d\theta\\ &=\mathfrak{R}\lim_{r\rightarrow 1^{-}}\oint_{|z|=r}-\frac{i}{z}[\log^2(1-z)-2\log(2)\log(1-z)]dz\\ \end{split} \end{equation} Since the above integrand is analytic in the open unit disc (apart from a removable singularity at $z=0$), by Cauchy's integral theorem, the above integrals vanish for each $r\in(0,1)$, and thus $J_3=0$. Combining our work, we have that \begin{equation} I=\pi\log^2(2)+\frac{\pi^3}{12} \end{equation}
- 3,462
-
1Thank you very much. I appreciate your answer. To clarify, the R symbol stands for the real part of a complex number, right? – chroma24 Jan 31 '22 at 02:54
-
This is a far easier way to attack the transformed integral than using the method I'd suggested in an earlier comment. We prepare for contour integration by simplifying $(*)$, then simultaneously enforcing substitutions and applying Fubini's theorem $(\star)$ several times:
$$\begin{align*} I &= \int_0^\pi (\log \sin x)^2 \, dx \\ &= \int_0^\infty 2 \left(\log\frac{2y}{1+y^2}\right)^2 \, \frac{dy}{1+y^2} & y=\tan\frac x2 \\ &= \int_0^\infty \frac12 \frac{\left(\log\left(1+y^2\right)\right)^2}{1+y^2} \, dy & y\to\frac1y;(*) \\ &= \int_0^\infty \int_0^y \cdots dz\,dy = \int_0^\infty \int_z^\infty \frac{2z\log\left(1+z^2\right)}{\left(1+y^2\right)\left(1+z^2\right)} \, dy\,dz & (\star) \\ &= \int_0^1 \int_0^\infty \frac{2z^2 \log\left(1+z^2\right)}{\left(z^2+y^2\right)\left(1+z^2\right)} \, dz \, dy & y\to\frac zy; (\star) \\ &= \int_0^1 \int_0^\infty \int_0^z \cdots dw\,dz\,dy \\ &\qquad = \int_0^1 \int_0^\infty \int_w^\infty \frac{4z^2w}{\left(z^2+y^2\right)\left(1+z^2\right)\left(1+w^2\right)} \, dz\,dw\,dy & (\star) \\ &= 2 \int_0^1 \int_0^1 \int_0^\infty \underbrace{\frac{2w^4}{\left(y^2z^2+w^2\right)\left(z^2+w^2\right)\left(1+w^2\right)}}_{f(w)} \, dw \, dz \, dy & z\to\frac wz; (\star) \\ &= \int_0^1 \int_0^1 \int_{-\infty}^\infty f(w)\,dw\,dz\,dy & \text{symmetry} \end{align*}$$
Evaluate the $w$-integral with the residue theorem using a semicircular contour enclosing $3$ simple poles at $\omega\in\Omega=\left\{i,iz,iyz\right\}$ :
$$\int_{-\infty}^\infty f(w)\,dw = i2\pi \sum_\Omega \operatorname{Res} f(\omega) \\ = i2\pi \left[\frac{iz}{\left(1-y^2\right)\left(1-z^2\right)} - \frac{iy^3z}{\left(1-y^2\right)\left(1-y^2z^2\right)} - \frac i{\left(1-z^2\right)\left(1-y^2z^2\right)}\right]$$
The remaining evaluation of $I$ is straightforward from here.
$$\begin{align*} I &= 2\pi \int_0^1 \int_0^1 \frac{1+y+yz}{(1+y)(1+z)(1+yz)} \, dz \, dy \\ &= 2\pi \int_0^1 \int_0^y \frac{1+y+z}{(1+y)(y+z)(1+z)} \, dz \, dy & z\to\frac zy \\ &= 2\pi \int_0^1 \int_0^y \left(\frac1{y+z} - \frac y{1+z}\right) \, \frac{dz \, dy}{1-y^2} \\ &= 2\pi \int_0^1 \frac{\log2 - y\log(1+y)}{1-y^2} \, dy \\ &= 2\pi \int_0^1 \left(\frac{\log2}{1+y} + \frac{(1-y)\log(1+y)}{2y(1+y)}\right) \, dy & y\to\frac{1-y}{1+y} \\ &= 2\pi(\log2)^2 + \frac\pi2 \int_0^1 \left(\frac1y-\frac2{1+y}\right) \log y \, dy \\ &= 2\pi(\log2)^2 - \pi \left(\operatorname{Li}_2(-1) + (\log2)^2\right) = \boxed{\pi\left((\log2)^2 + \frac{\pi^2}{12}\right)} \end{align*}$$
- 27,172