Evaluating $\int_{0}^{\infty}\frac{\sin(ax)}{\sinh(x)}dx$ with a rectangular contour

I need to try to evaluate $\int_{0}^{\infty}\frac{\sin(ax)}{\sinh(x)}dx$ and it seems like this is supposed to be done using some sort of rectangular contour based on looking at other questions.

My main issue is that I am unsure how this kind of contour works in general. For example:

  • How high or low should I have the rectangle contour?
  • Should the contour be centered on the real axis or should it actually be shifted up or down or does it depend?
  • When you make bumps on the contour about the singularities, do you make the bumps as to include the singularities inside of the domain or should they be outside of the domain?

I ask the last question based on this question "tough integral involving $\sin(x^2)$ and $\sinh^2 (x)$" here in which robjohn had his contour surround the singularity at $i$ yet did not surround the singularity at $-i$, so I was wondering if this choice matters and why not include or exclude both singularities using the contour.

For this, though, I believe I need to use the singularities at $0$ and $i\pi$, but I suppose I could have the rectangle between any two consecutive singularities on the imaginary axis, correct?

Either way, any insight on this would be appreciated.

Edit: There is no information given on a. I assume it is an arbitrary complex parameter.


To answer your third question, you can do whatever you want, which we will see later. Because we want to evaluate the integral over the real axis, we will include $\mathbb{R}$ (except $z=0$) in the contour. For this integral, this is possible, maybe not in other integrals. Because $\sinh(z)=0$ for all integer multiples of $i\pi$, this gives infinitely many singularities. We don't want this, so the idea is to only include $z=0$ and $z=\pi i$ in the contour.

Note that $$\sin(a(z+i\pi))=\sin(az+ai\pi)=\sin(az)\cos(ai\pi)+\cos(az)\sin(ai\pi)$$ and $$\sinh(z+i\pi)=-\sinh(z).$$ These facts suggest including $i\pi+\mathbb{R}$ in the integral. Note that $\frac{\sin(az)}{\sinh(z)}$ is an even function, so we can integrate over $\mathbb{R}$ instead of from $0$ to $\infty$. From this follows the rectangular contour ($R\rightarrow\infty$ and $\varepsilon\rightarrow0$):

  1. A line from $-R$ to $-\varepsilon$
  2. A semicircle of radius $\varepsilon$ around $z=0$, choose it to include $z=0$
  3. A line from $\varepsilon$ to $R$
  4. A line from $R$ to $R+i\pi$
  5. A line from $R+i\pi$ to $\varepsilon+i\pi$
  6. A semicircle of radius $\varepsilon$ around $z=i\pi$, choose it to include $z=i\pi$
  7. A line from $-\varepsilon+i\pi$ to $-R+i\pi$
  8. A line from $-R+i\pi$ to $-R$.

We know that $\int_1=\int_3$, because $\frac{\sin(az)}{\sinh(z)}$ is an even function. We also know that $\int_5=\int_7=\cos(ai\pi)\int_1$, because $$\int_{-\infty}^\infty\frac{\sin(az)\cos(ai\pi)+\cos(az)\sin(ai\pi)}{\sinh(z)}dz=\int_{-\infty}^\infty\frac{\sin(az)\cos(ai\pi)}{\sinh(z)}dz$$ and $\frac{\cos(az)}{\sinh(z)}$ is an odd function. Here the minus signs from $\sinh(z+i\pi)=-\sinh(z)$ and the opposite direction cancel each other. Note that we have to say something about convergence. We also have that $\int_4=\int_8=0$, where we again have to say something about convergence.

Now we calculate residues: around $z=0$ we have $\frac{\sin(az)}{\sinh(z)}\rightarrow0$ and around $z=i\pi$ we have $$\frac{\sin(az)}{\sinh(z)}=\frac{\sin(az)\cos(ai\pi)+\cos(az)\sin(ai\pi)}{-\sinh(z)}\overset{z\rightarrow0}{\rightarrow}-\frac{\sin(ai\pi)}{\sinh(z)},$$ which gives $-\sin(ai\pi)$ as residue.

Note that $\int_6=-2\pi i\frac{1}{2}\sin(ai\pi)$, (there is a theorem about poles of order 1 and half circles around it) and $\int_2=0$. From this follows that $$2(1+\cos(ai\pi))\int_0^\infty\frac{\sin(az)}{\sinh(z)}dz-\pi i\sin(ai\pi)=-2\pi i\sin(ai\pi),$$ which gives also the answer to your third question. If we don't include $z=i\pi$, this gives $$2(1+\cos(ai\pi))\int_0^\infty\frac{\sin(az)}{\sinh(z)}dz+\pi i \sin(ai\pi)=0,$$ because the halfcircle around $z=i\pi$ is traversed clockwise, instead of counterclockwise.

Finally, the answer is $$\int_0^\infty\frac{\sin(az)}{\sinh(z)}dz=-\pi i\frac{\sin(ai\pi)}{2+2\cos(ai\pi)}=\frac{\pi}{2}\tanh(\frac{\pi a}{2}).$$