# Evaluate $\int_0^\infty\frac{1-e^{-x}(1+x )}{x(e^{x}-1)(e^{x}+e^{-x})}dx$

\int_0^\infty\frac{1-e^{-x}(1+x )}{x(e^{x}-1)(e^{x}+e^{-x})}dx

My colleague got this problem from his friend but he didn’t know the answer so he asked my help. Unfortunately, after hours of tired effort I was unable to crack this integral. I was unable to find a way to evaluate it from online search either. I used to be good at solving this kind of problem but now I feel so embarrassed by my stupidity. I’m stuck and I badly need your help. It’s a humbling request to ask people here being so kind to help me out. Thank you.

#### Solutions Collecting From Web of "Evaluate $\int_0^\infty\frac{1-e^{-x}(1+x )}{x(e^{x}-1)(e^{x}+e^{-x})}dx$"

Hint. An approach. One may consider
$$I(s):=\int_0^\infty x^{s-1}\frac{1-e^{-x}(1+x )}{(e^{x}-1)(e^{x}+e^{-x})}dx,\quad s>0, \tag1$$ which one may rewrite as $I_1(s)+I_2(s)$ with

\begin{align} I_1(s):=&\frac12\int_0^\infty x^{s-1}\frac{1-e^{-x}(1+x )}{(e^{x}-1)}dx\\\\ I_2(s):=&-\frac12\int_0^\infty x^{s-1}\frac{\left(1-e^{-x}(1+x )\right)(1-e^{-x})}{(e^{x}+e^{-x})}dx \end{align} each of the preceding integrals is a linear combination of the standard evaluations
\begin{align} a(s,r)=&\int_0^\infty x^{s-1}\frac{e^{-rx}}{(e^{x}-1)}dx=\Gamma(s)\zeta(s,r+1) \\\\ b(s,r)=&\int_0^\infty x^{s-1}\frac{e^{-rx}}{(e^{x}+e^{-x})}dx=\Gamma(s) \left(4^{-s}\zeta\left(s,\frac{1+r}{4}\right)-4^{-s}\zeta\left(s,\frac{3+r}{4}\right)\right) \end{align} where $\zeta(\cdot,\cdot)$ is the Hurwitz zeta function.

Finally one gets that $2I(s)$ is equal to
$$a(s,0)-a(s,1)-a(s+1,1)-b(s,0)+2b(s,1)+b(s+1,1)-b(s,2)-b(s+1,2)$$ which as $s \to 0^+$ gives $I(0)=I$:

$$I=\int_0^\infty\frac{1-e^{-x}(1+x )}{x(e^{x}-1)(e^{x}+e^{-x})}dx=\frac{\pi}8-\frac{\gamma}2+\frac12\ln \pi-\frac34\ln 2$$

confirming @Claude Leibovici’s announced result, where $\gamma$ is the Euler-Mascheroni constant.

This is not an answer but just a result.

Being unable to crack this integral, I made a numerical evaluation and I gave the result to the inverse symbolic calculator. The result is apparently $$\frac{1}{8} \left(\pi +\log \left(\frac{\pi ^4}{64} \right)-4 \gamma\right)$$ ($\gamma$ being Euler’s constant).

This is correct at least for $500$ significant figures.

Now, I am curious to see how the problem could be tackled.

Here is an elementary way:

