Evaluating the Integral of 1/(cos x + cosh x) from -? to ?

contour-integrationdefinite integralsimproper-integralsintegration

Many recent questions have been asked here similar to this integral

$$\int_{-\infty}^\infty \frac {dx}{\cos x + \cosh x} = 2.39587\dots$$

whose "closed form" I cannot seem to figure out. I have tried contour integration, but the sum of the residues got rather nasty.

Can someone perhaps evaluate this integral?

Best Answer

Simple computation yields $$ \cos(z)+\cosh(z)=2\cos(\alpha z)\cosh(\alpha z)\tag{1} $$ where $\alpha=\frac{1+i}{2}$. The zeros of $\cos(z)+\cosh(z)$ are at $$ z_k^\pm=\left(k\pi+\frac\pi2\right)(1\pm i)\tag{2} $$ and $$ \operatorname*{Res}_{\ \ z=z_k^\pm}\frac1{\cos(z)+\cosh(z)} =\frac{1\pm i}{2}(-1)^{k+1}\mathrm{sech}\left(k\pi+\frac\pi2\right)\tag{3} $$ The residues in the upper half-plane are $z_k^+$ where $k\ge0$ and $z_k^-$ where $k\lt0$. Pairing the residues at $z_k^+$ and $z_{-k-1}^-$ yields the sum of the residues in the upper half-plane to be $$ -i\sum_{k=0}^\infty(-1)^k\mathrm{sech}\left(k\pi+\frac\pi2\right)\tag{4} $$ Therefore, we can use contour integration to get $$ \begin{align} \int_{-\infty}^\infty\frac{\mathrm{d}x}{\cos(x)+\cosh(x)} &=2\pi\sum_{k=0}^\infty(-1)^k\mathrm{sech}\left(k\pi+\frac\pi2\right)\\[6pt] &\doteq2.3958786339145620925\tag{5} \end{align} $$