In this post, It is mentioned that $$ \int_0^{\pi/2} x^2 \ln^2(2\cos{x}) \mathrm{d}x = \frac{11 \pi}{16} \zeta(4) $$ is easy to evaluate.

I thought it by doing integration by parts but if I assume $x^2$ as $1st$ function and $\ln^2(2\cos{x})$ as $2nd$ function but problem with this is that, We can't integrate $\ln^2(2\cos{x})$ directly.

I also tried to use Fourier series of $\ln(2\cos{x})$ $$ \ln(2 \cos(x)) = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n} \cos(2 n x)$$ But it didn't work as well.

Please guide me how to solve it ? Thank you very much!!

  • 3
    $\begingroup$ Hint: differentiate both sides of $$\int_0^{\pi/2} \cos^a x \cos bx dx = \frac{\pi \Gamma(a+1)}{2^{a+1} \Gamma(1+\frac{a-b}{2}) \Gamma(1+\frac{a+b}{2})}$$ and putting $a=b=0$. This enables us to express $$\int_0^{\pi/2} x^{2n} \log^m(2\cos x) dx$$ in terms of Riemann zeta. $\endgroup$
    – pisco
    Dec 18, 2022 at 20:31
  • $\begingroup$ how you got this formula or solved that integral? I mean I know RHS is quite similar to one integral representation of Beta function. But it is not totally like that. $\endgroup$ Dec 18, 2022 at 20:35
  • 1
    $\begingroup$ This is a nice exercise on contour integration, of course it can also be proved by other means. $\endgroup$
    – pisco
    Dec 18, 2022 at 20:53
  • $\begingroup$ the method is, for example, here: math.stackexchange.com/questions/3419834/… $\endgroup$
    – Svyatoslav
    Dec 18, 2022 at 20:58
  • 1
    $\begingroup$ Thank you @Svyatoslav $\endgroup$ Dec 19, 2022 at 3:55

3 Answers 3


We will prove

$$\int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(2\cos\left(x\right)\right)dx = \frac{11\pi^{5}}{1440}.$$

Proof. Let the given integral be $I$. Then $$ \eqalign{ I&=\int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(2\cos\left(x\right)\right)dx \cr &= \int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(\frac{e^{2ix}+1}{e^{ix}}\right)dx \cr &= \int_{0}^{\frac{\pi}{2}}x^{2}\left(\ln\left(e^{2ix}+1\right)-ix\right)^{2}dx \cr &= \int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(1+e^{2ix}\right)dx-2i\int_{0}^{\frac{\pi}{2}}x^{3}\ln\left(1+e^{2ix}\right)dx-\int_{0}^{\frac{\pi}{2}}x^{4}dx \cr &= \int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(1+e^{2ix}\right)dx-2i\int_{0}^{\frac{\pi}{2}}x^{3}\ln\left(1+e^{2ix}\right)dx-\frac{\pi^{5}}{160} \cr } $$

For the first integral, let $f(z) = z^2\log^2\left(1+e^{2iz}\right)$ and define a rectangular contour

$$C=\left\{z\in\mathbb{C} : \Re(z) \in \left[0,\frac{\pi}{2}\right] \wedge \Im(z) \in \left[0,R\right]\right\}$$

that we will traverse counterclockwise around. By Cauchy's Residue Theorem, we get

$$0 = \int_{0}^{\frac{\pi}{2}}f\left(z\right)dz+\int_{\frac{\pi}{2}}^{\frac{\pi}{2}+iR}f\left(z\right)dz+\int_{\frac{\pi}{2}+iR}^{iR}f\left(z\right)dz+\int_{iR}^{0}f\left(z\right)dz.$$

With some grunt work, the third integral will vanish as $R\to\infty$. The fourth integral will also vanish when we take $\Re$ on both sides. As $R \to \infty$, we get

