Integral $\int_0^\infty \log(1+x^2)\frac{\cosh{\frac{\pi x}{2}}}{\sinh^2{\frac{\pi x}{2}}}\mathrm dx=2-\frac{4}{\pi}$

Hi I am trying to show$$I:=\int_0^\infty \log(1+x^2)\frac{\cosh{\frac{\pi x}{2}}}{\sinh^2{\frac{\pi x}{2}}}\mathrm dx=2-\frac{4}{\pi}.$$ Thank you. What a desirable thing to want to prove! It is a work of art this one. I wish to prove this in as many ways as we can find.

Note I tried writing $$I=\int_0^\infty \log(1+x^2)\coth \frac{\pi x}{2} \sinh^{-2} \frac{\pi x}{2}\mathrm dx$$ but this didn't help me much. We can also try introducing a parameter as follows $$I(\alpha)=\int_0^\infty \log(1+x^2)\frac{\cosh{\frac{\alpha \pi x}{2}}}{\sinh^2{\frac{\pi x}{2}}}\mathrm dx,$$ But this is where I got stuck. How can we calculate I? Thanks.

• It's a wonder how you constantly find such integrals. – user137794 May 1 '14 at 6:12
• Your original integral is $I(1)$ not $I'(1)$! – Mhenni Benghorbal May 1 '14 at 6:25
• Integrating by parts with regards to $f(x)=\dfrac1{\sinh x}$ we can rewrite it as $\displaystyle\int_0^\infty\frac{x}{1+x^2}\frac{dx}{\sinh\frac\pi2x}=$ $=\dfrac\pi2-1$. – Lucian May 1 '14 at 7:20
• It may be worthwhile to investigate the generalization $$\int_0^{\infty} \frac{x}{1+x^2} \frac{dx}{\sinh(a x)} = -\frac{\pi}{2a}-\ln{2}-\psi(\frac{a}{2\pi})+\psi(\frac{a}{\pi})$$ (which Mathematica can calculate) – user111187 May 1 '14 at 8:51
• @Tunk-Fey Thank you my friend! – Jeff Faraci May 1 '14 at 22:41

As Lucian stated in the comments, integrating by parts shows that the integral is equivalent to showing that $$\int_{0}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = \frac{\pi}{2}-1 .$$

Let $\displaystyle f(z) = \frac{z}{1+z^{2}} \frac{1}{\sinh \frac{\pi z}{2}}$ and integrate around a rectangle with vertices at $\pm N$ and $\pm N+ i (2N+1)$ where $N$ is some positive integer.

As $N$ goes to infinity through the integers, the integral vanishes on the left and right sides of the rectangle and along the top of the rectangle.

In particular, the absolute value of the integral along the top of the rectangle is bounded by $$\frac{3N+1}{(2N+1)^{2}-1}\int_{-\infty}^{\infty} \frac{1}{\cosh \frac{\pi x}{2}} \ dx = \frac{6N+2}{(2N+1)^{2}-1} \to 0 \ \text{as} \ N \to \infty .$$

Then

$$\int_{-\infty}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = 2 \pi i \left(\text{Res}[f(z),i]+ \sum_{k=1}^{\infty} \text{Res}[f(z),2ki] \right)$$

where

$$\text{Res}[f(z),i] = \lim_{z \to i} \frac{z}{z+i} \frac{1}{\sinh \frac{\pi x}{2}} =\frac{1}{2i}$$

and

$$\text{Res}[f(z),2ki] = \lim_{z \to 2ki} \frac{z}{2z \sinh \frac{\pi z}{2}+(1+z^{2}) \frac{\pi}{2} \cosh \frac{\pi z}{2}} = \frac{4i}{\pi} \frac{(-1)^{k} k}{1-4k^{2}} .$$

And notice that

\begin{align} \sum_{k=1}^{\infty} \frac{(-1)^{k} k}{1-4k^{2}} &= -\frac{1}{4} \sum_{k=1}^{\infty} \left( \frac{(-1)^{k}}{2k+1} + \frac{(-1)^{k}}{2k-1} \right) \\ &= -\frac{1}{4} \left(\arctan(1)-1 - \arctan(1) \right) \\ &= \frac{1}{4} . \end{align}

Therefore,

$$\int_{-\infty}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = 2 \pi i \left(\frac{1}{2i} + \frac{i}{\pi} \right) = \pi - 2$$

which implies

$$\int_{0}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = \frac{\pi}{2} -1 .$$

• Thank you. I like the use of complex variables for this problem – Jeff Faraci May 1 '14 at 22:39

I will solve the general form