Denote the wanted integral by $I$. First we note that we can write your integrand as
$$\frac{2+x+xe^x}{2x(1+e^{2x})}-\frac{1}{2}\frac{1}{e^x-1}.$$
Now, we have two diverging parts, but since
$$\gamma=\int_0^{+\infty}\frac{1}{e^x-1}-\frac{1}{xe^x}\,dx,$$
we add and subtract with $1/(2xe^x)$. We get
$$I=-\frac{\gamma}{2}+\int_0^{+\infty}\frac{x(e^{-x}+e^{-2x})-(e^{-x}-e^{-2x})+(e^{-2x}-e^{-3x})}{2x(1+e^{-2x})}\,dx.$$
With
$$\frac{1}{1+e^{-2x}}=\sum_{k=0}^{+\infty}(-1)^ke^{-2kx},$$
we find that $I+\gamma/2$ equals (no problem with convergence, so we can change order of integration and summation)
$$\frac{1}{2}\sum_{k=0}^{+\infty}(-1)^k\int_0^{+\infty} e^{-(1+2k)x}+e^{-(2+2k)x}-\frac{e^{-(1+2k)x}-e^{-(2+2k)x}}{x}+\frac{e^{-(2+2k)x}-e^{-(3+2k)x}}{x}\,dx.$$
All integrals are easily calculated (exponentials and Frullani), and we find that $I+\gamma/2$ equals
$$\frac{1}{2}\sum_{k=0}^{+\infty}(-1)^k\Bigl[\frac{1}{1+2k}+\frac{1}{2+2k}-\log\frac{2+2k}{1+2k}+\log\frac{3+2k}{2+2k}\Bigr]$$
The first two parts should be known from Maclaurin series of $\arctan x$ and $\log(1+x)$. The second two terms are combined and calculated using the Wallis product formula). The result of the series is
$$\frac{\pi}{8}+\frac{1}{4}\log 2+\frac{1}{2}\log\frac{\pi}{4}.$$
Thus, we have found that
$$I=\int_0^{+\infty}\frac{1-e^{-x}(1+x)}{x(e^x-1)(e^x+e^{-x})}\,dx=-\frac{\gamma}{2}+\frac{\pi}{8}+\frac{1}{4}\log 2+\frac{1}{2}\log\frac{\pi}{4}.$$

I answer my own OP instead of improving it as a proof to user @mickep that I did give a try to this problem but I didn’t want to post some useless efforts like “I tried substitution $x=\tan y$ then I failed… miserably“. I consider putting this kind of effort is a a complete joke as shown in some posts with integration tag.

Okay, here is my try. Following user @Anastasiya-Romanova秀’s suggestion, I use the substitution $y=e^{-x}$ and the original integral becomes

\int_0^1\frac{y(y-1)-y^2\log y}{(1-y)(1+y^2)\log y}dy=-\int_0^1\frac{y}{1+y^2}\left(\frac{y}{1-y}+\frac{1}{\log y}\right)dy

Now, we consider the following parametric integral

I(a):=\int_0^1\frac{y^{a-1}}{1+y^2}\left(\frac{y}{1-y}+\frac{1}{\log y}\right)dy

Differentiating $I(a)$ we get

\begin{align}
I'(a)& =\int_0^1\left(\frac{\log y}{1-y}+1\right)\frac{y^{a-1}}{1+y^2}dy\\
&=\int_0^1\frac{y^{a}\log y}{1-y^4}dy+\int_0^1\frac{y^{a+1}\log y}{1-y^4}dy+\int_0^1\frac{y^{a-1}}{1+y^2}dy\\
&=\sum_{k=0}^\infty\int_0^1\left(y^{4k+a}\log y+y^{4k+a+1}\log y+(-1)^ky^{2k+a-1}\right)dy\\
&=\sum_{k=0}^\infty\left(-\frac{1}{(4k+a+1)^2}-\frac{1}{(4k+a+2)^2}+\frac{(-1)^k}{2k+a}\right)\\
&=\frac{1}{16}\left(-\psi_1\!\left(\frac{a+1}{4}\right)-\psi_1\!\left(\frac{a+2}{4}\right)+4\psi\!\left(\frac{a+2}{4}\right)-4\psi\!\left(\frac{a}{4}\right)\right)
\end{align}

where I use the following relation

\sum_{k=0}^\infty\frac{(-1)^k}{(z+k)^{m+1}}=\frac1{(-2)^{m+1}m!}\!\left(\psi_m\left(\frac{z}{2}\right)-\psi_m\!\left(\frac{z+1}{2}\right)\right)

Hence