$$ \eqalign{ \Re\int_{0}^{\frac{\pi}{2}}f\left(z\right)dz &= -\Re\int_{\frac{\pi}{2}}^{\frac{\pi}{2}+i\infty}f\left(z\right)dz \cr &= -\Re i\int_{0}^{R}f\left(\frac{\pi}{2}+ix\right)dx \cr &= -\Re i\int_{0}^{\infty}\left(\frac{\pi}{2}+ix\right)^{2}\log^{2}\left(1+e^{2i\left(\frac{\pi}{2}+ix\right)}\right)dx \cr &= \pi\int_{0}^{\infty}x\ln^{2}\left(1-e^{-2x}\right)dx \cr &= \pi\int_{0}^{\infty}x\left(-\sum_{n=1}^{\infty}\frac{e^{-2nx}}{n}\right)^{2}dx \cr &= \pi\int_{0}^{\infty}x\sum_{n=1}^{\infty}\frac{e^{-2nx}}{n}\sum_{k=1}^{\infty}\frac{e^{-2kx}}{k}dx \cr &= \sum_{n,k=1}^{\infty}\frac{\pi}{nk}\int_{0}^{\infty}xe^{-2\left(n+k\right)x}dx \cr &= \sum_{n,k=1}^{\infty}\frac{\pi}{nk}\left(\frac{1}{4\left(n+k\right)^{2}}\right) \cr &= \frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{\left(n+k\right)^{2}-n^{2}-k^{2}}{n^{2}k^{2}\left(n+k\right)^{2}} \cr &= \frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{1}{n^{2}k^{2}}-\frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{1}{k^{2}\left(n+k\right)^{2}}-\frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{1}{n^{2}\left(n+k\right)^{2}} \cr &= \frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{1}{n^{2}k^{2}}-\frac{\pi}{8}\sum_{k=1}^{\infty}\sum_{n=k+1}^{\infty}\frac{1}{k^{2}n^{2}}-\frac{\pi}{8}\sum_{n=1}^{\infty}\sum_{k=n+1}^{\infty}\frac{1}{n^{2}k^{2}} \cr &= \frac{\pi}{8}\sum_{n,k=1}^{\infty}\frac{1}{n^{2}k^{2}}-\frac{\pi}{8}\sum_{1\le k<n<\infty}^{ }\frac{1}{k^{2}n^{2}}-\frac{\pi}{8}\sum_{1\le n<k<\infty}^{ }\frac{1}{n^{2}k^{2}} \cr &= \frac{\pi}{8}\sum_{n=k=1}^{\infty}\frac{1}{n^{2}k^{2}} \cr &= \frac{\pi}{8}\left(\frac{\pi^{4}}{90}\right) \cr &= \frac{\pi^{5}}{720}. \cr } $$

Additionally, we have

$$ \eqalign{ \int_{0}^{\frac{\pi}{2}}x^{3}\ln\left(1+e^{2ix}\right)dx &= \int_{0}^{\frac{\pi}{2}}x^{3}\sum_{n=1}^{\infty}\frac{\left(-1\right)^{n+1}e^{2nix}}{n}dx \cr &= \sum_{n=1}^{\infty}\frac{\left(-1\right)^{n+1}}{n}\int_{0}^{\frac{\pi}{2}}x^{3}e^{2nix}dx \cr &= \sum_{n=1}^{\infty}\frac{\left(-1\right)^{n+1}}{n}\left(\frac{6+e^{i\pi n}\left(-6+\pi n\left(\pi n\left(3-i\pi n\right)+6i\right)\right)}{16n^{4}}\right) \cr &= \frac{3}{8}\sum_{n=1}^{\infty}\frac{\left(-1\right)^{n+1}}{n^{5}}+\frac{3}{8}\sum_{n=1}^{\infty}\frac{1}{n^{5}}-\frac{3\pi i}{8}\sum_{n=1}^{\infty}\frac{1}{n^{4}}-\frac{3\pi^{2}}{8}\sum_{n=1}^{\infty}\frac{1}{n^{3}}+\frac{i\pi^{3}}{16}\sum_{n=1}^{\infty}\frac{1}{n^{2}} \cr &= \frac{3}{8}\left(\frac{15}{16}\zeta{(5)}\right)+\frac{3}{8}\zeta{(5)}-\frac{3\pi i}{8}\left(\frac{\pi^{4}}{90}\right)-\frac{3\pi^{2}}{16}\zeta{(3)}+\frac{i\pi^{3}}{16}\left(\frac{\pi^{2}}{6}\right) \cr &= \frac{i\pi^{5}}{160}+\frac{93\zeta{(5)}}{128}-\frac{3\pi^{2}\zeta{(3)}}{16}. \cr } $$

