# Do these integrals have a closed form? $I_1 = \int_{-\infty }^{\infty } \frac{\sin (x)}{x \cosh (x)} \, dx$

The following integrals look like they might have a closed form, but Mathematica could not find one. Can they be calculated, perhaps by differentiating under the integral sign?

$$I_1 = \int_{-\infty }^{\infty } \frac{\sin (x)}{x \cosh (x)} \, dx$$ $$I_2 = \int_{-\infty }^{\infty } \frac{\sin ^2(x)}{x \sinh (x)} \, dx$$

First I'm going to evaluate $$\int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx .$$

Integrate the function $\displaystyle f(z) = \frac{e^{iaz}}{\cosh z}$ around a rectangle on the complex plane with vertices at $z= R$, $z= R + i \pi$, $z= -R + i \pi$, and $z= - R$.

As $R \to \infty$, $\displaystyle \int f(z) \ dz$ vanishes on the left and right sides of the rectangle.

So going around the rectangle counterclockwise, we get

$$\int_{-\infty}^{\infty} f(x) \ dx + \int_{\infty}^{-\infty} f(t + i \pi) \ dt = 2 \pi i \ \text{Res} [f(z),i \pi] ,$$

which implies

$$(1+ e^{- a \pi}) \int_{-\infty}^{\infty} \frac{e^{iax}}{\cosh x} \ dx = 2 \pi i \lim_{z \to i \pi /2} \frac{e^{iaz}}{\sinh z} = 2 \pi \ e^{- a \pi /2} .$$

And equating the real parts on both sides of the equation, we get

$$\int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx = \frac{2 \pi}{e^{a \pi /2} + e^{- a \pi/2}} = \pi \ \text{sech} \left( \frac{a \pi}{2}\right) .$$

Then

\begin{align} \int_{0}^{a} \int_{-\infty}^{\infty} \frac{\cos ax}{\cosh x} \ dx \ da &= \int_{-\infty}^{\infty} \int_{0}^{a} \frac{\cos ax}{\cosh x} \ da \ dx \\ &= \int_{-\infty}^{\infty} \frac{\sin ax}{x \cosh x} \ dx \\ &= \pi \int_{0}^{a} \text{sech} \left(\frac{a \pi}{2} \right) \ da \\ &= 2 \int_{0}^{a \pi /2} \text{sech}(u) \ du \\ &= 4 \int_{0}^{a \pi /2} \frac{e^{u}}{1+e^{2u}} \ du \\ &= 4 \int_{1}^{e^{a \pi /2}} \frac{1}{1+w^{2}} \ dw \\ &= 4 \left(\arctan (e^{a \pi /2}) - \frac{\pi}{4} \right) . \end{align}

Therefore,

$$\int_{-\infty}^{\infty} \frac{\sin x}{x \cosh x} \ dx = 4 \arctan (e^{\pi /2}) - \pi \approx 2.3217507819 .$$

• I accepted this answer because it gives a slightly easier derivation, but Graham's method is very nice as well. May 22, 2014 at 12:32
• @user111187 Thanks. May 22, 2014 at 12:38
• I concur, quite elegant. May 22, 2014 at 12:42
• But isn't $$\frac2{e^{a\pi/2}-e^{-a\pi/2}}=\text{csch}\left(\frac{a\pi}2\right)$$? Mar 20, 2016 at 2:11
• @user5713492 Thanks for spotting that. There were 2 typos. Mar 20, 2016 at 5:06

For the first one we need: $$\int _{-1/2}^{1/2}\!{{\rm e}^{2\,iax}}{da}={\frac {\sin \left( x \right) }{x}}\tag{1}$$ $$\frac{1}{\cosh \left( x \right)}=-2\,\sum _{n=1}^{\infty } \left( -1 \right) ^{n}{{\rm e}^{- \left| x \right| \left( 2\,n-1 \right) }}\tag{2}$$ $$\int _{-\infty }^{\infty }\!{{\rm e}^{2\,iax}}{{\rm e}^{- \left| x \right| \left( 2\,n-1 \right) }}{dx}=- \frac{1}{\left( 2\,ia-2\,n+1 \right) }- \frac{1}{\left( -2\,ia-2\,n+1 \right)}\tag{3}$$ $$-2\,\sum _{n=1}^{\infty } \left( -1 \right) ^{n} \left(- \frac{1}{\left( 2\,ia-2\,n+1 \right) }- \frac{1}{\left( -2\,ia-2\,n+1 \right)} \right) ={ \frac {\pi }{\cosh \left( \pi \,a \right) }}\tag{4}$$ we get:

\begin{aligned} \int _{-\infty }^{\infty }\!{\frac {\sin \left( x \right) }{x\cosh \left( x \right) }}{dx}&=\int _{-1/2}^{1/2}\!{\frac {\pi }{\cosh \left( \pi \,a \right) }}{da}\\ &=2\,\arctan \left( { {\rm e}^{1/2\,\pi }} \right)-2\,\arctan \left( {{\rm e}^{-1/2\,\pi }} \right)\\ &=2\,\arctan \left( \sinh \left( \frac{1}{2}\,\pi \right) \right) \end{aligned}\tag{5} where the last part follows from $(2)$ and the Taylor series for arctan: $$\arctan \left( x \right) =\sum _{n=0}^{\infty }{\frac { \left( -1 \right) ^{n}{x}^{2\,n+1}}{2\,n+1}}\tag{6}$$

