# Alternative (contour preferred) method to evaluate $\int_{0}^{\infty}\frac{dz}{\cosh z + \cos \theta}$

We know the indefinite integral with $d$ being the differential operator (e.g., by substitution $t=e^z$ and partial fraction) $$\frac{dz}{\cosh z+\cos\theta}=-\frac i{\sin\theta}d\ln\frac{e^z+e^{i\theta}}{e^z+e^{-i\theta}}.$$ Can we find a nice contour in the complex plane and using the Cauchy residue theorem to directly show its definite form? $$\int_0^\infty\frac{dz}{\cosh z+\cos\theta}=\frac{\theta}{\sin\theta}$$ Other methods are welcome too.

The upper (neither the lower) hemispherical contour does not work because the segment integral close to the imaginary axis at infinity does not vanish.

• Maybe you can simplify things noticing that the function is even.
– N74
Sep 23, 2016 at 21:37
• @N74: That is exactly what the last paragraph is referring to. Otherwise what is the hemisphere doing there?
– Hans
Sep 23, 2016 at 21:46
• It's not exactly a direct approach, but the somewhat classical integral $$\int_{0}^{\infty} \frac{\cos ax}{\cosh x + \cos \theta} \, dx = \frac{\pi}{\sin \theta} \frac{\sinh a \theta}{\sinh a \pi}, \ (a>0, \, 0 < \theta < \pi) ,$$ can be evaluated by integrating $\frac{e^{iaz}}{\cosh z + \cos \theta}$ around a rectangular contour in the upper half-plane of height $2 \pi i$. Then you could let $a \to 0^{+}$. Sep 23, 2016 at 22:45
• @RandomVariable: Very clever trick with $\cos ax$ or $e^{iaz}$ suppressing the magnitude of the integrand for the contour segment parallel to the real axis and exploiting the periodicity of $\cosh x$ along the imaginary axis! Thank you. If you care to write out the details of your answer for posterity, I will accept it.
– Hans
Sep 24, 2016 at 1:14

A more direct approach than the one I mentioned in the comments is to integrate $$f(z) = \frac{z}{\cosh z + \cos \theta} \, , \quad 0 < \theta < \pi,$$ around a rectangle in the upper half-plane of height $2 \pi i$.
Doing so, we get \begin{align} \int_{-\infty}^{\infty} \frac{x}{\cosh x + \cos \theta} \, dx - \int_{-\infty}^{\infty} \frac{x+ 2 \pi i }{\cosh x + \cos \theta} \, dx &= 2 \pi i \Big( \text{Res}\left[f(z), i(\pi - \theta)\right] + \text{Res}\left[f(z), i(\pi + \theta \right)]\Big) \\ &= 2 \pi i \left(\frac{i(\pi - \theta)}{\sinh(i(\pi -\theta)) }+ \frac{i(\pi + \theta)}{\sinh(i(\pi + \theta))}\right) \\ &=2 \pi i \left(\frac{\pi - \theta}{ \sin \theta }- \frac{\pi + \theta}{ \sin \theta}\right)\\ &= - 4 \pi i \, \frac{\theta}{\sin \theta}. \end{align}
(The integrals along the sides of the rectangle vanish in the limit since $|\cosh z|$ grows exponentially as $\text{Re}(z) \to \pm \infty$.)
Therefore, $$2 \pi i \int_{-\infty}^{\infty} \frac{1}{\cosh x + \cos \theta} \, dx = 4 \pi i \, \frac{\theta}{\sin \theta} \, ,$$ and the result follows since the integrand is even.