TITLE: Evaluating the integral $\int_{-\infty}^\infty \frac {dx}{\cos x + \cosh x}$
QUESTION [31 upvotes]: 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?

REPLY [21 votes]: 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}
$$

REPLY [2 votes]: OK, this is an especially tough integral.  Mathematica gives nothing analytical, nor could I find a form in Gradshteyn & Rhyzik that covered this integral.  That said, it is still worth looking into what can be done, and I think I have some sort of an advance over what I've seen so far.
Write the integral as
$$I = 4 \int_0^{\infty} dx \: \frac{e^{-x}}{1+2 e^{-x} \cos{x} + e^{-2 x}} $$
Substitute $y=e^{-x}$, $dy=-y dx$, $x=-\log{y}$ and get
$$I = 4 \int_0^1 \frac{dy}{1+2 y \cos{(\log{y})} + y^2}$$
This is still a tough integral, but maybe some of you recognize that the integrand is a generating function for the Chebyshev polynomial of the second kind $U_n(x)$.  That is, we may write
$$\frac{1}{1+2 y \cos{(\log{y})} + y^2} = \sum_{n=0}^{\infty} U_n(\cos{(\log{y})}) y^n$$
Now we have
$$I = 4 \int_0^1 dy \: \sum_{n=0}^{\infty}  y^n U_n(\cos{(\log{y})}) $$
I am not yet convinced that the order of summation and integration may be reversed.  (Upon doing so, the resulting series diverges as far as I can see, which is too bad because the results were coming out nice.)