Integral $\int_0^\infty\frac{\tanh^2(x)}{x^2}dx$

I will open with the main theorem.

Let $s$ be a positive real number. Then the following equality holds. $$\frac{\pi^2}{4}\int_0^{\infty} \dfrac{\tanh(x)\,\tanh(x s)}{x^2}\,dx = s \int_0^1 \ln\left(\frac{1-x}{1+x}\right) \ln\left(\frac{1-x^s}{1+x^s}\right) \,\frac{dx}{x}.\tag{1}$$

Proof.

First, loagrithmically differentiate the Weierstrass-form product of the hyperbolic cosine, to obtain $\displaystyle \, \frac{1}{8x}\tanh(x)=\sum_{n=0}^{\infty} \frac1{\pi^2 (2n+1)^2+(2x)^2}\,.$

Also, since (elementarily) we have $\displaystyle \,\,\int_0^{\infty} \frac1{a^2+x^2}\,dx=\frac{\pi}{2a},\,\,$ it follows that $\displaystyle \,\int_0^{\infty} \frac1{(a^2+x^2)(b^2+x^2)}\,dx=\frac1{b^2-a^2}\int_0^{\infty}\left(\frac1{a^2+x^2}-\frac1{b^2+x^2}\right)dx=\frac{\pi}{2}\,\frac1{ab(a+b)}.$

So, $$\begin{align*} \int_0^{\infty} \frac{\tanh(x)\,\tanh(x s)}{64 x^2 s}\,dx\\ &=\int_0^{\infty} \sum_{n,m=0}^{\infty} \dfrac1{(\pi^2(2n+1)^2+(2x)^2)(\pi^2(2m+1)^2+(2xs)^2)}\,\,dx\\ &=\frac1{2^2 (2s)^2} \sum_{n,m=0}^{\infty} \int_0^{\infty} \dfrac1{x^2+\left(\frac{\pi}{2}(2n+1)\right)^2}\,\dfrac1{x^2+\left(\frac{\pi}{2s}(2m+1)\right)^2}\,dx\\ &=\frac1{4\pi^2} \sum_{n,m=0}^{\infty} \dfrac1{(2n+1)\,(2m+1)\,\,((2n+1)+s(2m+1))}\\ &=\frac1{4\pi^2} \sum_{n,m=0}^{\infty} \dfrac1{(2n+1)(2m+1)} \int_0^1 x^{(2n+1)+s(2m+1)}\,\frac{dx}{x}\\ &=\frac1{16\pi^2} \int_0^1 \ln\left(\frac{1-x}{1+x}\right)\ln\left(\frac{1-x^s}{1+x^s}\right)\,\frac{dx}{x}. \end{align*}$$

Example no. 1

Set $s=1$. With the substitution $x \mapsto \frac{1-x}{1+x},$ we have $$\begin{align*} \frac{\pi^2}{4}\int_0^{\infty} \frac{\tanh^2 x}{x^2}\,dx\\ &=\int_0^1 \ln^2\left(\frac{1-x}{1+x}\right)\,\frac{dx}{x}\\ &=2\int_0^1 \frac{\ln^2 x}{1-x^2}\,dx\\ &=2\int_0^1 \ln^2 x \sum_{n=0}^{\infty} x^{2n} \,dx\\ &=\sum_{n=0}^{\infty} \frac{4}{(2n+1)^3}=\frac{7}{2}\zeta(3). \end{align*}$$

Therefore,

$$ \,\,\int_0^{\infty} \frac{\tanh^2 x}{x^2}\,dx=\frac{14\zeta(3)}{\pi^2}.$$

Example no. 2

Set $s=3$. Employing the same substitution, we have $$\int_0^1 \ln\left(\frac{1-x}{1+x}\right)\ln\left(\frac{1-x^3}{1+x^3}\right)\,\frac{dx}{x}=2\int_0^1 \frac{\ln x}{1-x^2} \ln\left(\frac{x(x^2+3)}{3x^2+1}\right)dx$$

Now, I was able to obtain the following: $$ f(a)=\int_0^1 \dfrac{\ln x \,\ln(a^2+x^2)}{1-x^2}dx=-\frac{\pi^2}{8}\ln(1+a^2)+\frac14 F\left(-\frac1{a^2}\right)-2\operatorname{Re} F\left(\frac{i}{a}\right),$$

where $$ F(z)=\text{Li}_3(z)+2\text{Li}_3(1-z)-\ln(1-z)\text{Li}_2(1-z)-\frac{\pi^2}{6}\ln(1-z)-2\zeta(3).$$