Gathering everything together and taking the real part of $I$, we get

$$ \Re I = \frac{\pi^{5}}{720}-\Re 2i\left(\frac{i\pi^{5}}{160}+\frac{93\zeta{(5)}}{128}-\frac{3\pi^{2}\zeta{(3)}}{16}\right)-\frac{\pi^{5}}{160} = \frac{11\pi^{5}}{1440}. $$

In conclusion,

$$\int_{0}^{\frac{\pi}{2}}x^{2}\ln^{2}\left(2\cos\left(x\right)\right)dx = \frac{11\pi^{5}}{1440}.$$


  • 1
    $\begingroup$ Amazing solution, but sad thing is that I don't know how to do integrals using counters so would you tell me what are some prerequisites to learn counter integrals? Because I tried to learn but they were using too much Real Analysis in that so.... Thank you very much ! $\endgroup$ Dec 19, 2022 at 3:58
  • $\begingroup$ Thanks for the comment! I don't think there are specific prerequisites for learning contour integrals since contour integration varies a lot in techniques. To be successful at it requires a lot of practice and knowledge. I would recommend just getting your hands dirty on the basics of complex numbers and real analysis. You could try reading this. Once you feel comfortable with that stuff, then you can explore this YouTube channel and this website. @Luckychouhan $\endgroup$ Dec 19, 2022 at 4:09
  • 1
    $\begingroup$ Wow! Thank you! You helped me a lot, I didn't even know about those amazing website that you mentioned. Have a mathematical day! $\endgroup$ Dec 19, 2022 at 4:12
  • $\begingroup$ You too! Thank you for the interesting integral. @Luckychouhan $\endgroup$ Dec 19, 2022 at 4:13
  • 1
    $\begingroup$ Beautiful solution. That was a good read! (+1) $\endgroup$ Dec 19, 2022 at 15:23

Using the Fourier expansion does work, though I have yet to completely evaluate every sum that makes up the overall integral. Recall the log-sine expansion,

$$\ln(\sin(x))=-\ln(2)-\sum_{k=1}^\infty \frac{\cos(2kx)}k$$

Expand the integrand as

$$x^2 \ln^2(2\cos(x)) = x^2 \bigg(\ln^2(2) + 2 \ln(2) \ln(\cos(x)) + \ln^2(\cos(x))\bigg)$$


$$I_{m,n} = \int_0^{\frac\pi2} x^m \ln^n(\sin(x)) \, dx$$

so that

$$\begin{align*} \mathcal I &= \int_0^{\frac\pi2} x^2 \ln^2(2\cos(x)) \, dx \\[1ex] &= \ln^2(2) I_{2,0} + 2\ln(2) I_{2,1} + I_{2,2} \end{align*}$$

$$\begin{align*} I_{2,0} &= \int_0^{\frac\pi2} x^2 \, dx \\[1ex] &= \frac{\pi^3}{24} \end{align*}$$

