What is the closed form of the following integral for every $n\in\mathbb{N}$? $$\int_0^\frac{1}{2}x^n\cot(\pi x)\,dx$$ By Mathematica we see that $$\int_0^\frac{1}{2}x\cot(\pi x)\,dx=\frac{\log(2)}{2\pi}$$ $$\int_0^\frac{1}{2}x^2\cot(\pi x)\,dx=\frac{\pi^2\log(4)-7\zeta(3)}{8\pi^3}.$$ If there not exist a closed form, how one can prove these two formulas?

  • $\begingroup$ have you tried integrating by parts ? $\endgroup$
    – Thomas
    Dec 15, 2013 at 13:35
  • $\begingroup$ @Thomas: There not exist an elementary anti-derivative for $x^n\cot(\pi x)$ $\endgroup$
    – user91500
    Dec 15, 2013 at 13:43
  • $\begingroup$ @Thomas My initial attempts to integrate by parts either give me divergent integrals or anti-derivatives with special functions I don't understand. $\endgroup$
    – David H
    Dec 15, 2013 at 13:55

2 Answers 2


Your integral can be related to derivatives of the Hurwitz Zeta function.

But, an interesting tidbit is that Ramanujan derived the formula:

$\displaystyle 1/2\int_{0}^{x}u^{n}\cot(u/2)du$

$\displaystyle=\cos(\frac{\pi n}{2})n!\zeta(n+1)-\sum_{k=0}^{n}(-1)^{\frac{k(k+1)}{2}}\frac{\Gamma(n+1)}{\Gamma(n+1-k)}x^{n-k}Cl_{k+1}(x)$

Where $Cl_{k+1}(x)$ is the Clausen function:

$\displaystyle Cl_{n}(x)=\Re [Li_{n}(e^{-ix})], \;\ \text{n odd} \;\ or \;\ -\Im [Li_{n}(e^{-ix})], \;\ \text{n even}$

Where $Li_{n}(e^{-ix})$ is the polylogarithm.

For instance, $Li_{1}(e^{-i/2})=-\ln(1-e^{-i/2})=-\ln(2\sin(1/4))-(\frac{\pi}{2}-\frac{1}{4})i$

$\Re[Li_{2}(e^{ix})]=\frac{x^{2}}{4}-\frac{\pi x}{2}+\frac{\pi^{2}}{6}$.

So, for $x=-1/2$, we get $\frac{\pi^{2}}{6}+\frac{\pi}{4}+\frac{1}{16}$

A simple sub can whittle this more into your form.


If I may add another very useful identity. where p(x) is a polynomial like $x^{2}$ for instance.

$\displaystyle \int_{a}^{b}p(x)\cot(nx)dx=2\sum_{k=1}^{\infty}\int_{a}^{b}\sin(2nkx)dx$.

provided $\sin(nx)\neq 0 \;\ \forall x \in [a,b]$

Let's do an example. Say we want $\displaystyle \int_{0}^{\frac{1}{2}}x^{2}\cot(\pi x)dx=2\sum_{k=1}^{\infty}\int_{0}^{\frac{1}{2}}x^{2}\sin(2\pi kx)dx$

Integrating the right side results in the sums:

$\displaystyle-\frac{1}{4\pi}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k}+\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k^{3}}-\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{1}{k^{3}}=\frac{\ln(2)}{4\pi}-\frac{1}{\pi^{3}}\cdot \frac{3}{8}\zeta(3)-\frac{1}{2\pi^{3}}\zeta(3)=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$

Thus, $\displaystyle \int_{0}^{1/2}x^{2}\cot(\pi x)dx=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$

  • 3
    $\begingroup$ +1: The paper from Srivastava, Glasser and Adamchik 'Some Definite Integrals Associated with the Riemann Zeta Function' may be of interest too (the answer is page $15$). $\endgroup$ Dec 16, 2013 at 23:52
  • $\begingroup$ Thanks for the link to that cool paper, Ray. I managed to find Ramanujan's proof of the general form I stated above. It is in his Notebook I, entries 13 and 14 around page 260. If you can find it, it is worth a peek. $\endgroup$
    – Cody
    Dec 17, 2013 at 14:55
  • $\begingroup$ Thanks for the link @Cody (Ramanujan's work is always fascinating!). In my answer to ALGEAN from yesterday I added too a link to this chapter $9$ (page $192$ of the book concerning $\;\displaystyle \int_1^2 \frac {\ln(x)^k}{x-1}dx\,$). It seems a good one for the OP! Cheers, $\endgroup$ Dec 17, 2013 at 15:40

I can at least do the first one:$$\begin{align}\int_0^{\frac12}x\cot(\pi x)\text dx&=\left.\frac1\pi x\log(\sin(\pi x))\right|_0^{\frac12}-\int_0^{\frac12}\frac1\pi\log\sin(\pi x)\text dx\\ &=-\frac1{\pi^2}\int_0^{\pi/2}\log\sin x\ \text dx\tag 1\\ &=\frac{\log 2}{2\pi}\tag 2 \end{align}$$

Justification for $(1)$:

$$\begin{align} \lim_{x\to 0} x\log(\sin(\pi x))&=\lim_{x\to0} x\log(\pi x)\\ &=\lim_{x\to\infty} \frac{\log(x^{-1}\pi)}{x}\\ &=\lim_{x\to\infty} \frac{-\log\left(\frac x\pi\right)}{x}\\ &=0 \end{align}$$

Justification for $(2)$:

$$\begin{align} I&:=\int_0^{\pi/2}\log\sin x\,\text dx=\int_0^{\pi/2}\log\cos x\,\text dx\\ 2I&=\int_0^{\pi/2}\log\sin x\,\text dx+\int_0^{\pi/2}\log\cos x\,\text dx\\ &=\int_0^{\pi/2}\log(\sin x\cos x)\,\text dx\\ &=\int_0^{\pi/2}\log\left(\frac12\sin (2x)\right)\text dx\\ &=-\frac\pi 2\log 2+\int_0^{\pi/2}\log\sin(2x)\,\text dx\\ &=-\frac\pi 2\log 2+\frac12\int_0^{\pi}\log\sin(x)\,\text dx\\ &=-\frac\pi 2\log 2+\frac12(2I)\\ I&=-\frac\pi 2\log 2 \end{align}$$

  • $\begingroup$ Why are we sure that the area under $\log \cos x$ and $\log \sin x$ are the same? $\endgroup$ Dec 16, 2013 at 0:39
  • 2
    $\begingroup$ @BennettGardiner That's just the reflection $x \mapsto \frac{\pi}{2}-x$. $\endgroup$ Dec 16, 2013 at 9:50

You must log in to answer this question.

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