It comes from the fact that whenever $|z|<1$, $\displaystyle \,\, F(z)=\sum_{n=1}^{\infty} \frac{H_{n}^{(2)}}{n}\,z^n.$

Using that notation, $\displaystyle \,\,2\int_0^1 \frac{\ln x}{1-x^2}\ln\left(\frac{x(x^2+3)}{3x^2+1}\right)dx=\frac{7}{2}\zeta(3)+\frac{\pi^2}{4}\ln3+2f(\sqrt{3})-2f\left(\frac1{\sqrt{3}}\right).$

The trouble was simplifying the hideous, monstrous expression. After several hours of painful simplification by hand, I finally obtained

$$\int_0^1 \ln\left(\frac{1-x}{1+x}\right)\,\ln\left(\frac{1-x^3}{1+x^3}\right)\frac{dx}{x}=\frac{\pi^2}{18}\ln3-\frac{2\pi^2}{3}\ln2+\frac{8}{3}\ln^3 2-\frac{7}{2}\zeta(3)-2\text{Li}_3\left(\frac14\right)\\+16\operatorname{Re} \text{Li}_3(1-i\sqrt{3})-\frac{2\pi}{3}\operatorname{Im}\text{Li}_2\left(-\frac{i}{\sqrt{3}}\right).$$

(can it be simplified more?)

Or,

$$\int_0^{\infty} \frac{\tanh(x)\tanh(3x)}{x^2}\,dx=\frac23\ln3-8\ln2+\frac{32\ln^3 2}{\pi^2}-\frac{42\zeta(3)}{\pi^2}-\frac{24\text{Li}_3\left(\frac14\right)}{\pi^2}\\+\frac{192}{\pi^2}\operatorname{Re}\text{Li}_3(1-i\sqrt{3})-\frac{8}{\pi}\operatorname{Im}\text{Li}_2\left(-\frac{i}{\sqrt{3}}\right).$$

If we set $s=4$ and again substitute $x \mapsto \frac{1-x}{1+x},\,$ we find $$\int_0^1 \ln\left(\frac{1-x}{1+x}\right)\,\ln\left(\frac{1-x^4}{1+x^4}\right)\frac{dx}{x}=2\int_0^1 \frac{\ln x}{1-x^2} \ln\left(\frac{4x(1+x^2)}{x^4+6x^2+1}\right)\,\frac{dx}{x} \\=-\frac{\pi^2}{2}\ln2+\frac{7}{2}\zeta(3)+2f(1)-2f(\sqrt{2}+1)-2f(\sqrt{2}-1)$$

I am not courageous enough to even begin simplifying that.

It seems that a closed form may exist for each natural $s$ (and therfore, for each $1/n$ where $n$ is natural).

For example, under the subsitution $x \mapsto \frac{1-x}{1+x}$, the expression $\displaystyle \frac{1-x^5}{1+x^5}$ turns into $\displaystyle \frac{x(x^4+10x^2+5)}{5x^4+10x^2+1}$.

Factorizing $x^4+10x^2+5=(x^2+5+2\sqrt{5})(x^2+5-2\sqrt{5})$ and $\displaystyle 5x^4+10x^2+1=5\left(x^2+\frac1{5+2\sqrt{5}}\right)\left(x^2+\frac1{5-2\sqrt{5}}\right)$,

it follows that $$ \int_0^1 \ln\left(\frac{1-x}{1+x}\right)\ln\left(\frac{1-x^5}{1+x^5}\right)\frac{dx}{x}=\frac72\zeta(3)+\frac{\pi^2}{4}\ln5+2f\left(\sqrt{5+2\sqrt{5}}\right)+2f\left(\sqrt{5-2\sqrt{5}}\right)-2f\left(\frac1{\sqrt{5+2\sqrt{5}}}\right)-2f\left(\frac1{\sqrt{5-2\sqrt{5}}}\right).$$

Similarly, $$\int_0^1 \ln\left(\frac{1-x}{1+x}\right)\ln\left(\frac{1-x^6}{1+x^6}\right)\frac{dx}{x}=\frac72\zeta(3)-\frac{\pi^2}{4}\ln6+2f(\sqrt{3})+2f\left(\frac1{\sqrt{3}}\right)-2f(1)-2f(2+\sqrt{3})-2f(2-\sqrt{3}).$$

