# Contour integration to compute $\int_0^\infty \frac{\sin ax}{e^{2\pi x}-1}\,\mathrm dx$

How to show:

$$\int_{0}^{\infty}\frac{\sin ax}{e^{2\pi x}-1}dx=\frac{1}{4}\frac{e^{a}+1}{e^{a}-1}-\frac{1}{2a}$$

integrating $\dfrac{e^{aiz}}{e^{2\pi z}-1}$ round a contour formed by the rectangle whose corners are $0 ,R ,R+i,i$ (the rectangle being indented at $0$ and $i$) and making $R \rightarrow \infty$.

For this particular contour, the integral

$$\oint_C dz \frac{e^{i a z}}{e^{2 \pi z}-1}$$

is split into $6$ segments:

$$\int_{\epsilon}^R dx \frac{e^{i a x}}{e^{2 \pi x}-1} + i \int_{\epsilon}^{1-\epsilon} dy \frac{e^{i a R} e^{-a t}}{e^{2 \pi R} e^{i 2 \pi y}-1} + \int_R^{\epsilon} dx \frac{e^{-a} e^{i a x}}{e^{2 \pi x}-1} \\+ i \int_{1-\epsilon}^{\epsilon} dy \frac{ e^{-a t}}{e^{i 2 \pi y}-1} + i \epsilon \int_{\pi/2}^0 d\phi \:e^{i \phi} \frac{e^{i a \epsilon e^{i \phi}}}{e^{2 \pi \epsilon e^{i \phi}}-1}+ i \epsilon \int_{2\pi}^{3 \pi/2} d\phi\: e^{-a} e^{i \phi} \frac{e^{i a \epsilon e^{i \phi}}}{e^{2 \pi \epsilon e^{i \phi}}-1}$$

The first integral is on the real axis, away from the indent at the origin. The second integral is along the right vertical segment. The third is on the horizontal upper segment. The fourth is on the left vertical segment. The fifth is around the lower indent (about the origin), and the sixth is around the upper indent, about $z=i$.

We will be interested in the limits as $R \rightarrow \infty$ and $\epsilon \rightarrow 0$. The first and third integrals combine to form, in this limit,

$$(1-e^{-a}) \int_0^{\infty} dx \frac{e^{i a x}}{e^{2 \pi x}-1}$$

The fifth and sixth integrals combine to form, as $\epsilon \rightarrow 0$:

$$\frac{i \epsilon}{2 \pi \epsilon} \left ( -\frac{\pi}{2}\right) + e^{-a} \frac{i \epsilon}{2 \pi \epsilon} \left ( -\frac{\pi}{2}\right) = -\frac{i}{4} (1+e^{-a})$$

The second integral vanishes as $R \rightarrow \infty$. The fourth integral, however, does not, and must be evaluated, at least partially. We rewrite it, as $\epsilon \rightarrow 0$:

$$-\frac{1}{2} \int_0^1 dy \frac{e^{-a y} e^{- i \pi t}}{\sin{\pi y}} = -\frac{1}{2} PV\int_0^1 dy \: e^{-a y} \cot{\pi y} + \frac{i}{2} \frac{1-e^{-a}}{a}$$

By Cauchy's theorem, the contour integral is zero because there are no poles within the contour. Thus,

$$(1-e^{-a}) \int_0^{\infty} dx \frac{e^{i a x}}{e^{2 \pi x}-1} -\frac{i}{4} (1+e^{-a}) -\frac{1}{2} PV \int_0^1 dy \: e^{-a y} \cot{\pi y} + \frac{i}{2} \frac{1-e^{-a}}{a}=0$$

where $PV$ represents the Cauchy principal value of that integral. Now take the imaginary part of the above equation and do the algebra - the stated result follows.

Besides contour integration, it can be evaluated by series expansion. In fact \begin{eqnarray} \int_{0}^{\infty}\frac{\sin ax}{e^{2\pi x}-1}dx&=&\int_{0}^{\infty}\frac{e^{-2\pi x}\sin ax}{1-e^{-2\pi x}}dx\\ &=&\int_{0}^{\infty}\sum_{n=0}^\infty e^{-2(n+1)\pi x}\sin axdx\\ &=&\sum_{n=0}^\infty \frac{a}{a^2+4\pi^2(n+1)^2}\\ &=&\frac{-2+a\coth(\frac{a}{2})}{4a}\\ &=&\frac{1}{4}\frac{e^{a}+1}{e^{a}-1}-\frac{1}{2a}. \end{eqnarray} Here we used the following result $$\sum_{n=0}^\infty \frac{a}{a^2+n^2}=\pi\coth(a\pi).$$


$\ds{\tt\mbox{Besides the contour integration, it can be nicely evaluated by using the}}$ Abel-Plana Formula:

\begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{\sin\pars{ax} \over \expo{2\pi x} - 1}\,\dd x} =\sgn\pars{a}\int_{0}^{\infty}{\sin\pars{\verts{a}x} \over \expo{2\pi x} - 1} \,\dd x \\[3mm]&=\half\,\sgn\pars{a}\bracks{\ic\int_{0}^{\infty} {\expo{-\verts{a}\pars{\ic x}} - \expo{-\verts{a}\pars{-\ic x}}\over \expo{2\pi x} - 1}\,\dd x} \\[3mm]&=\half\,\sgn\pars{a}\bracks{\sum_{x = 0}^{\infty}\expo{-\verts{a}x} -\int_{0}^{\infty}\expo{-\verts{a}x}\,\dd x -\pars{\half\,\expo{-\verts{a}x}}_{x\ =\ 0}} \\[3mm]&=\half\,\sgn\pars{a}\bracks{% {1 \over 1 - \expo{-\verts{a}}} - {1 \over \verts{a}} - \half} =\half\,\sgn\pars{a}\bracks{% {\expo{\verts{a}} + 1 \over 2\pars{\expo{\verts{a}} - 1}} - {1 \over \verts{a}}} \\[3mm]&=\color{#66f}{\large{1 \over 4}\, {\expo{a} + 1 \over \expo{a} - 1} - {1 \over 2a}} \end{align}