\begin{align}\int^\infty_0\frac{x}{x^2+1}\frac{dx}{\sinh(ax)}&=\int^\infty_0\frac{x}{x^2+a^2}\frac{dx}{\sinh(x)} \\&=\int^\infty_0 \int^\infty_0e^{-at} \frac{\sin(xt)}{\sinh(x)}\,dt \, dx\\&=\int^\infty_0 e^{-at}\int^\infty_0 \frac{\sin(xt)}{\sinh(x)} \, dx\,dt \\&=\frac{\pi}{2} \int^\infty_0 e^{-at}\tanh\left(\frac{\pi}{2} t\right)\,dt\\&=\int^\infty_0 e^{-zx}\tanh(x)\,dt \,\,\,\,; z=\frac{2}{\pi}a\\&=\int^\infty_0\frac{e^{-zx}(1-e^{-2x})}{e^{-2x}+1}\,dx\end{align}

By splitting the integral we have

\begin{align} \int^\infty_0\frac{e^{-zx}}{e^{-2x}+1}\,dx &= \sum_{n\geq 0}\int^\infty_0e^{-x(2n+z)}\,dx\\&=\sum_{n\geq 0}\frac{(-1)^n}{2n+z}\\&=\frac{1}{4}\left (\psi \left(\frac{1}{2}+\frac{z}{4}\right)-\psi \left(\frac{z}{4} \right) \right)\end{align}

\begin{align}-\int^\infty_0\frac{-e^{-x(z+2)}}{e^{-2x}+1}\,dx&=-\sum_{n\geq0}\frac{(-1)^n}{z+2+2n}\\&=-\frac{1}{4}\left(-\psi \left(\frac{1}{2}+\frac{z}{4}\right)+\psi\left(1+\frac{z}{4} \right) \right)\end{align}

Hence we have

\begin{align}\int^\infty_0\frac{x}{x^2+1}\frac{dx}{\sinh(ax)}&=\frac{1}{4}\left (2\psi \left(\frac{1}{2}+\frac{z}{4}\right)-\psi \left(1+\frac{z}{4}\right)-\psi \left(\frac{z}{4} \right) \right)\\&=\frac{1}{2}\psi \left(\frac{1}{2}+\frac{z}{4}\right)-\frac{1}{2}\psi \left(\frac{z}{4} \right)-z \\&=\frac{1}{2}\psi \left(\frac{1}{2}+\frac{a}{2\pi}\right)-\frac{1}{2}\psi \left(\frac{a}{2\pi} \right)-\frac{2}{\pi}a \end{align}

Let $a=\pi/2$

\begin{align}\int^\infty_0\frac{x}{x^2+1}\frac{dx}{\sinh(\frac{\pi}{2}x)}&=\frac{1}{2}\psi \left(\frac{1}{2}+\frac{1}{4}\right)-\frac{1}{2}\psi \left(\frac{1}{4} \right)-1\\&=\frac{\pi}{2} \cot(\pi/4)-1\\&=\frac{\pi}{2}-1\end{align}

• This is very useful for the collection of integrals. Thanks a lot for this extra work – Jeff Faraci May 8 '14 at 1:40
• Nice use of Laplace transforms +1 – Jeff Faraci May 8 '14 at 3:54
• @integrals, thanks. It took me some time to find the connection to the digamma function. – Zaid Alyafeai May 8 '14 at 7:10
• Nice answer, Zaid. +1 – Random Variable May 8 '14 at 21:55
• @ZaidAlyafeai For me I had noticed the connection to digamma function but would never have seen the Laplace transform to get things going. This is extremely clever. Thanks again. +1 also if the master Random Variable says so! – Jeff Faraci May 9 '14 at 1:15

You can also use Fourier methods here, just as was done here, beginning from the form discussed above derived after an integration by parts. Note that

$$\int_{-\infty}^{\infty} dx \, x \operatorname{csch}{(\pi x/2)} \, e^{i k x} = 2 \operatorname{sech^2}{\left ( k \right )}$$

Therefore, Parseval's equality implies that

$$I = \frac1{2 \pi} \int_0^{\infty} dk \, \pi \, e^{-k} 2 \operatorname{sech^2}{\left ( k \right )}$$

Integrate by parts to get that

$$I = \int_0^{\infty} dk \, e^{-k} \, \tanh{k} = \int_0^{\infty} dk \, e^{-k} \frac{1-e^{-2k}}{1+e^{-2k}}$$

Expand the denominator to evaluate the integral in terms of a sum:

$$I = \sum_{n=0}^{\infty} (-1)^n \int_0^{\infty} dk \, \left (e^{-(2 n+1) k}-e^{-(2 n+3) k} \right ) = \sum_{n=0}^{\infty} (-1)^n \left (\frac1{2 n+1}-\frac1{2 n+3} \right ) \\ = \frac{\pi}{4} - \left ( 1-\frac{\pi}{4} \right ) = \frac{\pi}{2}-1$$

as was to be shown.

It's only fair that I at least outline a proof of the first equation. In fact, one uses symmetry to rewrite the integral as

$$\int_{-\infty}^{\infty} dx \, x \operatorname{csch}{(\pi x/2)} \, e^{i k x} = 2 \operatorname{Re}{\left [\int_0^{\infty} dx \, x \operatorname{csch}{(\pi x/2)} \, e^{i k x} \right ]}$$

Then use the definition of csch to turn the integral into a sum equal to

$$4 \sum_{n=0}^{\infty} \frac{\pi^2 (n+1/2)^2 - k^2}{[\pi^2 (n+1/2)^2 + k^2]^2} = \frac{2}{\pi^2} \sum_{n=-\infty}^{\infty} \frac{ (n+1/2)^2 - k^2/\pi^2}{[(n+1/2)^2 + k^2/\pi^2]^2}$$

The sum on the RHS may be evaluated using the Residue theorem; the sum is then equal to

$$-\frac{2}{\pi} \sum_{\pm} \left [\frac{d}{dz} \frac{[(z+1/2)^2-k^2/\pi^2] \cot{\pi z}}{(z+1/2\pm i k/\pi)^2} \right ]_{z=-\frac12 \pm i \frac{k}{\pi}}$$

which leads to the stated result.

• Thank you for another method to solving this – Jeff Faraci May 2 '14 at 16:12
• @Integrals: You're welcome; it only made sense to put this down for completeness after I answered your related integral using the same technique. I'll leave you with this thought, though: why did I have to integrate by parts before expanding the denominator of my hyperbolic function (i.e., I traded a sech^2 for a tanh)? It turns out that if you work directly in the sech^2, the resulting sum doesn't converge. Seems like an absolute convergence issue, but I'd like to nail it down. – Ron Gordon May 2 '14 at 17:16
• I think it has something to do with the fact that $\int_{-\infty}^{\infty} dx \, x \operatorname{csch}{(\pi x/2)} \, e^{i k x} = 2 \operatorname{sech^2}{\left ( k \right )}$ has to be interpreted as a Cauchy principal value. – Random Variable May 2 '14 at 20:25
• @RandomVariable: really? I don't think so. The singularity at $x=0$ is removable. – Ron Gordon May 2 '14 at 20:26
• I didn't notice the $x$. Sorry about that. – Random Variable May 2 '14 at 20:31


\begin{align} I&=-\,{1 \over \pi}\int_{x\ \to\ -\infty}^{x\ \to\ \infty}\ln\pars{1 + x^{2}} \,\dd\bracks{1 \over \sinh\pars{\pi x/2}} ={2 \over \pi}\int_{-\infty}^{\infty} {1 \over \sinh\pars{\pi x/2}}\,{x \over x^{2} + 1}\,\dd x \\[3mm]&={2 \over \pi}\bracks{% 2\pi\ic\sum_{n = 1}^{\infty} {1 \over \pi\cosh\pars{n\pi\ic}/2}\,{2n\ic \over \pars{2n\ic}^{2} + 1} + 2\pi\ic\,{1 \over \sinh\pars{\pi\ic/2}}\,{\ic \over 2\ic}} \\[3mm]&={16 \over \pi}\sum_{n = 1}^{\infty}\pars{-1}^{n}{n \over 4n^{2} - 1} + 2 =2 + {4 \over \pi}\bracks{% \sum_{n = 1}^{\infty}{\pars{-1}^{n} \over 2n - 1} +\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over 2n + 1}} \\[3mm]&=2 + {4 \over \pi}\bracks{% -\sum_{n = 0}^{\infty}{\pars{-1}^{n} \over 2n + 1} +\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over 2n + 1}} =2 + {4 \over \pi}\bracks{-1% -\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over 2n + 1} +\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over 2n + 1}} \\[3mm]&=2 - {4 \over \pi} \end{align}

$$\color{#00f}{\large% \int_{0}^{\infty}\ln\pars{1 + x^{2}}\, {\cosh\pars{\pi x/2} \over \sinh^{2}\pars{\pi x/2}}\,\dd x}= \color{#00f}{\large 2 - {4 \over \pi}} \approx 0.7268$$