$$\begin{align*} I_{2,1} &= - \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \left(\ln(2) + \sum_{k=1}^\infty \frac{\cos(2kx)}k\right) \, dx \\[1ex] &= -\frac{\pi^3}{24}\ln(2) - \sum_{k=1}^\infty \frac1k \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \cos(2kx) \, dx \\[1ex] &= -\frac{\pi^3}{24}\ln(2) - \sum_{k=1}^\infty \frac1{2k} \int_0^\pi \left(\frac\pi2-\frac x2\right)^2 \cos(kx) \, dx \\[1ex] &= -\frac{\pi^3}{24}\ln(2) - \sum_{k=1}^\infty \frac\pi{4k} \left(\frac{(-1)^k}{k^2} - \frac{-1+(-1)^k}{k^2}\right) \\[1ex] &= -\frac{\pi^3}{24}\ln(2) - \frac\pi4 \zeta(3) \end{align*}$$

$$\begin{align*} I_{2,2} &= \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \left(-\ln(2)-\sum_{k=1}^\infty \frac{\cos(2kx)}k\right)^2 \, dx \\[1ex] &= \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \left(\ln^2(2) + 2 \ln(2) \sum_{k=1}^\infty \frac{\cos(2kx)}k + \left(\sum_{k=1}^\infty \frac{\cos(2kx)}k\right)^2\right) \, dx \\[1ex] &= \frac{\pi^3}{24}\ln^2(2) + \frac\pi4 \zeta(3) + \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \left(\sum_{k=1}^\infty \frac{\cos(2kx)}k\right)^2 \, dx \\[1ex] &= \frac{\pi^3}{24}\ln^2(2) + \frac\pi4 \zeta(3) \\ &\qquad + \int_0^{\frac\pi2} \left(\frac\pi2-x\right)^2 \left(\sum_{k=1}^\infty \frac{\cos^2(2kx)}{k^2} + 2 \sum_{(k_1,k_2)\in\Bbb N^2} \frac{\cos(2k_1x)\cos(2k_2)x}{k_1k_2}\right) \, dx \\[1ex] &= \frac{\pi^3}{24}\ln^2(2) + \frac\pi4 \zeta(3) + \sum_{k=1}^\infty \frac1{4k^2} \left(\frac{\pi^3}{12} + \frac\pi{8k^2}\right) \\ &\qquad + \frac\pi4 \sum_{(k_1,k_2)\in\Bbb N^2} \frac1{k_1k_2} \left(\frac1{(k_1+k_2)^2} + \frac1{(k_1-k_2)^2}\right) \\[1ex] &= \frac{\pi^3}{24}\ln^2(2) + \frac\pi4 \zeta(3) + \frac{11\pi^5}{2880} \\&\qquad + \frac\pi4 \sum_{(k_1,k_2)\in\Bbb N^2} \frac1{k_1k_2} \left(\frac1{(k_1+k_2)^2} + \frac1{(k_1-k_2)^2}\right) \\[1ex] &= \frac{\pi^3}{24}\ln^2(2) + \frac\pi8 \zeta(3) + \frac{3\pi^5}{320} \\&\qquad + \frac\pi4 \sum_{(k_1,k_2)\in\Bbb N^2} \frac1{k_1k_2} \frac1{(k_1-k_2)^2} \end{align*}$$

where in the double sum, $k_1\neq k_2$.

To evaluate the first sum in $I_{2,2}$, I've used the same approach as shown here. Let

$$g(x) = \sum_{a=1}^\infty \sum_{b=1}^\infty \frac{x^{a+b}}{ab(a+b)^2}$$

Note that this includes the case of $a=b$. Differentiate and multiply by $x$ to recover $f$ (as in linked answer), integrate by parts to solve for $g$, and let $x\to1$ from below.

$$\begin{align*} g'(x) &= \frac1x \int_0^x \frac{\ln^2(1-y)}y\,dy\\ &= \frac{\ln(x)\ln^2(1-x)+2\ln(1-x)\operatorname{Li}_2(1-x)-2\operatorname{Li}_3(1-x)}x \end{align*}$$

