# Evaluating the integral $\int_0^{\infty} \frac{\sin(x)}{\sinh(x)}\,dx$

I was trying to evaluate the following integral, $$I=\int_\limits {-\infty}^{\infty} \dfrac{\sin(x)}{\sinh(x)}\,dx$$ but had no success. I first expanded the the hyperbolic sine: $$I=2\int_\limits {-\infty}^{\infty} \dfrac{\sin(x)}{e^{x}-e^{-x}}\,dx=2\Im \int_\limits {-\infty}^{\infty} \dfrac{e^{ix}}{e^{x}-e^{-x}}\,dx$$ I then substituted $u=e^x$, $$I=2\Im\int_\limits {0}^{\infty} \dfrac{u^i}{u^2-1}\,du$$ Now, I'm not really sure what to do. Also, after exchanging the $\Im$ with the integral seemed to create a non-integrable singularity at $u=1$. When can you not do that?

\begin{align} \int_0^\infty\dfrac{\sin x}{\sinh x}dx &= \int_0^\infty\dfrac{2\sin x}{e^{x}-e^{-x}}dx \\ &= \int_0^\infty\dfrac{2e^{-x}\sin x}{1-e^{-2x}}dx \\ &= \int_0^\infty2e^{-x}\sin x\sum_{n\geq0}e^{-2nx} \\ &= \sum_{n\geq0}2\int_0^\infty e^{-(2n+1)x}\sin x \\ &= \sum_{n\geq0}\dfrac{2}{1+(2n+1)^2} \\ &= \color{blue}{\dfrac{\pi}{2}\tanh\dfrac{\pi}{2}} \end{align} where $$\tanh z=2z\left(\dfrac{1}{z^2+(\frac{\pi}{2})^2}+\dfrac{1}{z^2+(\frac{3\pi}{2})^2}+\dfrac{1}{z^2+(\frac{5\pi}{2})^2}+\cdots\right)$$

• +1, What is a reference for the identity used in the last step? – Tob Ernack Nov 30 '17 at 3:52
• It's the expansion of $\tanh z$ which obtain from Mittag-Leffler's expansion theorem (as far as I remember from complex). – Nosrati Nov 30 '17 at 3:55
• I was doing the work with hypergeometric functions when your answer came. It is so nice that I discarded my junk. $\to +1$. – Claude Leibovici Nov 30 '17 at 4:00
• @TobErnack I think the last identity could also be obtained from an exponential-type Fourier series. – mickep Nov 30 '17 at 6:37

Here is a solution using something akin to the OP's method. We will show that $$\int_0^\infty \frac{x^a-x^{-a}}{x^2-1}dx = \pi \tan\left(\frac{\pi a}{2}\right)$$
From which the OP's integral is immediate. To do so, we will first evaluate the following integral using complex analysis: $$\int_0^\infty \frac{x^a}{x^2-1}dx$$ Given $-1 < \text{Re}(a) < 1$ with $a \neq 0$, we let $\Gamma$ be the following contour.

Note that the integrals on $C_r$ and $C_R$ vanish as $r \to 0^+$ and $R \to \infty$ respectively by standard $ML$ estimates. Due to choosing the logarithm to have a branch cut on the positive real line, the $x^a$ in the numerator affects the integral on the positive real line, giving $$\left(\int_R^{1+r} + \int_{1-r}^r\right)f(z)dz = -e^{2\pi ia}\left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz\tag{1}$$ By similar reasoning, we find that $$\int_{S_r^-}f(z)dz = e^{2\pi ia}\int_{S_r^+}f(z)dz \tag{2}$$ The integral of $f$ over $S_r^+$ will simply be $$\int_{S_r^+}f(z)dz = -\pi i \operatorname{Res}(1) = - \pi i \lim_{z \to 1} \frac{x^a}{x+1} = \frac{\pi i}{2} \tag{3}$$ Finally, by the residue theorem, the integral of $f$ on $\Gamma$ will simply be $2\pi i \sum \text{Res}(f)$, giving $$\int_\Gamma f(z)dz = 2\pi i \operatorname{Res}(-1) = 2 \pi i \lim_{z \to -1}\frac{e^{a\mathcal{L}_0(z)}}{x-1} = -\pi i e^{a \pi i}\tag{4}$$ Thus, by combining $(1), (2), (3),$ and $(4)$ above, we get $$(1-e^{2\pi ia})\left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz + (1+e^{2\pi ia})\int_{S_r^+}f(z)dz = \int_{\Gamma}f(z)dz$$ So that $$\int_0^\infty \frac{x^a}{x^2-1} = \left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz = \frac{\frac{\pi i}{2}(1+e^{2\pi ia})-\pi i e^{a \pi i}}{1-e^{2\pi ia}} = \frac{\pi}{2}\tan\left(\frac{\pi a}{2}\right)$$ Where the last step follows from rearranging the expression into the complex form of $\tan(z)$. Thus we have \begin{align} \int_0^\infty \frac{x^a-x^{-a}}{x^2-1}dx &= \int_0^\infty \frac{x^a}{x^2-1}dx - \int_0^\infty \frac{x^{-a}}{x^2-1}dx \\&=\frac{\pi}{2}\tan\left(\frac{\pi a}{2}\right) - \frac{\pi}{2}\tan\left(\frac{-\pi a}{2}\right) \\&= \pi \tan\left(\frac{\pi a}{2}\right) \end{align} Since $tan(z)$ is an odd function. Thus we immediately get the OP's integral by noting \begin{align} I&=\int_{-\infty}^{\infty} \frac{\sin(x)}{\sinh(x)}dx \\&= \frac{1}{i}\int_{-\infty}^\infty\frac{e^{ix}-e^{-ix}}{e^x-e^{-x}}dx \\&= \frac{1}{i}\int_0^\infty\frac{x^i-x^{-i}}{x^2-1}dx \\&= \frac{\pi}{i} \tan\left(\frac{\pi i}{2}\right) \\&= \pi \tanh\left(\frac{\pi}{2}\right) \\&\text{As claimed.} \tag*{\Box} \end{align}
