Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Evaluate : $$\int_0^{\frac{\pi}{2}}\ln ^2\left(\cos ^2x\right)\text{d}x$$ I found it can be simplified to $$\int_0^{\frac{\pi}{2}}4\ln ^2\left(\cos x\right)\text{d}x$$ I found the exact value in the table of integrals: $$2\pi\left(\ln ^22+\frac{\pi ^2}{12}\right)$$ Anyone knows how to evaluate this?

share|improve this question
I assume the integrand is meant to be $(\ln(\cos^2x))^2$? The convention for powers of trigonometric functions is somewhat questionable, but at least it is very well established. When applied to other kinds of functions, not so much. An alternative interpretation would be an iterated logarithm. (To add to the confusion, one meets iterated logs more frequently than powers of logs, I think.) –  Harald Hanche-Olsen Feb 11 '13 at 8:08
There is absolutely nothing confusing about the way the expression is written. I dont get where Harald's criticism is coming from. It has nothing to do with the question. –  CogitoErgoCogitoSum Feb 11 '13 at 8:15
maple doesn't know the antiderivative, or even the value of the definite integral in closed form. Numerically about 8.186488. –  coffeemath Feb 11 '13 at 8:52
The definite integral can be expressed in term of generalized hypergeometric function $8 _4F_3(\frac12,\frac12,\frac12,\frac12;\frac32,\frac32,\frac32;1)$ but I doubt this has any real use. –  achille hui Feb 11 '13 at 9:22
@achillehui : Thx! I found the exact value in the table of integrals. –  Ryan Feb 11 '13 at 10:21

3 Answers 3

up vote 10 down vote accepted

I find a way to get the number using gamma functions, nothing is rigorous.

Consider the integral $I(\beta) = \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}(\cos x)^\beta dx$. We know: $$2 \frac{d^2}{d\beta^2} I(\beta) \bigg|_{\beta=0} = 4 \int_{0}^{\frac{\pi}{2}} \ln^2(\cos x) dx$$ is the integral we want. Introduce $u = \frac{1 + \sin x}{2}$, we have:

$$\begin{align} I(\beta) &= \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}(\cos x)^{\beta-1} d\sin x\\ &= \int_0^1 (4 u (1-u))^{\frac{\beta-1}{2}} d( 2u )\\ &= 2^{\beta} \int_0^1 u^{\frac{\beta+1}{2}-1} (1-u)^{\frac{\beta+1}{2}-1} du\\ &= 2^{\beta} \frac{\Gamma(\frac{\beta+1}{2})^2}{\Gamma(\beta+1)} \end{align}$$ Using the taylor expansion of various terms at $\beta = 0$, $$\begin{align} 2^{\beta} &= 1 + \ln(2) \beta + \frac{\ln^2 2}{2}\beta^2 + \,...\\ \Gamma(\frac{\beta+1}{2}) &= \sqrt{\pi} \left( 1 - \frac{\gamma + 2\ln 2}{2} \beta + \frac{\pi^2+2( \gamma + 2\ln 2)^2}{16}\beta^2 + \, ...\right)\\ \Gamma(\beta+1) &= 1 -\gamma \beta + \frac{6\gamma^2 + \pi^2}{12} \beta^2 + \,... \end{align} $$ We get: $$\begin{align} &I(\beta) = \pi \left( 1 - \ln(2) \beta + \frac{\pi^2 + 12 \ln^2 2}{24}\beta^2 + \,... \right)\\ \implies &2 \frac{d^2}{d\beta^2} I(\beta)\bigg|_{\beta=0} = 2\pi \left( \frac{\pi^2}{12} + \ln^2 2 \right) \end{align}$$

share|improve this answer
Very brilliant solution! What inspire you to make that subsitution? :) $u=\frac{1+\sin x}{2}$ –  Ryan Feb 11 '13 at 14:28
@Ryan because you have told us the exact value of the integral, the $\frac{\pi^2}{12}$ there make me wonder whether it comes from $\zeta(2)$. To get $\zeta(2)$, I start to play with $2^{nd}$ derivatives of various integrals which looks like the defining integral for gamma functions. –  achille hui Feb 11 '13 at 14:53

Start with $$ \begin{align} \int_0^{\pi/2}\log(\sin(x))\,\mathrm{d}x &=\frac12\int_0^\pi\log(\sin(x))\,\mathrm{d}x\\ &=\int_0^{\pi/2}\log(\sin(2x))\,\mathrm{d}x\\ &=\int_0^{\pi/2}\Big(\log(2)+\log(\sin(x))+\log(\cos(x))\Big)\,\mathrm{d}x\\ &=\frac\pi2\log(2)+2\int_0^{\pi/2}\log(\sin(x))\,\mathrm{d}x\tag{1} \end{align} $$ Therefore, $$ \int_0^{\pi/2}\log(\sin(x))\,\mathrm{d}x=-\frac\pi2\log(2)\tag{2} $$

