# Evaluate the integral of function involving $\cosh$

Evaluate the integral $$\int_0^{\infty} \frac{\cosh(ax)}{\cosh(x)}\,dx,$$ where $|a|<1$.

Consider the closed loop integral of $\displaystyle\frac{e^{az}}{\cosh(z)}$ where the contour $C$ is $y=0, y=\pi, x=-R$, and $x=R$.

So far I have found that $$\displaystyle\int_C \frac{e^{az}}{\cosh(z)}\,dz=2\pi e^{\frac{\pi i a}{2}}$$ by the residue theorem. Not sure how to compare this to the first part where we are integrating from $0$ to infinity.

• Hint: Use Jordan's lemma and the even-ness of cosh. – Batman Nov 28 '15 at 2:34
• I could write an entire novel as an answer to this question. – Lucian Nov 28 '15 at 6:01

I give to you a different approach, not using residue calculus. In case you only wanted a solution using complex analysis, tell me and I will delete my answer.

We write \begin{aligned} \frac{\cosh ax}{\cosh x}&=\frac{e^{(a-1)x}+e^{(-(a+1)x}}{1+e^{-2x}}\\ &=\sum_{k=0}^{+\infty}(-1)^k\bigl(e^{(a-1-2k)x}+e^{-(a+1+2k)x}\bigr) \end{aligned} and then integrate term-wise, to find that $$\int_0^{+\infty}\frac{\cosh ax}{\cosh x}\,dx=\sum_{k=0}^{+\infty}(-1)^k\Bigl(\frac{1}{1-a+2k}+\frac{1}{1+a+2k}\Bigr).$$ Now, as it happens there is a nice series expansion of the secant function looking very much like this (see for example the series expansion here), $$\sec z=2\sum_{k=0}^{+\infty}(-1)^k\Bigl(\frac{1}{\pi-2z+2k\pi}+\frac{1}{\pi+2z+2k\pi}\Bigr).$$ In particular, with $z=a\pi/2$, $$\sec\Bigl(\frac{a\pi}{2}\Bigr)=\frac{2}{\pi}\sum_{k=0}^{+\infty}(-1)^k\Bigl(\frac{1}{1+-a+2k}+\frac{1}{1+a+2k}\Bigr).$$

Hence $$\int_0^{+\infty}\frac{\cosh ax}{\cosh x}\,dx=\frac{\pi}{2}\sec\Bigl(\frac{a\pi}{2}\Bigr).$$

Since $$\cosh(z)=0\iff e^z=-e^{-z}\iff e^{2z}=-1\iff z=\left(k+\tfrac12\right)\pi i,k\in\mathbb{Z}$$ the singularities of $\frac{\cosh(az)}{\cosh(z)}$ are at $z=\left(k+\tfrac12\right)\pi i$ for $k\in\mathbb{Z}$.

The residue of $\frac1{\cosh(z)}$ at $z=\left(k+\tfrac12\right)\pi i$ is $$\frac1{\sinh\left(\left(k+\tfrac12\right)\pi i\right)} =\frac{-i}{\sin\left(\left(k+\tfrac12\right)\pi\right)}=(-1)^{k+1}i$$ Therefore, the residue of $\frac{\cosh(az)}{\cosh(z)}e^{i\delta z}$ at this point is $(-1)^{k+1}i\cos\left(a\left(k+\frac12\right)\pi\right)e^{-\delta\left(k+\frac12\right)\pi}$.

Since $\frac{\cosh(az)}{\cosh(z)}e^{i\delta z}$ vanishes exponentially in the upper halfplane as $\left|z\right|\to\infty$, its integral over $\mathbb{R}$ is $2\pi i$ times the sum of the residues in the upper halfplane. \begin{align} \int_{-\infty}^\infty\frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x &=\lim_{\delta\to0}\int_{-\infty}^\infty\frac{\cosh(ax)}{\cosh(x)}e^{i\delta x}\,\mathrm{d}x\\ &=2\pi\lim_{\delta\to0}\sum_{k=0}^\infty(-1)^k\cos\!\left(a\left(k+\tfrac12\right)\pi\right)e^{-\delta\left(k+\frac12\right)\pi}\\ &=2\pi\lim_{\delta\to0}\operatorname{Re}\left(\sum_{k=0}^\infty(-1)^ke^{(ia-\delta)\left(k+\frac12\right)\pi}\right)\\ &=2\pi\lim_{\delta\to0}\operatorname{Re}\left(e^{(ia-\delta)\pi/2}\sum_{k=0}^\infty(-1)^ke^{(ia-\delta)k\pi}\right)\\ &=2\pi\lim_{\delta\to0}\operatorname{Re}\left(\frac{e^{(ia-\delta)\pi/2}}{1+e^{(ia-\delta)\pi}}\right)\\ &=2\pi\operatorname{Re}\left(\frac{e^{ia\pi/2}}{1+e^{ia\pi}}\right)\\[6pt] &=\pi\sec\left(\frac{a\pi}2\right) \end{align} Therefore, since the integrand is even, $$\int_0^\infty\frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x=\frac\pi2\sec\left(\frac{a\pi}2\right)$$

• $\frac{\cosh(az)}{\cosh(z)}\sim e^{(a-1)|x|}$ for large $|x|$ and $e^{i\delta z}\sim e^{-\delta y}$ for large $y$ – robjohn Nov 28 '15 at 23:04
• I just got an upvote on this answer. I guess I have answered this question before. At least the method used was different. – robjohn Nov 30 '15 at 14:20

We consider the integral of analytic function $$F(z)=\frac{\cosh(az)}{\cosh(z)}$$ on the rectangle contour of $C=C_1\cup C_2\cup C_3\cup C_4$, which are $y=0, \:x=R,\:y=\pi,\:x=-R$ respectively. By Cauchy's residue theorem, we have $$\int_{-R}^RF(x)dx+\int_{C_2}F(z)dz+\int_{C_3}F(z)dz+\int_{C_4}F(z)dz=2\pi iRes\left(F,\frac{\pi i}{2}\right)\tag1$$ Note that only pole in the contour is $z=\frac{\pi i}{2}$. Since $$Res\left(F,\frac{\pi i}{2}\right)=\lim_{z\to \frac{\pi i}{2}}(z-\frac{\pi i}{2})F(z)=\lim_{z\to \frac{\pi i}{2}}\frac{\cosh(az)}{\sinh(z)}=- i\cos \frac{\pi a}{2}\tag2$$ Moreover \begin{align} \int_{C_3}F(z)dz&=\int_R^{-R}\frac{\cosh(a(x+\pi i))}{\cosh(x+\pi i)}\:dx \\ &=\int_{-R}^{R}\frac{\cosh(ax)\cosh(a\pi i)+\sinh(ax)\sinh(a\pi i)}{\cosh(x)}\:dx \\ &=\cosh(a\pi i)\int_{-R}^{R}\frac{\cosh(ax)}{\cosh(x)}\:dx\tag{*} \end{align} (*): Since $\frac{\sinh(ax)}{\cosh(x)}$ is odd $$\int_{-R}^{R}\frac{\sinh(ax)}{\cosh(x)}\:dx=0$$ Also since $|a|<1$ $$\left|\int_{C_2}F(z)dz\right|=\left|\int_{0}^{\pi}\frac{e^{a(R+iy )}+e^{-a(R+iy )}}{e^{R+iy}+e^{-(R+iy )}}idy\right|\leqslant \frac{2\pi e^{|a| R}}{e^{R}-e^{-R}}=\frac{2\pi e^{(|a|-1) R}}{1-e^{-2R}}\to0\tag3$$ as $R\to\infty$.

Along with $$\left|\int_{C_4}F(z)dz\right|=\left|\int_{\pi}^{0}\frac{e^{a(-R+iy )}+e^{-a(-R+iy )}}{e^{-R+iy}+e^{-(-R+iy )}}idy\right|\leqslant \frac{2\pi e^{|a| R}}{e^{R}-e^{-R}}=\frac{2\pi e^{(|a|-1) R}}{1-e^{-2R}}\to0\tag4$$ as $R\to\infty$.

By $(1),(2),(3),(4)$, we have $$\lim_{R\to\infty}(1+\cosh(a\pi i))\int_{-R}^{R}\frac{\cosh(ax)}{\cosh(x)}\:dx=2\pi\cos {\frac{\pi a}{2}}$$ i.e. $$\int_{-\infty}^{\infty}\frac{\cosh(ax)}{\cosh(x)}\:dx=\frac{2\pi\cos {\frac{\pi a}{2}}}{1+\cosh(a\pi i)}=\frac{2\pi\cos {\frac{\pi a}{2}}}{2\cos^2 {\frac{\pi a}{2}}}=\pi\sec{\frac{\pi a}{2}}$$ Since $\frac{\cosh(ax)}{\cosh(x)}$ is even, we have finally $$\int_{0}^{\infty}\frac{\cosh(ax)}{\cosh(x)}\:dx=\frac{\pi}{2}\sec{\frac{\pi a}{2}}$$