# Is there any other simpler method to evaluate $\int_0^{\infty} \frac{x^n-2 x+1}{x^{2 n}-1} d x,$ where $n\geq 2?$

Though $$n\geq 2$$ is a real number, which is not necessarily an integer, we can still resolve the integrand into two fractions,

$$\displaystyle I=\int_0^{\infty} \frac{x^n-2 x+1}{\left(1+x^n\right)\left(1-x^n\right)} d x=\int_0^{\infty}\left(\frac{x}{1+x^n}-\frac{1-x}{1-x^n}\right) d x=J-K\tag*{}$$ For the integral $$J$$, we are going to transforms it into a Beta function by letting $$y=\frac{1}{1+x^n}$$.

\displaystyle \begin{aligned}J & =\frac{1}{n} \int_0^1 y^{-\frac{2}{n}}(1-y)^{\frac{2}{n}-1} d y \\& =\frac{1}{n} B\left(-\frac{2}{n}+1, \frac{2}{n}\right) \\& =\frac{\pi}{n} \csc \left(\frac{2 \pi}{n}\right) \quad \textrm{ (By Euler Reflection Formula)}\end{aligned}\tag*{}

Next, we are going to evaluate the integral $$\displaystyle K=\displaystyle \int_{0}^{\infty} \frac{1-x}{1-x^{n}} d x \tag*{}$$ by the theorem $$\displaystyle \displaystyle \sum_{k=-\infty}^{\infty} \frac{1}{k+z}=\pi \cot (\pi z), \textrm{ where } z\notin Z.\tag*{}$$

We first split the integral into two integrals $$\displaystyle \displaystyle \int_{0}^{\infty} \frac{1-x}{1-x^{n}} d x=\int_{0}^{1} \frac{1-x}{1-x^{n}} d x+\int_{1}^{\infty} \frac{1-x}{1-x^{n}} d x \tag*{}$$

Transforming the latter integral by the inverse substitution $$x\mapsto \frac{1}{x}$$ m, we have $$\displaystyle \displaystyle \int_{1}^{\infty} \frac{1-x}{1-x^{n}} d x=\int_{0}^{1} \frac{x^{n-3}-x^{n-2}}{1-x^{n}} d x \tag*{}$$ Putting back yields \begin{aligned}\displaystyle K&=\int_{0}^{1} \frac{1-x+x^{n-3}-x^{n-2}}{1-x^{n}} d x\\\displaystyle &=\int_{0}^{1}\left[\left(1-x+x^{n-3}-x^{n-2}\right) \sum_{k=0}^{\infty} x^{n k}\right] d x\\ \displaystyle & =\sum_{k=0}^{\infty} \int_{0}^{1}\left[x^{n k}-x^{n k+1}+x^{n(k+1)-3}-x^{n(k+1)-2}\right] d x\\ & =\sum_{k=0}^{\infty}\left(\frac{1}{n k+1}-\frac{1}{n k+2}+\frac{1}{n(k+1)-2}-\frac{1}{n(k+1)-1}\right)\\ & =\sum_{k=0}^{\infty}\left[\frac{1}{n k+1}-\frac{1}{n(k+1)-1}\right]+\sum_{k=0}^{\infty}\left[\frac{1}{n(k+1)-2}-\frac{1}{n k+2}\right] \end{aligned}\tag*{}