Next $$ \begin{align} \int_0^{\pi/2}\log^2(\sin(x))\,\mathrm{d}x &=\int_0^{\pi/2}\Big(\log(2)+\log(\sin(x))+\log(\cos(x))\Big)^2\,\mathrm{d}x\\ &=\frac\pi2\log^2(2)+4\log(2)\int_0^{\pi/2}\log(\sin(x))\,\mathrm{d}x\\ &+2\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &+2\int_0^{\pi/2}\log^2(\sin(x))\,\mathrm{d}x\tag{3} \end{align} $$ Using $(2)$ in $(3)$ yields $$ \int_0^{\pi/2}\log^2(\sin(x))\,\mathrm{d}x =\frac32\pi\log^2(2)-2\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\tag{4} $$

As in this answer, we can use contour integration to get that $$ \begin{align} \int_0^\infty\frac{\log^2(x)}{1-x^2}\mathrm{d}x &=\int_0^\infty\frac{\log^2(ix)}{1+x^2}\mathrm{d}ix\\ &=i\int_0^\infty\frac{\left(\frac\pi2i+\log(x)\right)^2}{1+x^2}\mathrm{d}x\\ &=i\int_0^\infty\frac{\log^2(x)-\frac{\pi^2}{4}}{1+x^2}\mathrm{d}x -\pi\int_0^\infty\frac{\log(x)}{1+x^2}\mathrm{d}x\tag{5} \end{align} $$ Looking at the imaginary part of $(5)$, we see that $$ \int_0^\infty\frac{\log^2(x)}{1+x^2}\mathrm{d}x=\frac{\pi^3}8\tag{6} $$

With a change of variables, $(6)$ becomes $$ \begin{align} \frac{\pi^3}8 &=\int_0^{\pi/2}\log^2(\tan(x))\,\mathrm{d}x\\ &=\int_0^{\pi/2}\Big(\log^2(\sin(x))+\log^2(\cos(x))-2\log(\sin(x))\log(\cos(x))\Big)\,\mathrm{d}x\tag{7} \end{align} $$ which yields $$ \int_0^{\pi/2}\log^2(\sin(x))\,\mathrm{d}x =\frac{\pi^3}{16}+\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\tag{8} $$

Adding twice $(8)$ to $(4)$ and dividing by $3$ gives $$ \int_0^{\pi/2}\log^2(\sin(x))\,\mathrm{d}x=\frac{\pi^3}{24}+\frac12\pi\log^2(2)\tag{9} $$ Therefore, $$ \int_0^{\pi/2}\log^2(\cos^2(x))\,\mathrm{d}x=\frac{\pi^3}{6}+2\pi\log^2(2)\tag{10} $$

share|improve this answer

A related problem. Using the substitution $ \cos(x) = y $, we have

$$ 4\int_0^{\frac{\pi}{2}}\ln^2\left(\cos x\right)\text{d}x = 4\int _{0}^{1}\!{\frac { \ln^2 \left( y \right)}{ \sqrt {1-{y}^{2}}}}{dy} = I. $$

To evaluate the last integral $I$, consider the integral

$$ F := 4\int _{0}^{1}\!{\frac { y^\alpha}{ \sqrt {1-{y}^{2}}}}{dy} = 2\,{\frac {\sqrt {\pi }\,\Gamma\left( \frac{\alpha}{2}+\frac{1}{2} \right) }{ \Gamma\left( \frac{\alpha}{2}+1 \right) }}. $$

$F$ was evaluated using the beta function. Now, $I$ follows directly from $F$ as

$$ I = F_{\alpha \alpha}|_{\alpha=0} = \frac{\pi}{6} \, \left( {\pi }^{2}+12\, \left( \ln \left( 2 \right) \right)^{2} \right) \sim 8.186488098. $$

Note 1: Maple can not give a closed form solution for this kind of integrals.

Note 2: One can evaluate more general integrals, for instance

$$ \int_0^{\frac{\pi}{2}}\ln^3\left(\cos ^2x\right)\text{d}x= -\pi \, \left( 6\,\zeta \left( 3 \right) +{\pi }^{2}\ln \left( 2 \right) +4\, \left( \ln \left( 2 \right) \right) ^{3} \right).$$

share|improve this answer
Mathematica 8 takes 4 Integrate[Log[Sin[x]]^2, {x, 0, Pi/2}] and returns $$\frac16\left(\pi^3+12\pi\log^2(2)\right)$$ –  robjohn Feb 11 '13 at 16:01
@robjohn: Thanks for the comment. What is about the integral in the note 2 in my answer? I just tried wolfram alpha. –  Mhenni Benghorbal Feb 11 '13 at 16:06
Mathematica 8 takes 8 Integrate[Log[Sin[x]]^3, {x, 0, Pi/2}] and returns $$-\frac12\pi\left(12\zeta(3)+\log^3(4)+\pi^2\log (4)\right)$$ –  robjohn Feb 11 '13 at 16:14
@robjohn: Thanks for doing that. –  Mhenni Benghorbal Feb 11 '13 at 16:23
@robjohn: It does not evaluate the integral involves $\ln(\cos x)^2 $! –  Mhenni Benghorbal Feb 11 '13 at 16:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.