Find the closed form for $\int_{0}^{\infty}\cos{x}\ln\left({1+e^{-x}\over 1-e^{-x}}\right)dx=\sum_{n=0}^{\infty}{1\over n^2+(n+1)^2}$

$$I=\int_{0}^{\infty}\cos{x}\ln\left({1+e^{-x}\over 1-e^{-x}}\right)dx=\sum_{n=0}^{\infty}{1\over n^2+(n+1)^2}\tag1$$

$$\ln\left({1+e^{-x}\over 1-e^{-x}}\right)=2\sum_{n=0}^{\infty}{e^{-(2n+1)x}\over 2n+1}\tag2$$

Sub $(2)$ into $(1)\rightarrow (3)$

$$I=2\sum_{n=0}^{\infty}{1\over 2n+1}\int_{0}^{\infty}e^{-(2n+1)x}\cos{x}dx\tag3$$

Apply integration by parts to $(4)$

Hence

$$I=\int_{0}^{\infty}e^{-(2n+1)x}\cos{x}dx={2n+1\over (2n+1)^2+1}\tag4$$

Apply $(4)$ into $(3)$

Hence

$$I=\sum_{n=0}^{\infty}{2\over (2n+1)^2+1}\tag5$$

Simplify $${2\over (2n+1)^2+1}={2\over 4n^2+4n+2}={1\over n^2+(n+1)^2}$$

Therefore

$$I=\sum_{n=0}^{\infty}{1\over n^2+(n+1)^2}\tag6$$

I am not able to determine the closed form for $(1)$, can anyone please help?


Edit(hint from Marco)

$$I=\int_{0}^{\infty}\cos{x}\ln\left({1+e^{-x}\over 1-e^{-x}}\right)dx={\pi\over 2}\tanh\left({\pi\over 2}\right)\tag1$$

Can anybody prove $(1)$ using another method?


Solution 1:

Denoting $$F(a)=\sum_{n=1}^\infty \frac{1}{n^2+a^2}=\frac{\pi a\coth\pi a-1}{2a^2}$$ (see, for example, here), we get $$I=2\sum_{n=0}^\infty\frac{1}{(2n+1)^2+1}=2\left(\sum_{n=1}^\infty\frac{1}{n^2+1}-\sum_{n=1}^\infty\frac{1}{(2n)^2+1}\right)=2F(1)-\frac12 F\Bigl(\frac{1}{2}\Bigr).$$

Solution 2:

Another approach, just for fun. Using Cantarini's lemma: $$ \frac{1}{a^2+b^2}=\int_{0}^{+\infty}\frac{\sin(ax)}{a}e^{-bx}\,dx \tag{1}$$ and the fact that $ g(x)=\sum_{n\geq 0}\frac{\sin((2n+1)x)}{2n+1}$ is the Fourier series of a rectangle wave $r(x)$ we have:

$$\begin{eqnarray*} \sum_{n\geq 1}\frac{1}{n^2+(n+1)^2} = 2\sum_{n\geq 1}\frac{1}{(2n+1)^2+1} &=& -1+2\int_{0}^{+\infty}r(x)\,e^{-x}\,dx\\&=&-1+\frac{\pi}{2}\left(\int_{0}^{\pi}e^{-x}\,dx\right)\sum_{k\geq 0}(-1)^k e^{-k\pi}\\&=&-1+\frac{\pi}{2}(1-e^{-\pi})\frac{1}{1+e^{-\pi}}\\&=&\color{red}{-1+\frac{\pi}{2}\,\tanh\left(\frac{\pi}{2}\right)}.\tag{2} \end{eqnarray*}$$


Another creative approach comes from computing the Fourier (cosine) transform of $\frac{\tanh x}{x}$, then prove the wanted result from Fourier inversion. But the Fourier transform of $\frac{\tanh x}{x}$ (a re-scaled $\log\coth$) can be found through the complex version of Frullani's theorem, the fact that $\text{Re}\log(z)=\log\|z\|$ and the Weierstrass products for $\sin$ and $\coth$. So, from Marco to Marco :D

But, wait: this is just the same as applying Poisson's summation formula to the RHS of OP's $(1)$!

Solution 3:

$\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}{\Leftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[2]{\,\mathrm{Li}_{#1}\left(\,{#2}\,\right)} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

\begin{align} \color{#f00}{I} & = \sum_{n = 0}^{\infty}{1 \over n^{2} + \pars{n + 1}^{2}} = \sum_{n = 0}^{\infty}{1 \over \pars{n + 1 + n\ic}\pars{n + 1 - n\ic}} = \sum_{n = 0}^{\infty} {1 \over \bracks{\pars{1 + \ic}n + 1}\bracks{\pars{1 - \ic}n + 1}} \\[3mm] & = \half\sum_{n = 0}^{\infty} {1 \over \bracks{n + \pars{1 - \ic}/2}\bracks{n + \pars{1 + \ic}/2}} = \half\,{\Psi\pars{\bracks{1 - \ic}/2} - \Psi\pars{\bracks{1 + \ic}/2} \over \pars{1 - \ic}/2 - \pars{1 + \ic}/2}\tag{1} \\[3mm] & = \Im\Psi\pars{\half + \color{#f00}{\half}\,\ic} = \half\,\pi\tanh\pars{\pi\,\color{#f00}{\half}} = \color{#f00}{\half\,\pi\tanh\pars{\pi \over 2}} \end{align}

See $\ds{\mathbf{6.3.12}}$ in Abramowitz & Stegun Table. $\ds{\Psi}$ is the Digamma Function. Line $\pars{1}$ is from $\ds{\mathbf{6.3.16}}$ in the above mentioned table.