Modifying yields \displaystyle \begin{aligned} K&=\frac{1}{n}\left[\sum_{k=0}^{\infty} \frac{1}{k+\frac{1}{n}}+\sum_{k=-1}^{-\infty} \frac{1}{k+\frac{1}{n}}\right]+\frac{1}{n}\left(\sum_{k=1}^{\infty} \frac{1}{k-\frac{2}{n}}+\sum_{k=0}^{-\infty} \frac{1}{k-\frac{2}{n}}\right)\\& =\frac{1}{n}\left(\sum_{k=-\infty}^{\infty} \frac{1}{k+\frac{1}{n}}+\sum_{k=-\infty}^{\infty} \frac{1}{k-\frac{2}{n}}\right)\end{aligned} \tag*{} By the Theorem, $$\displaystyle \displaystyle \sum_{k=-\infty}^{\infty} \frac{1}{k+z}=\pi \cot (\pi z), \tag*{}$$ where $$\displaystyle z\notin Z,$$ we have $$\displaystyle \displaystyle K=\frac{1}{n}\left[\pi \cot \left(\frac{\pi}{n}\right)+\pi \cot \left(\frac{-2 \pi}{n}\right)\right]=\frac{\pi}{n}\left[\cot \left(\frac{\pi}{n}\right)-\cot \left(\frac{2 \pi}{n}\right)\right] =\frac{\pi}{n} \csc \frac{2 \pi}{n} =J\tag*{}$$

We can now conclude that $$\displaystyle \boxed{I=J-K=0 }\tag*{}$$

Is there any other simpler method to evaluate $$\int_0^{\infty} \frac{x^n-2 x+1}{x^{2 n}-1} d x,$$ where $$n\geq 2?$$

• Have you tried complex integration? Commented Jan 9, 2023 at 0:59
• Mathematica confirms the result. Commented Jan 9, 2023 at 1:05
• @Joe Shmo, thank you for your suggestion.
– Lai
Commented Jan 9, 2023 at 2:51
• @DavidG.Stork, thank you for your information.
– Lai
Commented Jan 9, 2023 at 2:51
• Try $x\to 1/x$. I think it works. Commented Jan 9, 2023 at 3:23

Here is maybe the simplest proof\begin{align} &\int_0^{\infty} \frac{x^a-2 x+1}{x^{2 a}-1} d x\\ =& \int_0^{\infty} \frac{x^a-x}{x^{2 a}-1} d x - \int_0^{\infty} \frac{x-1}{x^{2 a}-1}\overset{x\to 1/x}{ d x}\\ =& \int_0^{\infty} \frac{x^{2a-3}-x}{x^{2 a}-1} d x - \int_0^{\infty} \frac{x^{2a-2}-x^a}{x^{2 a}-1}\overset{x\to x^2}{ d x}\\ =& \int_0^{\infty} \frac{x^{2a-3}-x}{x^{2 a}-1} d x -\int_0^{\infty} \frac{2(x^{4a-3}-x^{2a+1})}{(x^{2 a}-1)(x^{2 a}+1)}d x\\ =& \int_0^{\infty} \frac{x^{2a-3}-x}{x^{2 a}+1}\overset{x\to 1/x}{d x}=0 \end{align} Note that $$a$$ need not be an integer.

• Wow, thank you for your wonderful solution. How can you find this?
– Lai
Commented Jan 10, 2023 at 3:04

We have

\begin{align*} &\int_{0}^{\infty} \frac{x^n - 2x + 1}{x^{2n} - 1} \, \mathrm{d}x \\ &= \int_{0}^{\infty} \left( \frac{1}{x^n - 1} - \frac{2x}{x^{2n} - 1} \right) \, \mathrm{d}x \\ &= \mathrm{PV}\!\int_{0}^{\infty} \frac{1}{x^{n} - 1} \, \mathrm{d}x - \mathrm{PV}\!\int_{0}^{\infty} \frac{2x}{x^{2n} - 1} \, \mathrm{d}x \\ &= \mathrm{PV}\!\int_{0}^{\infty} \frac{1}{x^{n} - 1} \, \mathrm{d}x - \mathrm{PV}\!\int_{0}^{\infty} \frac{1}{u^{n} - 1} \, \mathrm{d}u \tag{u = x^2} \\ &= 0. \end{align*}

Addendum. Here, we rigorously justify the third step. Expanding the principal value using the definition,

\begin{align*} &\mathrm{PV}\!\int_{0}^{\infty} \frac{2x}{x^{2n} - 1} \, \mathrm{d}x \\ &= \lim_{\varepsilon \to 0^+} \int_{[0, 1-\varepsilon]\cup[1+\varepsilon,\infty)} \frac{2x}{x^{2n} - 1} \, \mathrm{d}x \\ &= \lim_{\varepsilon \to 0^+} \int_{[0, (1-\varepsilon)^2]\cup[(1+\varepsilon)^2,\infty)} \frac{1}{u^n - 1} \, \mathrm{d}u .\tag{u = x^2} \end{align*}