For the second one we need: $$\frac{1}{\sinh \left( x \right) }=2\,\sum _{n=1}^{\infty } {{\rm e}^{-x \left( 2\,n-1 \right) }}\tag{7}$$ $${\frac { \sin^2 \left( x \right)}{x}}=-\frac{1}{2}\,\sum _{ m=1}^{\infty }{\frac { \left( -1 \right) ^{m}{2}^{2\,m}{x}^{2\,m-1}}{ \left( 2\,m \right) !}}\tag{8}$$ $$\int _{0}^{\infty }\!{x}^{2\,m-1}{{\rm e}^{-x \left( 2\,n-1 \right) }} {dx}={\frac { \left( 2\,m-1 \right) !}{ \left( 2\,n-1 \right) ^{2\,m}} }\tag{9}$$ $$\cot \left( z \right) -\frac{1}{z}=-\frac{2}{\pi}\,\sum _{m=1}^{\infty }\zeta \left( 2\,m \right) \left( {\frac {z}{\pi }} \right) ^{2\,m-1}\tag{10}$$ From $(6,7,8)$: \begin{aligned} \int _{0}^{\infty }\!{\frac { \sin^2 \left( x \right)}{x\sinh \left( x \right) }}{dx}&=-\frac{1}{2}\,\sum _{m=1}^{\infty } \left( \frac{\left( -4 \right) ^{m}}{m}\sum _{n=1}^{\infty }{\frac {1}{\left( 2\,n-1 \right) ^{2\,m}}} \right)\\ &=\frac{1}{4}\sum _{m=1}^{\infty }\,{\frac {\zeta \left( 2\,m \right) \left( {4}^{m}-1 \right) \left( -1 \right) ^{m}}{m}} \end{aligned}\tag{11} and after integrating $(10)$ once we know that: $$\ln \left( {\frac {\sin \left( z \right) }{z}} \right) =-\sum _{m=1}^ {\infty }\frac{\zeta \left( 2\,m \right)}{m} \left( {\frac {z}{\pi }} \right) ^{2\,m}\tag{12}$$ so by comparing $(11)$ with $(12)$ we know that: \begin{aligned}\int _{0}^{\infty }\!{\frac { \sin^2 \left( x \right) }{x\sinh \left( x \right) }}{dx}&=\frac{1}{2}\,\ln\!\left( \frac{1}{2}\,{\frac {\sinh \left( 2\,\pi \right) }{\sinh \left( \pi \right) }} \right)\\ &=\frac{1}{2}\,\ln \left( \cosh \left( \pi \right) \right) \end{aligned}

• I thought maybe my answer was wrong. But it seems to be numerically the same. Nice answer, BTW. +1 May 21, 2014 at 21:02
• Yeah I get your answer if I use symmetry in the final integration to integrate over $+a$ only. Yours is nice too +1 :) May 21, 2014 at 21:06
• Nice evaluation of the second integral as well. May 21, 2014 at 22:55

For $I_2$, we can use a well-known result: $$\int_{-\infty }^{\infty } \frac{\sinh (ax)}{\sinh(bx)}dx=\frac{\pi}{b}\tan\frac{a\pi}{2b}.$$ Note $\sinh(ix)=\sin(x), \tanh(ix)=\tan(x)$. Thus $$\int_{-\infty }^{\infty } \frac{\sin (ax)}{\sinh(bx)}dx=\int_{-\infty }^{\infty } \frac{\sinh (iax)}{\sinh(bx)}dx=\frac{\pi}{b}\tanh\frac{a\pi}{2b}.$$ For $I_2$, define $$I_2(a)=\int_{-\infty }^{\infty } \frac{\sin^2(ax)}{x\sinh (x)}dx.$$ Then $I_2(0)=0$ and $I_2(1)=I_2$. Now \begin{eqnarray} I_2'(a)&=&\int_{-\infty }^{\infty } \frac{2\sin(ax)\cos(ax)}{\sinh (x)}dx\\ &=&\int_{-\infty }^{\infty } \frac{\sin(2ax)}{\sinh (x)}dx\\ &=&\pi\tanh(a\pi). \end{eqnarray} So $$I_2(1)=\int_0^1\pi\tan(a\pi)da=\ln(\cosh(a\pi)).$$