Integrate by parts again to get

$$\begin{align*} \sum_{(a,b)\in\Bbb N^2} \frac1{ab(a+b)^2} &= \int_0^1 \frac{\ln(x)\ln^2(1-x)+2\ln(1-x)\operatorname{Li}_2(1-x)-2\operatorname{Li}_3(1-x)}x\,dx \\ &= -\int_0^1 \frac{\ln(x)\ln^2(1-x)}x \, dx \end{align*}$$

where IBP shows the last two integrals are absorbed into the first. Recalling the generating function for $H_n$ the harmonic numbers, $-\frac{\ln(1-x)}{1-x}$, it follows that

$$\sum_{(k_1,k_2)\in\Bbb N^2} \frac1{k_1k_3(k_1+k_2)^2} = \sum_{n=1}^\infty \frac{2H_n}{(n+1)^3} - \sum_{n=1}^\infty \frac1{2n^3} = \frac{\pi^4}{180} - \frac{\zeta(3)}2$$


The second sum of $I_{2,2}$ still remains,

$$\sum_{(k_1,k_2)\in\Bbb N^2} \frac1{k_1k_2} \frac1{(k_1-k_2)^2}$$

  • $\begingroup$ Amazing solution, Thank you very much ! But I have one question is that "How you solved $ \left( \sum_{n=1}^\infty \frac{\cos{2kx}}{k} \right)^2$ ?' I mean in $I_{2,2}$ in 4th step where you simplified it. You used Cauchy product? Because while using Fourier series this was the thing that was terrifying me.. $\endgroup$ Dec 19, 2022 at 7:40
  • 1
    $\begingroup$ Multinomial expansion. It's a generalization of the pattern$$(x+y)^2=x^2+y^2+2xy\\(x+y+z)^2=x^2+y^2+z^2+2(xy+xz+yz)$$and so on. $\endgroup$
    – user170231
    Dec 19, 2022 at 8:20
  • $\begingroup$ @Luckychouhan I've added some more to my answer. Still not quite finished, however. If nothing else, I hope I've demonstrated Accelerator's answer to be far less cumbersome :) $\endgroup$
    – user170231
    Dec 20, 2022 at 3:33
  • $\begingroup$ Yeah Now it is clear, Thank you very much. And sorry from my side because I'm replying to you late even though thing was of my favor, because of college stuff I didn't visit MSE site. But thank you again because of you I learned Multinomial expression and solving double summation. Have a mathematical day! $\endgroup$ Dec 20, 2022 at 12:51

Using $$\ln^2(2\cos x)=x^2+2\sum_{n=1}^\infty(-1)^n\frac{H_{n-1}}{n}\cos(2nx),\quad |x|<\frac{\pi}{2}$$ we have

$$\int_0^{\pi/2} x^2 \ln^2(2\cos{x}) \mathrm{d}x=\int_0^{\pi/2} x^4 \mathrm{d}x+2\sum_{n=1}^\infty(-1)^n\frac{H_{n-1}}{n}\int_0^{\pi/2} x^2\cos(2nx) \mathrm{d}x$$


$$=\frac{\pi^5}{160}+2\sum_{n=1}^\infty(-1)^n\frac{H_{n-1}}{n}\left(\frac{\pi(-1)^n}{4n^2}\right)$$ $$=\frac{\pi^5}{160}+\frac{\pi}{2}\sum_{n=1}^\infty\frac{H_{n}}{n^3}-\frac{\pi}{2}\zeta(4)=\frac{11\pi^{5}}{1440}.$$

  • $\begingroup$ Sir, I'm blessed today, I got answer from you. I have studied your book on Integrals & Harmonic series more than half. Thank you very much sir for your amazing solution. Sorry for being late, was traveling today. $\endgroup$ Jan 15, 2023 at 17:12
  • $\begingroup$ You welcome and thank you for the kind words. $\endgroup$ Jan 15, 2023 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .