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

• You might have some luck with residue calculus, though I haven't tried. Commented Nov 30, 2017 at 3:07
• wolframalpha.com/input/…
– user210229
Commented Nov 30, 2017 at 3:15
• math.stackexchange.com/questions/2529614/… Commented Nov 30, 2017 at 4:40
• While the OP's integral form is a little off at the end, I believe we can say that the integral is $$\Im\int_0^{\infty}\frac{x^i-x^{-i}}{x^2-1}dx$$ Commented Dec 13, 2017 at 8:02

\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? Commented Nov 30, 2017 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). Commented Nov 30, 2017 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$. Commented Nov 30, 2017 at 4:00
• @TobErnack I think the last identity could also be obtained from an exponential-type Fourier series. Commented Nov 30, 2017 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}

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \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{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#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{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ \begin{align} &\bbox[10px,#eef]{% 2\int_{0}^{\infty}{\sin\pars{x} \over \sinh\pars{x}}\,\dd x} = 2\,\Im\int_{0}^{\infty}{\expo{\ic x} - 1 \over \pars{\expo{x} - \expo{-x}}/2}\,\dd x \\[5mm] = &\ 4\,\Im\int_{0}^{\infty}{\expo{-\pars{1 - \ic}x} - \expo{-x} \over 1 - \expo{-2x}}\,\dd x \\[5mm] \,\,\,\stackrel{\large\expo{-2x}\ =\ t}{\large =} & 4\,\Im\int_{1}^{0}{t^{1/2 - \ic/2} - t^{1/2} \over 1 - t}\, \pars{-\,{\dd t \over 2t}} \\[5mm] = &\ 2\,\Im\bracks{\int_{0}^{1}{1 - t^{-1/2} \over 1 - t}\,\dd t - \int_{0}^{1}{1 - t^{-1/2 - \ic/2} \over 1 - t}\,\dd t} \\[5mm] = &\ 2\,\Im\bracks{\Psi\pars{1 \over 2} - \Psi\pars{{1 \over 2} - {\ic \over 2}}} \\[5mm] = & \ -2\,\Im\Psi\pars{{1 \over 2} - {\ic \over 2}} \\[5mm] = &\ -2\,{\Psi\pars{1/2 - \ic/2} - \Psi\pars{1/2 + \ic/2} \over 2\ic} \\[5mm] = & \ \ic\braces{\pi\cot\pars{\pi\bracks{{1 \over 2} + {\ic \over 2}}}} \\[5mm] = &\ -\ic\pi\tan\pars{\pi\ic \over 2} = \bbx{\color{#44f}{\pi\tanh\pars{\pi \over 2}}} \\ & \end{align}

Say that the Fourier transform is defined by $$\begin{equation*} \hat{f}(\xi)=\int_{-\infty}^{\infty}f(x)e^{-i\xi x}\,\mathrm{d}x. \end{equation*}$$ Then \begin{equation*} \begin{aligned} f(x) &= \dfrac{\sin x}{x} \Rightarrow \hat{f}(\xi)=\pi(\mathrm{H}(\xi+1)- \mathrm{H}(\xi-1)), \, \mathrm{H} \text{ Heaviside step function, }\\[2ex] g(x) &= \dfrac{x}{\sinh x} \Rightarrow \hat{g}(\xi)=\dfrac{{\pi}^{2}}{2\cosh^2(\frac{\pi \xi}{2})}. \end{aligned} \end{equation*} Via Plancherel theorem we get $$\begin{gather*} \int_{0}^{\infty}\dfrac{\sin x}{\sinh x} \,\mathrm{d}x =\frac{1}{2}\int_{-\infty}^{\infty}f(x)g(x)\,\mathrm{d}x = \frac{1}{4\pi}\int_{-\infty}^{\infty} \hat{f}(\xi)\hat{g}(\xi)\,\mathrm{d}\xi=\\[2ex] \frac{1}{4\pi}\int_{-1}^{1} \pi\cdot\dfrac{{\pi}^{2}}{2\cosh^2(\frac{\pi \xi}{2})}\,\mathrm{d}\xi = \left[\frac{\pi}{4}\tanh\left(\frac{\pi \xi}{2}\right)\right]_{-1}^{1} = \frac{\pi}{2}\tanh\left(\frac{\pi}{2}\right). \end{gather*}$$

Using the identity $$e^{xi}=\cos x+i\sin x$$ and power series, we get a series. \begin{aligned} \int_0^{\infty} \frac{\sin x}{\sinh (x)} d x = & \operatorname{Im} \int_0^{\infty} \frac{e^{x i}}{\frac{e^x-e^{-x}}{2}} d x \\ = & 2 \operatorname{Im} \int_0^{\infty} \frac{e^{(-1+i) x}}{1-e^{-2 x}} d x \\ = & 2 \operatorname{Im}\left(\sum_{n=0}^{\infty} \int_0^{\infty} e^{(-1+i) x} e^{-2 n x} d x\right) \\ = & 2 \operatorname{Im} \sum_{n=0}^{\infty} \int_0^{\infty} e^{(-1+i-2 n) x} d x \\ = & 2 \operatorname{Im} \sum_{n=0}^{\infty}\left[\frac{e^{-1+i-2 n}}{-1+i-2 n}\right]_0^{\infty} \\ = & 2 \operatorname{Im} \sum_{n=0}^{\infty} \frac{1}{2 n+1-i} \\ =&2 \sum_{n=0}^{\infty} \frac{1}{(2 n+1)^2+1}\end{aligned} Decomposing the denominator of the series yields \begin{aligned} I & =\frac{1}{i} \sum_{n=0}^{\infty}\left(\frac{1}{2 n+1-i}-\frac{1}{2 n+1+i}\right) \\ & =\frac{1}{2 i} \sum_{n=0}^{\infty}\left(\frac{1}{n+\frac{1-i}{2}}+\frac{1}{-n-1+\frac{1-i}{2}}\right) \\ & =\frac{1}{2 i} \sum_{n=-\infty}^{\infty}\left(\frac{1}{n+\frac{1-i}{2}}\right) \\ & =\frac{\pi}{2 i} \cot \left(\frac{\pi(1-i)}{2}\right) \\ & =\frac{\pi}{2 i} \tan \left(\frac{\pi}{2} i\right) \\ & =\frac{\pi}{2} \tanh \left(\frac{\pi}{2}\right) \end{aligned}

$$\int \frac {e^{ix}}{\sinh(x)}\,dx=-(1-i)\, e^{(1+i) x} \, _2F_1\left(\frac{1+i}{2},1;\frac{3+i}{2};e^{2 x}\right)$$ $$\int_\epsilon^\infty \frac {e^{ix}}{\sinh(x)}\,dx=-\frac{2 e^{\pi } \pi \Gamma \left(-\frac{1-i}{2}\right) \Gamma \left(\frac{3+i}{2}\right)}{\left(1+e^{\pi }\right) \Gamma \left(\frac{1+i}{2}\right)^2}-f(\epsilon)$$ $$\int_\epsilon^\infty \frac {e^{ix}}{\sinh(x)}\,dx=\frac{2 i e^{\pi } \pi }{1+e^{\pi }}-f(\epsilon)$$

Expanding as series $$f(\epsilon)=\left(\log (\epsilon )+i \pi +\gamma +\log (2)+\psi \left(\frac{1+i}{2}\right)\right)+i \epsilon +O\left(\epsilon^2\right)$$ Using $$\Im(f(\epsilon ))$$, then $$\int \frac {\sin(x)}{\sinh(x)}\,dx=\frac{2 e^{\pi } \pi }{1+e^{\pi }}-\pi-\Im\left(\psi \left(\frac{1}{2}+\frac{i}{2}\right)\right)=\frac{ \pi}{2} \tanh \left(\frac{\pi }{2}\right)$$