Prove that $\int_0^\infty \frac{\ln x}{x^n-1}\,dx = \Bigl(\frac{\pi}{n\sin(\frac{\pi}{n})}\Bigr)^2$

This question inspired me to ask the following.

Prove that

$$I_n = \int_0^\infty \frac{\ln x}{x^n-1}\,dx = \left(\frac{\pi}{n\sin\left(\frac{\pi}{n}\right)}\right)^2,$$

for $\Re(n)>1$.

For some cases there is a nice specific form of $I_n$. For example

$$\begin{align} I_2 & = \frac{\pi^2}{4} \\ I_3 & = \frac{4\pi^2}{27} \\ I_4 & = \frac{\pi^2}{8} \\ I_5 & = \frac{2\left(5+\sqrt 5\right)\pi^2}{125} \\ I_6 & = \frac{\pi^2}{9} \\ I_7 & = \frac{2\pi^2}{49\left(1-\sin\left(\frac{3\pi}{14}\right)\right)} \\ I_8 & = \frac{\left(2+\sqrt 2\right)\pi^2}{32} \end{align}$$


$$ \begin{align} \int_0^\infty\frac{\log(x)}{x^n-1}\mathrm{d}x &=\int_{-\infty}^\infty\frac{x}{e^{nx}-1}e^x\,\mathrm{d}x\\ &=\int_0^\infty\frac{x}{e^{nx}-1}e^x\,\mathrm{d}x+\int_0^\infty\frac{x}{1-e^{-nx}}e^{-x}\,\mathrm{d}x\\ &=\int_0^\infty x(e^{(1-n)x}+e^{(1-2n)x}+e^{(1-3n)x}+\dots)\,\mathrm{d}x\\ &+\int_0^\infty x(e^{-x}+e^{(-1-n)x}+e^{(-1-2n)x}+\dots)\,\mathrm{d}x\\ &=\frac1{(n-1)^2}+\frac1{(2n-1)^2}+\frac1{(3n-1)^2}+\dots\\ &+1+\frac1{(n+1)^2}+\frac1{(2n+1)^2}+\frac1{(3n+1)^2}+\dots\\ &=\frac1{n^2}\sum_{k\in\mathbb{Z}}\frac1{\left(k+\frac1n\right)^2}\\ &=\frac{\pi^2}{n^2}\csc^2\left(\frac\pi{n}\right) \end{align} $$ where the last step uses the derivative of $(7)$ from this answer


We can use a contour integral in the complex plane, as I showed here for the case $n=3$. Now, however, we use

$$\oint_C dz \frac{\log^2{z}}{z^n-1}$$

where $C$ is the modified keyhole contour about the positive real axis of outer radius $R$ and inner radius $\epsilon$.

Let's evaluate this integral over the contours. As before, there are $8$ pieces to evaluate, as follows:

$$\int_{\epsilon}^{1-\epsilon} dx \frac{\log^2{x}}{x^n-1} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^2{\left (1+\epsilon e^{i \phi}\right )}}{(1+\epsilon e^{i \phi})^n-1} \\ + \int_{1+\epsilon}^R dx \frac{\log^2{x}}{x^n-1} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{\log^2{\left (R e^{i \theta}\right )}}{R^n e^{i n \theta}-1} \\ + \int_R^{1+\epsilon} dx \frac{(\log{x}+i 2 \pi)^2}{x^n-1} + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{(\log{\left (1+\epsilon e^{i \phi}\right )}+i 2 \pi)^2}{(1+\epsilon e^{i \phi})^n-1} \\ + \int_{1-\epsilon}^{\epsilon} dx \frac{(\log{x}+i 2 \pi)^2}{x^n-1} + i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\log^2{\left (\epsilon e^{i \phi}\right )}}{\epsilon^n e^{i n \phi}-1} $$

As $R \to \infty$, the fourth integral vanishes as $\log^2{R}/R^{n-1}$. As $\epsilon \to 0$, the second integral vanishes as it is $O(\epsilon^n)$, while the eighth integral vanishes as $\epsilon \log^2{\epsilon}$. This leaves the first, third, fifth, sixth and seventh integrals, which in the above limits, become

$$PV \int_0^{\infty} dx \frac{\log^2{x} - (\log{x}+i 2 \pi)^2}{x^n-1} + i \frac{4 \pi^3}{n}$$

The residue computation is a little more involved, because we now have $n-1$ poles at which we need to evaluate residues. The contour integral is thus

$$i 2 \pi \sum_{k=1}^{n-1} \frac{-4 \pi^2 k^2/n^2}{n e^{i 2 (n-1) \pi k/n}} = -i \frac{8 \pi^3}{n^3} \sum_{k=1}^{n-1} k^2 \, e^{-i 2 (n-1) \pi k/n} $$

