Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Use residues to evaluate $$ \int_0^\infty \frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x $$ where $|a|<1$.

Try considering the integral of the form $$ \int_C \frac{\exp(az)}{\cosh(z)}\,\mathrm dz, $$ where $C$ is the contour given by $y=0,\, y=\pi,\, x=-R,\, x=R$.

share|cite|improve this question
This answer (with a rotation in the complex plane and the path for the numerator or, simpler, setting $a:=ib$ first) should help. – Raymond Manzoni Nov 21 '12 at 12:44
@RaymondManzoni: the problem I see with the present problem, and with the link you gave, is that we have the hyperbolic cosine also in the numerator, and not only cosine. This messes things greatly, at least for me, though I think this may have been a typo by the OP since he's been adviced to use that exponential function in the numerator... – DonAntonio Nov 21 '12 at 14:46
@DonAntonio: Hmmm... I don't think so. The numerator may be $e^{az}$ as here (or $e^{iaz}$ as in the other link) but we are supposing $|a|<1$ and are dividing by $\cosh(z)$. For $|z|\gg 1$ the norm of this fraction will be majored by $\dfrac {e^{|a|z}}{e^z}\sim e^{-(1-|a|)z}$ (the denominator is giving us convergence) so that the two vertical integrals will disappear at the limit (while the two horizontal ones are identical up to a global coefficient and the limit is taken as a P.V.). Or did I forget something? – Raymond Manzoni Nov 21 '12 at 17:27
@RaymondManzoni , but how do you pass to $\,\cosh az\,$ from $\,e^{az}\,$? I know the vertical integrals vanish in the limit and both horizontal ones are the same up to a constant ($\,e^{(a-1)}\,$ , if I remember correctly), yet I can't see the byperbolic cosine appearing afterwards... – DonAntonio Nov 21 '12 at 17:34
@DonAntonio: At the end we should get $\displaystyle P.V. \int_{-\infty}^\infty \frac {e^{az}}{\cosh(z)} dz=\frac 12\int_0^\infty \frac{\cosh(az)}{\cosh(z)}dz$ (after separing properly the negative and positive part from $0$ to $R$ changing variable for the negative part and taking the limit as a principal value). – Raymond Manzoni Nov 21 '12 at 17:40
up vote 0 down vote accepted

As the original query that asked to use residues has not been answered completely I will contribute some ideas.

Suppose $a$ is a rational number $p/q$ where $p<q$ and $p-q$ is odd. Use a rectangular contour that consists of four segments: $\Gamma_0$ along the real axis from $-R$ to $R$, $\Gamma_1$ parallel to the imaginary axis to $R + \pi i q$, $\Gamma_2$ parallel to the real axis but in the opposite direction to $-R + \pi i q$ and finally, $\Gamma_3$ parallel to the imaginary axis to $-R$ on the real axis.

Now set $$f(z) = \frac{e^{az}+e^{-az}}{e^z+e^{-z}}$$ so that we are looking for $$\frac{1}{2} \int_{-\infty}^\infty f(z) dz$$ and integrate $f(z)$ along $\Gamma_0 - \Gamma_1 - \Gamma_2 - \Gamma_3$. Examine each segment in turn as $R$ goes to infinity. Clearly the integral along $\Gamma_0$ is simply the integral we are looking for. The contributions of $\Gamma_1$ and $\Gamma_3$ vanish in the limit. Along $\Gamma_2$ we have $x= t + \pi i q$, getting $$ \int_\infty^{-\infty} \frac{e^{\frac{p}{q}t + \pi i p}+e^{-\frac{p}{q}t - \pi i p}}{e^{t+ \pi i q}+e^{-t- \pi i q}} dt = - (-1)^{p-q} \int_{-\infty}^\infty \frac{e^{\frac{p}{q}t}+e^{-\frac{p}{q}t}}{e^{t}+e^{-t}} dt =\int_{-\infty}^\infty \frac{e^{\frac{p}{q}t}+e^{-\frac{p}{q}t}}{e^{t}+e^{-t}} dt. $$ The last equality is because $p-q$ is odd.

To conclude we need to compute the poles and residues inside our contour. The poles are at $$\rho_k = \frac{1}{2}\pi i + \pi i k$$ and the residues are $$\lim_{z\to \rho_k} \frac{(z-\rho_k) (e^{az} + e^{-az})}{e^z + e^{-z}} = \lim_{z\to \rho_k} \frac{(z-\rho_k) (a e^{az} -a e^{-az}) + e^{az} + e^{-az}}{e^z - e^{-z}}.$$ But $$ \lim_{z\to \rho_k} \frac{1}{e^z - e^{-z}} = \frac{1}{i e^{\pi i k} - (-i) e^{-\pi i k}} = \frac{1}{i e^{\pi i k} + i e^{-\pi i k}} = \frac{e^{\pi i k}}{i (1+1)} = \frac{(-1)^k}{2i}$$ so that finally $$\operatorname{Res}_{z=\rho_k} f(z) = \frac{(-1)^k}{2i} \left( e^{a\rho_k} + e^{-a\rho_k}\right).$$ With $J$ being the integral we are looking for and $I$ the integral along $\Gamma_0$ we have $$ J = \frac{1}{2} I = \frac{1}{4} 2 I = \frac{1}{4} 2\pi i \sum_{k=0}^{q-1} \operatorname{Res}_{z=\rho_k} f(z)$$ The conclusion is that $$ J = \frac{1}{2} \pi i \sum_{k=0}^{q-1} \operatorname{Res}_{z=\rho_k} f(z) = \frac{\pi}{4} \sum_{k=0}^{q-1} (-1)^k \left( e^{a\rho_k} + e^{-a\rho_k}\right) = \frac{\pi}{2} \sum_{k=0}^{q-1} (-1)^k \cosh(a\rho_k).$$ where we have used the fact that $1/2 + k < q$ implies that $k$ runs up to $q-1.$