$\newcommand{\+}{^{\dagger}} \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{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$

1. $\ds{\large\color{#000}{\tt I_{1}\equiv \int_{-\infty }^{\infty }{\sin\pars{x} \over x\cosh\pars{x}} \,\dd x}}$
\begin{align}I_{1}&\equiv\color{#c00000}{ \int_{-\infty }^{\infty }{\sin\pars{x} \over x\cosh\pars{x}} \,\dd x} =\int_{-\infty }^{\infty } {2\expo{x} \over \expo{2x} + 1}\int_{0}^{1}\cos\pars{kx}\,\dd k\,\dd x \\[3mm]&=2\Re\int_{0}^{1}\ \overbrace{\int_{-\infty}^{\infty} {\pars{\expo{x}}^{\verts{k}\ic} \over \expo{2x} + 1}\,\expo{x}\,\dd x} ^{\ds{\mbox{Set}\ \expo{x} \equiv t}}\ \,\dd k =2\int_{0}^{1}\color{#00f}{% \Re\int_{0}^{\infty}{t^{\verts{k}\ic} \over t^{2} + 1}\,\dd x}\,\dd k\tag{1} \end{align}
\begin{align}&\color{#00f}{% \Re\int_{0}^{\infty}{t^{\verts{k}\ic} \over t^{2} + 1}\,\dd x} =\Re\bracks{2\pi\ic\,{\pars{\expo{\pi\ic/2}}^{\verts{k}\ic} \over 2\ic} + 2\pi\ic\,{\pars{\expo{3\pi\ic/2}}^{\verts{k}\ic} \over -2\ic} -\int_{\infty}^{0} {t^{\verts{k}\ic}\pars{\expo{2\pi\ic}}^{\verts{k}\ic} \over t^{2} + 1}\,\dd t} \\[3mm]&=\pi\expo{-\pi\verts{k}/2} -\pi\expo{-3\pi\verts{k}/2} +\expo{-2\pi\verts{k}}\color{#00f}{% \Re\int_{0}^{\infty}{t^{\verts{k}\ic} \over t^{2} + 1}\,\dd x} \\[5mm]&\imp\ \color{#00f}{% \Re\int_{0}^{\infty}{t^{\verts{k}\ic} \over t^{2} + 1}\,\dd x} ={\pi\expo{-\pi\verts{k}/2} -\pi\expo{-3\pi\verts{k}/2} \over 1 - \expo{-2\pi\verts{k}}} =\pi\,{\expo{\pi\verts{k}/2} -\expo{-\pi\verts{k}/2} \over \expo{\pi\verts{k}} - \expo{-\pi\verts{k}}} \\[3mm]&=\pi\,{\sinh\pars{\pi\verts{k}/2} \over \sinh\pars{\pi\verts{k}}} ={\pi \over 2}\,\sech\pars{{\pi \over 2}\,k} \end{align}
Replacing in $\pars{1}$: \begin{align} &\color{#66f}{\large\int_{-\infty }^{\infty }{\sin\pars{x} \over x\cosh\pars{x}} \,\dd x} =2\int_{0}^{1}{\pi \over 2}\,\sech\pars{{\pi \over 2}\,k}\,\dd k =\left. 4\arctan\pars{\tanh\pars{{\pi \over 4}\,k}}\right\vert_{0}^{1} \\[3mm]&=\color{#66f}{\large 4\arctan\pars{\tanh\pars{\pi \over 4}}} \approx {\tt 2.3218} \end{align} This result can be expressed in terms of the Gudermannian Function $\ds{{\rm gd}\pars{z} \equiv 2\arctan\pars{\expo{z}} - {\pi \over 2}}\quad$ as $\quad\ds{4\arctan\pars{\tanh\pars{\pi \over 4}} = 2\,{\rm gd}\pars{\pi \over 2}}$.
2. $\ds{\large\color{#000}{\tt I_{2}\equiv \int_{-\infty }^{\infty }{\sin^{2}\pars{x} \over x\sinh\pars{x}} \,\dd x}}$
$\tt\mbox{It can be evaluated by following a similar technique}$.

I do not know of a closed form but it seems that the integral can be converted into an infinite series. Let $$I_{1}(k)=\int_{-\infty }^{+\infty }dx\frac{\sin kx}{x\cosh x}$$ so $I_{1}=I_{1}(1).$ Now (note that $I_{1}(0)$ vanishes) \begin{eqnarray*} \partial _{k}I_{1}(k) &=&\int_{-\infty }^{+\infty }dx\frac{\cos kx}{\cosh x}=% {Re}\int_{-\infty }^{+\infty }dx\frac{\exp [ikx]}{\cosh x}\\&=&2{Re}% \int_{-\infty }^{+\infty }dx\exp [ikx]\frac{1}{\exp [x]+\exp [-x]} \\ I_{1} &=&\int_{0}^{1}dk\partial _{k}I_{1}(k) \end{eqnarray*} If this Fourier transform is known we can try to integrate over $k$ and obtain $I_{1}(k)$ and hence $I_{1}$. If not we note that $(\exp [z]+\exp [-z])^{-1}$ has poles $z_{n}=i\pi (1+2n)$ so closing the contour in the upper half plane results in $$\int_{-\infty }^{+\infty }dx\exp [ikx]\frac{1}{\exp [x]+\exp [-x]}=2\pi i\sum_{n}r_{n}\exp [ikz_{n}]$$ where the $r_{n}$ are the residues and the sum over $n$ is that with $z_{n}$ in the upper half plane. Now the $k$-integral can be done and we end up with a sum over $n$.