# Evaluating the integral $\int_{-\infty}^\infty \frac {dx}{\cos x + \cosh x}$

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?

-
Is there reason to expect that it has a closed form? –  Daenerys Naharis Feb 6 '13 at 4:18
There are infinitely-many residues in the upper half plane that need to be summed. And I don't think the summation evaluates to anything nice. –  Random Variable Feb 6 '13 at 4:28
In terms of having $\cos x+\cosh x$ in denominator here are somewhat similar and another problem –  Maesumi Feb 6 '13 at 5:25
@Joseph Yes, because it has been posted, albeit in more complicated forms, in two other questions I have read, both of which seem to imply a closed form exist. –  Argon Feb 6 '13 at 22:23

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}

-
Funny, I got something like this, concluded at the time that it wasn't good enough, and have yet to see anything better, including another angle I am trying. (+1) –  Ron Gordon Feb 6 '13 at 11:24
@rlgordonma: It isn't as pretty as a closed form, but $\mathrm{sech}(x)$ decays exponentially, so the sum converges pretty quickly. –  robjohn Feb 6 '13 at 11:30
I agree. Compare this with what I was trying - I did away with exponentials, which in hindsight is looking for trouble unless you strike gold. Still, I posted because maybe someone could tell me why trouble occurs when switching the order of summation and integration - or if I made a major error somewhere. –  Ron Gordon Feb 6 '13 at 11:32
What contour are you integrating over when using the residue theorem? You need to be very careful here, to avoid the poles and choose the contour so that the integral over the ''extra part'' tends to $0$. –  mrf Feb 6 '13 at 16:18
Beat me hands down! :) –  user17762 Feb 6 '13 at 16:41

We have \begin{align} I & = \int_0^{\infty} \dfrac{dx}{\cos(x) + \cosh(x)}\\ & = \int_0^{\infty} \dfrac{\text{sech}(x)dx}{1 + \text{sech}(x)\cos(x)}\\ & = \sum_{k=0}^{\infty} (-1)^k\int_0^{\infty} \text{sech}^{k+1}(x) \cos^k(x) dx \end{align} where \begin{align} \int_0^{\infty} \text{sech}^{k+1}(x) \cos^k(x) dx & = 2^{k+1}\int_0^{\infty} \dfrac{\cos^k(x)}{\left(e^x + e^{-x}\right)^{k+1}} dx \end{align} Now we have $$\int_0^{\infty} \dfrac{\cos^k(x)}{\left(e^x + e^{-x}\right)^{k+1}} dx = \int_0^{\infty} \dfrac{e^{-(k+1)x} \cos^k(x)}{(1+e^{-2x})^{k+1}} dx$$ Further, $$\dfrac1{(1+e^{-2x})^{k+1}} = \sum_{l=0}^{\infty} \dbinom{k+l}{l}(-1)^l e^{-2lx}$$ Hence, $$\int_0^{\infty} \dfrac{e^{-(k+1)x} \cos^k(x)}{(1+e^{-2x})^{k+1}} dx = \sum_{l=0}^{\infty} \dbinom{k+l}{l}(-1)^l \int_0^{\infty} e^{-(2l+k+1)x} \cos^k(x) dx$$ Hence, \begin{align} \int_0^{\infty} e^{-(2l+k+1)x} \cos^k(x) dx & = \int_0^{\infty} e^{-(2l+k+1)x}\left(\dfrac{e^{ix}+e^{-ix}}2 \right)^k dx\\ & = \dfrac1{2^k} \int_0^{\infty} \sum_{m=0}^k \dbinom{k}m e^{-(2l+k+1)x}e^{imx}e^{-i(k-m)x}dx\\ & = \dfrac1{2^k} \int_0^{\infty} \sum_{m=0}^k \dbinom{k}m e^{-(2l+k+1)x}e^{2imx-ikx}dx\\ & = \dfrac1{2^k} \sum_{m=0}^k \dfrac{\dbinom{k}m}{k+2l-2im+ik+1} \end{align} Hence, $$I = 2 \sum_{k=0}^{\infty}(-1)^k \sum_{l=0}^{\infty}(-1)^l \dbinom{k+l}l \left(\sum_{m=0}^k \dfrac{\dbinom{k}m}{k+2l-2im+ik+1} \right)$$ The integral you are after is twice $I$ and hence $$\color{blue}{4 \sum_{k=0}^{\infty}(-1)^k \sum_{l=0}^{\infty}(-1)^l \dbinom{k+l}l \left(\sum_{m=0}^k \dfrac{\dbinom{k}m}{k+2l-2im+ik+1} \right)}$$ You can truncate the two infinite sums (since both are alternating sums) to get arbitrary accuracy.

-
I think that you must warn the reader (mainly the OP) about the validity of the formal manipulations you perform along the answer. To me it seems more difficult to justify them that the result itself. –  Matemáticos Chibchas Feb 6 '13 at 4:38
That looks as nice as a whole, sunny and beautiful friday morning wasted talking to a life-insurance agent...wow! I'm not sure whether that awful-looking triple sum can even be decently approximated, let alone calculated accurately...can it? –  DonAntonio Feb 6 '13 at 5:01
@Marvis: how on earth does the integral have a dependence on $x$ when $x$ is the integration variable? I expect a number. –  Ron Gordon Feb 6 '13 at 9:18
@rlgordonma Typo corrected. –  user17762 Feb 6 '13 at 16:42

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.)

-
Ron, why do you ask whether sum and integral can be switched? Of course they can, summation is associative. –  Peter Halburt Oct 9 '14 at 19:20
@PeterHalburt finite sums and integrals can be switched. Since infinite sums are limits, as are integrals, care must be taken. Sometimes switching the order of limits affects the outcome. –  robjohn May 30 at 1:55