The sum is doable, but the algebra is a bit hideous. The result is

$$\sum_{k=1}^{n-1} k^2 \, e^{-i 2 (n-1) \pi k/n} = \frac12 \left ( \frac{n}{\sin^2{\frac{\pi}{n}}} - n^2\right ) - i \frac12 n^2 \cot{\frac{\pi}{n}} $$

Equating real and imaginary parts of both equations for the contour integral yields

$$\int_0^{\infty} dx \frac{\log{x}}{x^n-1} = \frac{\pi^2}{n^2 \sin^2{\frac{\pi}{n}}} $$

$$PV \int_0^{\infty} dx \frac{1}{x^n-1} = -\frac{\pi}{n} \cot{\frac{\pi}{n}} $$


$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ \begin{align} \color{#66f}{\large \overbrace{\int_{0}^{\infty}{\ln\pars{x} \over x^{n} - 1}\,\dd x}^{\ds{\color{#c00000}{x^{n}\ \mapsto\ x}}}}\ &=\ -\int_{0}^{\infty}{\ln\pars{x^{1/n}} \over 1 - x}\,{1 \over n}\,x^{1/n - 1}\,\dd x =-\,{1 \over n^{2}}\int_{0}^{\infty}{x^{1/n - 1}\ln\pars{x} \over 1 - x}\,\dd x \\[5mm]&=-\,{1 \over n^{2}}\lim_{\mu\ \to\ 0}\partiald{}{\mu} \int_{0}^{\infty}{x^{\mu + 1/n - 1} - x^{1/n - 1} \over 1 - x}\,\dd x \\[5mm]&=-\,{1 \over n^{2}}\lim_{\mu\ \to\ 0}\partiald{}{\mu} \\&\bracks{ \int_{0}^{1}{x^{\mu + 1/n - 1} - x^{1/n - 1} \over 1 - x}\,\dd x +\int_{1}^{0}{x^{-\mu - 1/n + 1} - x^{-1/n + 1} \over 1 - 1/x}\, \pars{-\,{\dd x \over x^{2}}}} \\[5mm]&=-\,{1 \over n^{2}}\lim_{\mu\ \to\ 0}\partiald{}{\mu} \int_{0}^{1}{x^{\mu + 1/n - 1} - x^{-\mu - 1/n}\over 1 - x}\,\dd x \\[5mm]&={1 \over n^{2}}\lim_{\mu\ \to\ 0}\partiald{}{\mu}\bracks{ \int_{0}^{1}{1 - x^{\mu + 1/n - 1} \over 1 - x}\,\dd x -\int_{0}^{1}{1 - x^{-\mu - 1/n} \over 1 - x}\,\dd x} \\[5mm]&={1 \over n^{2}}\lim_{\mu\ \to\ 0}\partiald{}{\mu}\bracks{ \Psi\pars{\mu + {1 \over n}} - \Psi\pars{-\mu - {1 \over n} + 1}} \end{align} where $\ds{\Psi\pars{z}}$ is the Digamma Function $\color{#000}{\bf 6.3.1}$.

\begin{align}\color{#66f}{\large \int_{0}^{\infty}{\ln\pars{x} \over x^{n} - 1}\,\dd x} &={1 \over n^{2}}\bracks{\Psi'\pars{1 \over n} + \Psi'\pars{-\,{1 \over n} + 1}} \end{align}

With the Euler Reflection Formula $\color{#000}{\bf 6.4.7}$ $$ \Psi'\pars{1 - z} + \Psi'\pars{z} = - \pi\,\totald{\cot\pars{\pi z}}{z} =\pi^{2}\csc^{2}\pars{\pi z} $$

we'll find $$ \color{#66f}{\large \int_{0}^{\infty}{\ln\pars{x} \over x^{n} - 1}\,\dd x ={\pi^{2} \over n^{2}}\,\csc^{2}\pars{\pi \over n}} $$


Utilize $\int_0^\infty\frac{t^{a-1}}{1+t^b}\>dt =\frac\pi{b}\csc\frac{\pi a}b $ as follows \begin{align} \int_0^\infty \frac{\ln x}{x^n-1}\,dx =& \int_0^\infty \frac1{x^n-1}\left( \frac1n\int_0^\infty \frac{x^n-1}{(1+y)(x^n+y)}dy\right)dx\\ =& \>\frac1n\int_0^\infty \frac{1}{1+y}\left( \int_0^\infty \frac{1}{x^n+y} dx\right)dy \\ =&\>\frac{\pi }{n^2}\csc\frac\pi n \int_0^\infty\frac{y^{\frac1n-1}}{1+y}dy =\frac{\pi^2}{n^2}\csc^2\frac\pi n \end{align}