Improper Integral $\int_0^\infty\left(\frac{\tanh(x)}{x^3}-\frac1{x^2\cosh^2(x)}\right)dx = \frac{7\zeta(3)}{\pi^2} $

$\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{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{\mathrm{i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ $\ds{\bbox[5px,#ffd]{\int_{0}^{\infty} \bracks{{\tanh\pars{x} \over x^{3}} - {1 \over x^{2}\cosh^{2}\pars{x}}}\,\dd x = {7 \over \pi^{2}}\,\zeta\pars{3}} \approx 0.8526\ \Large ?}$.


\begin{align} &\color{#f00}{\int_{0}^{\infty} \bracks{{\tanh\pars{x} \over x^{3}} - {1 \over x^{2}\cosh^{2}\pars{x}}}\,\dd x} \\[5mm] = &\ \int_{0}^{\infty}{\tanh\pars{x} - x \over x^{3}}\,\dd x + \int_{0}^{\infty}{\tanh^{2}\pars{x} \over x^{2}}\,\dd x \\[5mm] = & -\,\half\int_{x\ =\ 0}^{x\ \to\ \infty}\bracks{\tanh\pars{x} - x} \,\dd\pars{1 \over x^{2}} + \int_{0}^{\infty}{\tanh^{2}\pars{x} \over x^{2}}\,\dd x \\[5mm] = &\ \half\int_{0}^{\infty}{\mrm{sech}^{2}\pars{x} - 1 \over x^{2}}\,\dd x + \int_{0}^{\infty}{\tanh^{2}\pars{x} \over x^{2}}\,\dd x = \half\int_{0}^{\infty}{\tanh^{2}\pars{x} \over x^{2}}\,\dd x \\[5mm] = &\ 32\sum_{k = 0}^{\infty}\,\sum_{n = 0}^{\infty}\,\,\ \underbrace{% \int_{0}^{\infty}{1 \over \bracks{\pars{2k + 1}\pi}^{\, 2} + 4x^{2}}\, {1 \over \bracks{\pars{2n + 1}\pi}^{\, 2} + 4x^{2}}\,\dd x} _{\ds{1 \over 8\pi^{2}\pars{2k + 1}\pars{2n + 1}\pars{k + n + 1}}} \label{1}\tag{1} \\[5mm] = &\ {4 \over \pi^{2}}\ \underbrace{\sum_{k = 0}^{\infty}{H_{k} + 2\ln\pars{2} \over \pars{2k + 1}^{2}}} _{\ds{{7 \over 4}\,\zeta\pars{3}}}\label{2}\tag{2} = \color{#f00}{{7 \over \pi^{2}}\,\zeta\pars{3}} \end{align} Note that
  • In \eqref{1}, we use the identity $\ds{{\tanh\pars{x} \over x} = 8\sum_{j = 0}^{\infty}{1 \over \bracks{\pars{2j + 1}\pi}^{\, 2} + 4x^{2}}}$
  • The sum over $\ds{n}$, in \eqref{1}, yields a Digamma Function term $\ds{\Psi\pars{1 + k}}$ which explains the appearance of the Harmonic Number $\ds{H_{k} = \Psi\pars{1 + k} + \gamma}$. $\ds{\gamma}$ is the Euler-Mascheroni Constant.
  • $\ds{\sum_{k = 0}^{\infty}{H_{k} \over \pars{2k + 1}^{2}} = {1 \over 4}\bracks{7\zeta\pars{3} - \pi^{2}\ln\pars{2}}}$ is a well known result.
  • $\ds{\sum_{k = 0}^{\infty}{1 \over \pars{2k + 1}^{2}} = {1 \over 8}\,\pi^{2}}$.

A Residue Calculus Approach

At $z=\left(k+\frac12\right)\pi i$, the residue of $\frac{\tanh(x)}{x^3}$ is $\frac{i}{\left(\left(k+\frac12\right)\pi\right)^3}$ and the residue of $\frac1{x^2\cosh^2(x)}$ is $\frac {2i}{\left(\left(k+\frac12\right)\pi\right)^3}$

Therefore, $$ \begin{align} &\int_0^\infty\left(\frac{\tanh(x)}{x^3}-\frac1{x^2\cosh^2(x)}\right)\,\mathrm{d}x\tag{1}\\ &=\frac12\int_{-\infty}^\infty\left(\frac{\tanh(x)}{x^3}-\frac1{x^2\cosh^2(x)}\right)\,\mathrm{d}x\tag{2}\\ &=\frac12\int_{-\infty-i}^{\infty-i}\left(\frac{\tanh(x)}{x^3}-\frac1{x^2\cosh^2(x)}\right)\,\mathrm{d}x\tag{3}\\[6pt] &=\pi i\sum_{k=0}^\infty\left[\frac{i}{\left(\left(k+\frac12\right)\pi\right)^3}-\frac{2i}{\left(\left(k+\frac12\right)\pi\right)^3}\right]\tag{4}\\ &=\frac8{\pi^2}\sum_{k=0}^\infty\frac1{(2k+1)^3}\tag{5}\\[6pt] &=\frac{7\zeta(3)}{\pi^2}\tag{6} \end{align} $$ Explanation:
$(2)$: the integrand is even
$(3)$: the integrand vanishes at $x=\pm\infty$ and has no sinularities in $-1\lt\mathrm{Im}(z)\lt0$
$(4)$: the integrand vanishes like $\frac1{z^2}$ on $\mathrm{Im}(z)\in\mathbb{Z}\pi$
$\phantom{\text{(4): }}$and like $\frac1{z^3}$ as $|\mathrm{Re}(z)|\to\infty$
$\phantom{\text{(4): }}$so the integral is $2\pi i$ times the sum of the residues
$(5)$: algebra
$(6)$: note that the sum is $\frac78\zeta(3)$


Integrating by parts we get $$I=\int_{0}^{\infty}\left(\frac{\tanh\left(x\right)}{x^{3}}-\frac{1}{x^{2}\cosh^{2}\left(x\right)}\right)dx= $$ $$-\int_{0}^{\infty}\frac{1}{x}\left(-\frac{\tanh\left(x\right)}{x^{2}}+\frac{1}{x\cosh^{2}\left(x\right)}+2\frac{\tanh\left(x\right)}{\cosh^{2}\left(x\right)}\right)dx$$ so $$\int_{0}^{\infty}\left(\frac{\tanh\left(x\right)}{x^{3}}-\frac{1}{x^{2}\cosh^{2}\left(x\right)}\right)dx=-\int_{0}^{\infty}\frac{\tanh\left(x\right)}{x\cosh^{2}\left(x\right)}dx $$ and now taking $x=-\log\left(u\right) $ we get $$I=4\int_{0}^{1}\frac{\left(u^{2}-1\right)u}{\left(u^{2}+1\right)^{3}\log\left(u\right)}du=4\int_{0}^{1}\frac{u^{3}-u}{\left(u^{2}+1\right)^{3}\log\left(u\right)}du $$ $$=4\int_{0}^{1}\frac{1}{\left(u^{2}+1\right)^{3}}\int_{1}^{3}u^{z}dzdu=4\int_{1}^{3}\int_{0}^{1}\frac{u^{z}}{\left(u^{2}+1\right)^{3}}dudz $$ and the last integral can be written in terms of the Gauss hypergeometric function $$\int_{0}^{1}\frac{u^{z}}{\left(u^{2}+1\right)^{3}}du=\frac{1}{2}\int_{0}^{1}\frac{u^{z/2-1/2}}{\left(u+1\right)^{3}}du=\frac{1}{z+1}\,_{2}F_{1}\left(3,\frac{z+1}{2},1+\frac{z+1}{2},-1\right) $$ and this particular hypergeometric function has a “closed form” in terms of Digamma function, so we have $$ I=\frac{1}{8}\int_{1}^{3}\left(z^{2}-4z+3\right)\left(\psi\left(\frac{z+3}{4}\right)-\psi\left(\frac{z+1}{4}\right)\right)dz-\frac{1}{8}\int_{1}^{3}2z-8dz. $$ Now note that every single term is in the form $$a\int_{1}^{3}z^{b}\psi\left(\frac{z+c}{4}\right)dz=4a\int_{(1+c)/4}^{(3+c)/4}\left(4v-c\right)^{b}\psi\left(v\right)dv $$ with $b=0,1,2 $ and $c=1,3 $ so let us consider the case $b=0$. We have $$\int_{(1+c)/4}^{(3+c)/4}\psi\left(v\right)dv=\log\left(\frac{\Gamma\left(\frac{3+c}{4}\right)}{\Gamma\left(\frac{1+c}{4}\right)}\right) $$ if $b=1 $ we have, integrating by parts, $$\int_{(1+c)/4}^{(3+c)/4}v\psi\left(v\right)dv=\left(v\log\left(\Gamma\left(v\right)\right)-\psi^{\left(-2\right)}\left(v\right)\right)_{(1+c)/4}^{(3+c)/4}$$ and if $b=2$ we have $$\int_{(1+c)/4}^{(3+c)/4}v^{2}\psi\left(v\right)dv=\left(v^{2}\log\left(\Gamma\left(v\right)\right)-2v\psi^{\left(-2\right)}\left(v\right)+3\psi^{\left(-3\right)}\left(v\right)\right)_{(1+c)/4}^{(3+c)/4}$$ so combining this result and the closed form about polygamma at negative orders we obtain $$I=\color{red}{\frac{7\zeta\left(3\right)}{\pi^{2}}}$$ as wanted.