Evaluate the following: $\int_{0}^{\infty}\frac{\sin(ax)}{\sinh(x)}dx$ and $\int_{0}^{\infty}\frac{x\cos(ax)}{\sinh(x)}dx$ using rectangular contour

A problem I'm currently working on asks to evaluate the following integrals:

$\int_{0}^{\infty}\frac{\sin(ax)}{\sinh(x)}dx\;$ and $\ \int_{0}^{\infty}\frac{x\cos(ax)}{\sinh(x)}dx$

I've seen previous questions around here that show how to do the evaluation via contour integration (Evaluating $\int_{0}^{\infty}\frac{\sin(ax)}{\sinh(x)}dx$ with a rectangular contour and show that $\int_{0}^{\infty}\frac{x\cos ax}{\sinh x}dx=\frac{\pi^2}{4} \operatorname{sech}^2 \left(\frac{a\pi}{2}\right)$) but this particular problem requires that I use the following contour:

I tried applying the previous two methods using this contour, but the final answer I end up with keeps ending up as a completely different form and I am unable to prove that the answer I got is exactly the same as the answers using the different methods linked above.

Any help would be greatly appreciated

• What you need is here math.stackexchange.com/questions/1550932/… as the user Thijs answered. Commented Nov 10, 2017 at 20:26
• The problem is that the contour used by Thjis only goes up to $R + i\pi$ in the imaginary axis. This problem specifically requires the use of a contour that goes up to $R + i2\pi$ in the imaginary axis, which when I used Thjis's method resulted in a completely different answer Commented Nov 11, 2017 at 0:16