Edit. Use the following bound to see that the integral along $\Gamma_1$ vanishes (set $z= R + it$ with $0\le t \le \pi q$): $$ \left| \int_{\Gamma_1} f(z) dz \right| = \left| \int_0^{\pi q} \frac{e^{aR + ait} + e^{-aR -ait}}{e^{R+it} + e^{-R-it}} i dt \right| \le \int_0^{\pi q} \frac{e^{aR} + e^{-aR}}{e^{R} - e^{-R}} dt = \pi q e^{-(1-a) R} \frac{1-e^{-2aR}}{1-e^{-2R}}$$ Now certainly we have $$\lim_{R\to\infty}\frac{1-e^{-2aR}}{1-e^{-2R}} = 1$$ so that the integral is $\theta(e^{-(1-a) R})$ which goes to zero as $R$ goes to infinity. The integral along $\Gamma_3$ is done the same way.

share|cite|improve this answer

This doesn't use residues until we use $$ \sum_{k\in\mathbb{Z}}\frac{(-1)^k}{z+k}=\pi\csc(\pi z) $$ which can be proven using residues.

We just expand things in powers of $e^x$: $$ \begin{align} &\int_0^\infty\frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x\\ &=\int_0^\infty e^{(a-1)x}\frac{1+e^{-2ax}}{1+e^{-2x}}\,\mathrm{d}x\\ &=\int_0^\infty\left(e^{(a-1)x}-e^{(a-3)x}+e^{(a-5)x}-\dots\right)\,\mathrm{d}x\\ &+\int_0^\infty\left(e^{(-a-1)x}-e^{(-a-3)x}+e^{(-a-5)x}-\dots\right)\,\mathrm{d}x\\ &=\frac1{1-a}-\frac1{3-a}+\frac1{5-a}-\dots\\ &+\frac1{1+a}-\frac1{3+a}+\frac1{5+a}-\dots\\ &=\frac1{a+1}-\frac1{a+3}+\frac1{a+5}-\dots\\ &-\frac1{a-1}+\frac1{a-3}-\frac1{a-5}-\dots\\ &=\frac12\left(\dots+\frac1{\frac{a+1}2-2}-\frac1{\frac{a+1}2-1}+\frac1{\frac{a+1}2}-\frac1{\frac{a+1}2+1}+\frac1{\frac{a+1}2+2}-\dots\right)\\ &=\frac12\pi\csc\left(\pi\frac{a+1}2\right)\\ &=\frac\pi2\sec\left(\frac\pi2a\right) \end{align} $$

share|cite|improve this answer

There is some additional simplification that can be done which I'll do in a new answer because my browser is not coping well with those large formulas where speed is concerned.

We have $$ \frac{\pi}{2} \sum_{k=0}^{q-1} (-1)^k \cosh(a\rho_k) = \frac{\pi}{4} \sum_{k=0}^{q-1}(-1)^k e^{a\rho_k} + \frac{\pi}{4} \sum_{k=0}^{q-1}(-1)^k e^{-a\rho_k}$$

The first sum is $$ \sum_{k=0}^{q-1} (-1)^k e^{a\rho_k} = \sum_{k=0}^{q-1} (-1)^k e^{a i \pi /2} e^{a \pi i k} = e^{a i \pi/2} \frac{1-(-e^{a \pi i})^q}{1 + e^{a \pi i}} $$ which is $$ e^{a i \pi/2} \frac{1-(-1)^q e^{p \pi i}}{1 + e^{a \pi i}} = e^{a i \pi/2} \frac{1-(-1)^{p+q}}{1 + e^{a \pi i}} = e^{a i \pi/2} \frac{2}{1 + e^{a \pi i}} = \frac{1}{\cos (a\pi/2)}$$

The second sum is $$ \sum_{k=0}^{q-1} (-1)^k e^{-a\rho_k} = \sum_{k=0}^{q-1} (-1)^k e^{-a i \pi /2} e^{-a \pi i k} = e^{-a i \pi/2} \frac{1-(-e^{-a \pi i})^q}{1 + e^{-a \pi i}} $$ which is $$ e^{-a i \pi/2} \frac{1-(-1)^q e^{-p \pi i}}{1 + e^{-a \pi i}} = e^{-a i \pi/2} \frac{1-(-1)^{p+q}}{1 + e^{-a \pi i}} = e^{-a i \pi/2} \frac{2}{1 + e^{-a \pi i}} = \frac{1}{\cos (a\pi/2)}$$

It follows that the original sum and the integral is $$J = \frac{\pi}{2} \frac{1}{\cos(a \pi/2)}.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.