I(a)=\int_{\infty}^aI'(a)\ da=-\frac{1}{4}\psi\!\left(\frac{a+1}{4}\right)-\frac{1}{4}\psi\!\left(\frac{a+2}{4}\right)+\log\Gamma\!\left(\frac{a+2}{4}\right)-\log\Gamma\!\left(\frac{a}{4}\right)

Hence our considered problem is $\color{red}{-I(2)}$ which confirms user @ClaudeLeibovici’s result.

\begin{align}
\int_0^\infty\frac{1-e^{-x}(1+x )}{x(e^{x}-1)(e^{x}+e^{-x})}dx&=\frac{1}{4}\psi\!\left(\frac{3}{4}\right)+\frac{1}{4}\psi\!\left(1\right)+\log\Gamma\!\left(\frac{1}{2}\right)\\[10pt]
&=\frac{1}{8}\left(\pi+\log\left(\frac{\pi ^4}{64}\right)-4\gamma\right)
\end{align}

where I use special value of the digamma function

\psi\!\left(\frac{1}{4}\right)=-\frac{\pi}{2}-3\log2-\gamma

and the reflection formula

\psi\!\left(1-x\right)-\psi\!\left(x\right)=\pi\cot\pi x

Done!

\begin{align} \int_0^\infty\frac{1-e^{-x}(1+x)}{x(e^x-1)(e^x+e^{-x})}\,\mathrm{d}x &=\int_0^\infty\frac{e^x-(1+x)}{x(e^x-1)(e^{2x}+1)}\,\mathrm{d}x\tag{1}\\ &=\int_0^\infty\sum_{k=2}^\infty\frac{x^{k-1}}{k!}\frac1{(e^x-1)(e^{2x}+1)}\,\mathrm{d}x\tag{2}\\ &=\int_0^\infty\sum_{k=2}^\infty\frac{x^{k-1}}{k!}\,\frac12\left(\frac1{e^x-1}-\frac{1+e^x}{e^{2x}+1}\right)\mathrm{d}x\tag{3}\\ &=\int_0^\infty\sum_{k=2}^\infty\frac{x^{k-1}}{k!}\sum_{j=1}^\infty\left(e^{(1-4j)x}+e^{-4jx}\right)\mathrm{d}x\tag{4}\\ &=\sum_{j=1}^\infty\sum_{k=2}^\infty\left(\frac1{k(4j-1)^k}+\frac1{k(4j)^k}\right)\tag{5}\\ &=\sum_{j=1}^\infty\left[\log\left(\frac{4j-1}{4j-2}\right)-\frac1{4j-1}\right]\\ &+\sum_{j=1}^\infty\left[\log\left(\frac{4j}{4j-1}\right)-\frac1{4j}\right]\tag{6}\\ &=\sum_{j=1}^\infty\left[\log\left(\frac{j}{j-\frac12}\right)-\frac1{2j}+\frac14\left(\frac1j-\frac1{j-\frac14}\right)\right]\tag{7}\\[3pt] &=\log\left(\Gamma\left(\frac12\right)\right)-\frac\gamma2+\frac14H_{-1/4}\tag{8}\\[9pt] &=\frac12\log(\pi)-\frac\gamma2+\frac\pi8-\frac34\log(2)\tag{9} \end{align}
Explanation:
$(1)$: multiply numerator and denominator by $e^x$
$(2)$: expand $e^x-(1+x)$ into a power series
$(3)$: partial fractions
$(4)$: expand into a power series
$(5)$: perform the integration using the Gamma integral
$(6)$: use the power series for $\log(1+x)$
$(7)$: arithmetic
$(8)$: $\prod\limits_{k=1}^{n-1}(k+x)=\frac{\Gamma(n+x)}{\Gamma(1+x)}$, Gautschi’s Inequality, $\lim\limits_{n\to\infty}\left(\sum\limits_{k=1}^n\frac1k-\log(n)\right)=\gamma$,
$\phantom{(8)\text{:}}$ and $(2)$ from this answer
$(9)$: $(11)$ from this answer