A pattern can be seen. It seems that we can always factorize the expression that results by applying $x\mapsto \frac{1-x}{1+x}$ to $\frac{1-x^n}{1+x^n}$ into factors of the form $x$ and $x^2+r^2$ ($r \in \mathbb{C}$), implying that there is indeed a closed form in terms of logarithms and polylogarithms for $\int_0^{\infty} \tanh(x)\tanh(xn)/x^2\,\,dx$. In fact, the roots $r$ in the factorization seem to always be $\tan(q \pi)$ (up to multiplication by an imaginary unit), where q is a rational number (whose denominator is $n$ when $n$ is odd and $2n$ when it is even) . For example, $\displaystyle \sqrt{2}-1=\tan\left(\frac{\pi}{8}\right),\,\,\,\,\sqrt{5-2\sqrt{5}}=\tan\left(\frac{\pi}{5}\right),\,\,\,\,\,2-\sqrt{3}=\tan\left(\frac{\pi}{12}\right)\,\,$etc.

I am too lazy to write a general formula that works for every natural number.

$\Large \mathbf {EDIT}$

For the sake of completeness, I add below the general formula, which works for every natural number.

Theorem 2.$\,$ Let $n$ be a positive integer. Define the function $F$ by $$ F(z)=\text{Li}_3(z) + 2\text{Li}_3(1-z) - \ln(1-z)\text{Li}_2(1-z) -\frac{\pi^2}{6}\ln(1-z)-2\zeta(3),$$ where we assume the principal value of the logarithm. Now, define the function $g$ by $$g(z)=F(-z^2)-8 \operatorname{Re} F(i z).$$ Then $$ \int_0^1 \ln\left(\frac{1-x}{1+x}\right)\ln\left(\frac{1-x^n}{1+x^n}\right)\frac{dx}{x} =\frac{7}{2}\zeta(3)+\frac12 \sum_{k=1}^{n-1} (-1)^k g\left(\cot\left(\frac{k \pi}{2 n}\right)\right) .$$

This result, with the help of theorem $(1)$, can easily be seen to establish a closed form for $\mathcal A(n) = \int_0^{\infty} \frac{\tanh(x) \tanh(n x)}{x^2}dx $ for each natural $n$.


The solution for $n=3$ can be easily generalized to any $n\ge 2$: it suffices to use parity to extend the integration to $\mathbb R$ and then compute integral by residues by moving the contour to $i\infty$. The residues come from the poles of $\tanh^n z$ given by $z_k=i\pi\left(k+\frac12\right)$, $k\in \mathbb Z$.

For example, as $z\to z_k$, we have $$\frac{\tanh^2 z}{z^2}=\frac{1}{z_k^2}\frac{1}{(z-z_k)^2}-\frac{16i}{\pi^3(2k+1)^3}\frac{1}{z-z_k}+\mathrm{reg.},$$ and therefore the integral is given by $$\int_0^{\infty}\frac{\tanh^2 z}{z^2} dz=\frac12\cdot 2\pi i\sum_{k=0}^{\infty}\left(-\frac{16i}{\pi^3(2k+1)^3}\right)=\frac{14\zeta(3)}{\pi^2}.$$ For general $n$, we will obviously have a finite sum of zeta values.


The case of $$\mathcal I:=\int_0^{\infty}\frac{\tanh z\tanh 2 z}{z^2} dz$$ can be treated analogously. Potential poles of the integrand are given by $z^{I}_k=\frac{i\pi}{2}\left(k+\frac12\right)$ and $z^{II}_k=i\pi\left(k+\frac12\right)$, and we have $$ \frac{\tanh z\tanh 2z}{z^2}= \begin{cases}\frac{\tanh z_k^I}{2\left(z_k^{I}\right)^2}\frac{1}{z-z_k^I}+\mathrm{reg.} & \text{as } z\to z_k^I,\\ \mathrm{reg.} & \text{as } z\to z_k^{II}, \end{cases} $$ so that the actual poles are only given by $z_k^I$. Therefore $$\mathcal I=\pi i\sum_{k=0}^{\infty}\frac{\tanh z_k^I}{2\left(z_k^{I}\right)^2} =\pi i\sum_{k=0}^{\infty}\frac{i(-1)^k}{2\left(\frac{i\pi}{2}\left(k+\frac12\right)\right)^2}=\frac{8K}{\pi},$$ where $K$ denotes Catalan's constant.


I found a way to evaluate this integral without complex analysis, although I think that it is not rigorous yet, because I do not know how to justify the swapping of the integrals and the swapping of the integral and the infinite sum.