Then the last integral is recast as

\begin{align*} &\int_{[0, (1-\varepsilon)^2]\cup[(1+\varepsilon)^2,\infty)} \frac{1}{u^n - 1} \, \mathrm{d}u \\ &= \int_{[0, 1-2\varepsilon]\cup[1+2\varepsilon,\infty)} \frac{1}{u^n - 1} \, \mathrm{d}u + \int_{1-2\varepsilon}^{(1-\varepsilon)^2} \frac{1}{u^n - 1} \, \mathrm{d}u - \int_{1+2\varepsilon}^{(1+\varepsilon)^2} \frac{1}{u^n - 1} \, \mathrm{d}u \end{align*}

The first integral converges to the desired term $$\mathrm{PV}\!\int_{0}^{\infty} \frac{1}{u^n - 1} \, \mathrm{d}u$$, hence it suffices to prove that the remaining two integrals vanish as $$\varepsilon \to 0^+$$. However,

\begin{align*} \int_{1-2\varepsilon}^{(1-\varepsilon)^2} \frac{1}{\left| u^n - 1 \right|} \, \mathrm{d}u \leq \int_{1-2\varepsilon}^{(1-\varepsilon)^2} \mathcal{O}(\varepsilon^{-1}) \, \mathrm{d}u \leq \mathcal{O}(\varepsilon) \end{align*}

and similarly,

\begin{align*} \int_{1+2\varepsilon}^{(1+\varepsilon)^2} \frac{1}{\left| u^n - 1 \right|} \, \mathrm{d}u \int_{1+2\varepsilon}^{(1+\varepsilon)^2} \mathcal{O}(\varepsilon^{-1}) \, \mathrm{d}u \leq \mathcal{O}(\varepsilon). \end{align*}

Therefore both integrals vanish as $$\varepsilon \to 0^+$$ and hence the desired claim follows.

• What a fantastic strategy of splitting the integral into two integrals with the same value!
– Lai
Commented Jan 10, 2023 at 3:06

It is debatable whether the following method is simpler, but it leads to a stronger result:

For any $$z \in \mathbb{C}$$ with $$\operatorname{Re}(z) > 0$$ we have \begin{align} \int \limits_0^1 \frac{1 - 2 x + x^z}{1 - x^{2z}} \, \mathrm{d} x &\stackrel{x=t^{1/2z}}{=} \frac{1}{2z} \int \limits_0^1 \frac{t^{\frac{1}{2z} - 1} + t^{\frac{1}{2z} - \frac{1}{2}} - 2 t^{\frac{1}{z} - 1}}{1 - t} \, \mathrm{d} t \\ &\hspace{7pt}= \frac{1}{2z} \left[2 \operatorname{\psi}_0 \left(\frac{1}{z}\right) - \operatorname{\psi}_0 \left(\frac{1}{2z}\right) - \operatorname{\psi}_0 \left(\frac{1}{2z} + \frac{1}{2}\right)\right] \\ &\hspace{7pt}= \frac{\log(2)}{z} \, , \end{align} where the last step follows from the Legendre duplication formula for the digamma function.

The same formula (along with the substitution $$x = t^{-1/2z}$$) yields $$\int \limits_1^\infty \frac{1 - 2 x + x^z}{1 - x^{2z}} \, \mathrm{d} x = - \frac{\log(2)}{z}$$ for $$z \in \mathbb{C}$$ with $$\operatorname{Re} (z) > 1$$, so $$\int \limits_0^\infty \frac{1 - 2 x + x^z}{1 - x^{2z}} \, \mathrm{d} x = 0$$ holds for any such $$z$$.

• Thank you for your generalisation. I learnt a new theorem ‘Legendre duplication formula’ from you.
– Lai
Commented Jan 10, 2023 at 3:51