# 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?

• $$\tanh(\frac{x\pi}{2})=\frac{4x}{\pi}\sum_{k\geq0}\frac{1}{(2k+1)^{2}+x^{2}}.$$ – Marco Cantarini Jun 17 '16 at 19:33

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).$$

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)$!

• Who wrote that development of the complex version of Frullani's theorem? ;-)) – Mark Viola May 17 '17 at 19:46


\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.