Anyway, start with the identity $\displaystyle \,\,\int_0^{\infty} \frac{\sin(z x)}{\sinh(\frac{\pi}{2}x)}dx=\tanh z\,\,\,\,\,\,$ (see here for a proof, for example.) So $$I=\int_0^{\infty} \frac{\tanh^2 z}{z^2}dz=\int_0^{\infty}\int_0^{\infty}\int_0^{\infty}\frac{\sin(zx)\sin(zt)}{z^2\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdtdz \\\\=\int_0^{\infty}\int_0^{\infty}\frac{f(x,t)}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt$$

Where $$f(x,t)=\int_0^{\infty}\frac{\sin(z x)\sin(x t)}{z^2}dz=\large\begin{cases} \frac{\pi}{2}x &:&0<x\le t \\\\\frac{\pi}{2}t&:&0<t\le x\end{cases}$$

which I saw on this Wikipedia list. I could not evaluate this myself, nor find a reference anywhere. (Edit: found a reference.)

Anyway, due to the symmetry, $$ I=\int_0^{\infty}\int_0^{\infty}\frac{f(x,t)}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt \\=\int_0^{\infty}\int_0^{t}\frac{f(x,t)}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt+\int_0^{\infty}\int_t^{\infty}\frac{f(x,t)}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt \\\\=2\int_0^{\infty}\int_t^{\infty}\frac{f(x,t)}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt \\\\=2\int_0^{\infty}\int_t^{\infty}\frac{\frac{\pi}{2} t}{\sinh(\frac{\pi}{2}x)\sinh(\frac{\pi}{2}t)}dxdt \\\\=-2\int_0^{\infty} \frac{t}{\sinh(\frac{\pi}{2} t)}\ln\tanh(\frac{\pi}{4} t)\,dt. $$

Since $\displaystyle \,\,\,\int \frac1{\sinh x}dx=\ln\tanh(\frac{x}{2})+C.$

Now substitute $x=\tanh(\frac{\pi}{4}t)$ to get $$I=-2\int_0^{\infty} \frac{t}{\sinh(\frac{\pi}{2} t)}\ln\tanh(\frac{\pi}{4} t)\,dt \\=-\frac{16}{\pi^2}\int_0^1\frac{\ln x}{x}\,\operatorname{arctanh} x\, dx \\=-\frac{16}{\pi^2}\int_0^1 \frac{\ln x}{x} \sum_{n=0}^{\infty} \frac{x^{2n+1}}{2n+1}\,dx \\=\frac{16}{\pi^2}\sum_{n=0}^{\infty} \frac1{(2n+1)^3} \\=\frac{14\zeta(3)}{\pi^2}. $$

I guess similar reasoning could be used to calculate $\mathcal B(n)$ for bigger natural $n$'s.

Also, here is a reference for other evaluations of $\mathcal A(2)$.

Edit

Yet another solution.

Again, start with the identity $\displaystyle \,\,\int_0^{\infty} \frac{\sin(z x)}{\sinh(\frac{\pi}{2}x)}dx=\tanh z\,.$

Differentiate to obtain
$\displaystyle \,\int_0^{\infty} \frac{x \cos(z x)}{\sinh(\frac{\pi}{2}x)}dx=\operatorname{sech}^2 z.$

It follows that $\displaystyle \,\,\,\,\int_0^{\infty} \frac{x(1- \cos(z x))}{\sinh(\frac{\pi}{2}x)}dx=1-\operatorname{sech}^2 z=\tanh^2 z.$

Recalling that $\int_0^{\infty} \frac{\sin^2 z}{z^2}dz=\frac{\pi}{2}$, we have $\displaystyle \int_0^{\infty} \frac{1-\cos(z x)}{z^2}dz=\int_0^{\infty} \frac{2\sin^2(z x /2)}{z^2}dz=\frac{\pi x}{2}.$

Finally, $$\int_0^{\infty} \frac{\tanh^2 z}{z^2}dz=\int_0^{\infty} \int_0^{\infty} \frac{x(1- \cos(z x))}{z^2 \sinh(\frac{\pi}{2}x)}dx dz\\ =\frac{\pi}{2}\int_0^{\infty} \frac{x^2}{\sinh(\frac{\pi}{2}x)}dx\\ =\frac{8}{\pi^2} \int_0^{\infty} x^2 \sum_{n=0}^{\infty} e^{-x(2n+1)}\,dx\\ =\frac{14\zeta(3)}{\pi^2}.$$