For any $n\in\mathbb{N}^+$ and $a>0$ we have $\int_{0}^{+\infty}\sin(ax)e^{-nx}\,dx = \frac{a}{a^2+n^2}$ by integration by parts or by writing $\sin(ax)$ as $\operatorname{Im}\exp(iax)$. By expanding $\frac{1}{\sinh x}=\frac{2e^{-x}}{1-e^{-2x}}$ as a geometric series in $e^{-x}$ we get
$$\int_{0}^{+\infty}\frac{\sin(ax)}{\sinh x}\,dx = 2a\sum_{n\geq 0}\frac{1}{a^2+(2n+1)^2}.$$ On the other hand, by applying $\frac{d}{dx}\log(\cdot)$ to both sides of $$\cosh\left(\frac{\pi x}{2}\right)=\prod_{n\geq 0}\left(1+\frac{x^2}{(2n+1)^2}\right)$$ (Weierstrass product for the hyperbolic cosine function) we get: $$\frac{\pi}{2}\,\tanh\left(\frac{\pi x}{2}\right)= 2x\sum_{n\geq 0}\frac{1}{x^2+(2n+1)^2}$$ so: $$\boxed{\forall a\in\mathbb{R},\qquad \int_{0}^{+\infty}\frac{\sin(ax)}{\sinh x}\,dx =\frac{\pi}{2}\,\tanh\left(\frac{\pi a}{2}\right).}\tag{1}$$ In a similar way, from $$\int_{0}^{+\infty} x\cos(ax)e^{-nx}\,dx = \frac{n^2-a^2}{(n^2+a^2)^2}$$ by applying $\frac{d^2}{dx^2}\log(\cdot)$ to both sides of the previous Weierstrass product we get: $$\boxed{\forall a\in\mathbb{R},\qquad \int_{0}^{+\infty}\frac{x\cos(ax)}{\sinh(x)}\,dx = \frac{\pi^2}{4}\,\operatorname{sech}\left(\frac{\pi a}{2}\right)^2.}\tag{2}$$ You do not really need contour integration, it is already "encoded" in the mentioned Weierstrass product. See also the Herglotz trick.
• Thanks for the answer, but I'm afraid I don't understand the first part, where you find that $\int_{0}^{+\infty}\frac{sin(ax)}{sinhx}dx = 2a\sum_{n \geq 0}\frac{1}{a^2+(2n+1)^2}$ I was able to get the geometric series representation of $\frac{1}{sinhx}$, but where do I go forward from there? Commented Nov 11, 2017 at 11:40
• @D.Ashton: in a explicit way, $$\int_{0}^{+\infty}\frac{\sin(ax)}{\sinh(x)}\,dx = \int_{0}^{+\infty}2\sin(ax)e^{-x}\sum_{m\geq 0}e^{-2mx}\,dx\\ = 2\sum_{m\geq 0}\int_{0}^{+\infty}\sin(ax)e^{-(2m+1)x}\,dx = 2a\sum_{m\geq 0}\frac{1}{a^2+(2m+1)^2}.$$ Commented Nov 11, 2017 at 12:55
$$\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{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\sr}[2]{\,\,\,\stackrel{{#1}}{{#2}}\,\,\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ \begin{align} & \color{#44f}{\int_{0}^{\infty}{\sin\pars{ax} \over \sinh\pars{x}} \,\dd x} = \int_{0}^{\infty}{\pars{\expo{\ic ax} - \expo{-\ic ax}}/\pars{2\ic} \over \pars{\expo{x} - \expo{-x}}/2}\,\dd x = -\ic\int_{0}^{\infty}{\expo{-\pars{1 - \ic a}x} - \expo{-\pars{1 + \ic a}x} \over 1 - \expo{-2x}}\,\dd x \\[5mm] = & \ -\,{\ic \over 2}\int_{0}^{\infty}{\expo{-\pars{1/2\ -\ \ic a/2}x}\,\, - \expo{-\pars{1/2\ +\ \ic a/2}x}\,\,\, \over 1 - \expo{-x}}\,\dd x \\[5mm] = & \ {\ic \over 2}\bracks{\int_{0}^{\infty}{\expo{-x} - \expo{-\pars{1/2\ -\ \ic a/2}x}\,\, \over 1 - \expo{-x}}\,\dd x - \int_{0}^{\infty}{\expo{-x} - \expo{-\pars{1/2\ +\ \ic a/2}x}\,\, \over 1 - \expo{-x}}\,\dd x}\hspace{2cm}\color{red}{\LARGE\S} \\[5mm] = & \ {\ic \over 2}\bracks{\Psi\pars{{1 \over 2} - {a \over 2}\ic} - \Psi\pars{{1 \over 2} + {a \over 2}\ic}} = {\ic \over 2}\pi\cot\pars{\pi\bracks{{1 \over 2} + {a \over 2}\ic}} \\[5mm] = & \ {\ic \over 2}\pi\bracks{-\ic \tanh\pars{\pi a \over 2}} = \bbx{\color{#44f}{{\pi \over 2}\tanh\pars{\pi a \over 2}}} \\[5mm] & \mbox{Note that}\quad \totald{\bracks{\pi\tanh\pars{\pi a/2}/2}}{a} = {\pi^{2} \over 4}\on{sech}^{2}\pars{\pi a \over 2} \\ & \end{align} $$\ds{\color{red}{\LARGE\S}}$$: See $$\ds{{\bf 6.3.22}}$$ in A & S.
For $$I=\int_0^{\infty}\frac{\sin ax}{\sinh x}dx$$ and OP's contour above:
The integral on the semi-circle about zero is zero because the residue is zero there, but on the semi-circle about $$2\pi i$$, the integral is not zero but equal to $$-\frac12(2\pi i\,Res_{z=2\pi i}\frac{\sin az}{\sinh z})=-\pi i\sin 2\pi ai$$. On the vertical edges the integral tends to zero. Hence, in the limit, $$2(1-\cos 2\pi ai)I-\pi i\sin 2\pi ai=2\pi iRes_{z=\pi i}\frac{\sin az}{\sinh z}=-2\pi i\sin\pi ai$$ and hence $$I=\frac{\pi i\sin 2\pi ai-2\pi i\sin\pi ai}{2(1-\cos 2\pi ai)}=\frac{2\pi i\sin\pi a i(\cos\pi ai-1)}{4\sin^2\pi ai}=-\frac{\pi i}{2}\tan\frac{\pi ai}{2}=\frac\pi2\tanh\frac{\pi a}{2}.$$