19

How can I evaluate$$\int_{-\infty}^\infty \frac{\cos x}{\cosh x}\,\mathrm dx\quad\text{ and }\quad\int_0^\infty\frac{\sin x}{e^x-1}\,\mathrm dx\,?$$ Thanks in advance.

Travis Willse
  • 108,056
ali
  • 191

5 Answers5

23

For the second one,

$$ \begin{align*} \int_{0}^{\infty} \frac{\sin x}{e^x - 1} \; dx &= \int_{0}^{\infty} \frac{\sin x \, e^{-x}}{1 - e^{-x}} \; dx \\ &= \int_{0}^{\infty} \left( \sum_{n=1}^{\infty} \sin x \, e^{-nx} \right) \; dx \\ &\stackrel{\ast}{=} \sum_{n=1}^{\infty} \int_{0}^{\infty} \sin x \, e^{-nx} \; dx \\ &= \sum_{n=1}^{\infty} \frac{1}{1+n^2}, \end{align*}$$

where the starred identity is justified by the following formula

$$ \begin{align*} \int_{0}^{\infty} \frac{\sin x}{e^x - 1} \; dx &= \int_{0}^{\infty} \left( \frac{1 - e^{-Nx}}{1 - e^{-x}} e^{-x} + \frac{e^{-Nx}}{e^x - 1} \right) \sin x \; dx \\ &= \sum_{n=1}^{N} \int_{0}^{\infty} \sin x \, e^{-nx} \; dx + \int_{0}^{\infty} \frac{\sin x \, e^{-Nx}}{e^x - 1} \; dx, \end{align*}$$

together with the dominated convergence theorem. Now the resulting infinite summation can be evaluated in numerous ways. For example, exploiting identities involving the digamma function,

$$ \sum_{n=1}^{\infty} \frac{1}{1+n^2} = \frac{1}{2i} \sum_{n=1}^{\infty} \left( \frac{1}{n-i} - \frac{1}{n+i} \right) = \frac{\psi_0(1+i) - \psi_0(1-i)}{2i} = -\frac{1}{2} + \frac{\pi}{2} \coth \pi. $$

Similar techniques apply to the first integral.

Sangchul Lee
  • 181,930
16

For the first one for example by using the rectangular contour $-R\to +R \to +R+2\pi i \to -R+2\pi i \to -R$
and since there are two simple poles from $\cosh(z)$ at $z=\frac {\pi i}2$ and $z=\frac {3\pi i}2$ of values $-ie^{-\frac {\pi i}2}$ and $ie^{-\frac {3\pi i}2}$ we have : $$2\pi i\ \left(\rm{Res}\left(\frac {e^{iz}}{cosh(z)}; \frac {\pi i}2\right)+\rm{Res}\left(\frac {e^{iz}}{cosh(z)}; \frac {3\pi i}2\right)\right)=2\pi i \left(-ie^{-\frac {\pi}2}+ie^{-\frac {3\pi}2}\right)$$

so that the integral over the rectangular contour of $\dfrac {e^{i x}}{\cosh(x)}$ will be : $$\int_{-R}^R \frac {e^{i x}}{\cosh(x)}\;dx+\int_0^{2\pi} \frac {e^{i R-y}}{\cosh (R+iy)}\;dy+\int_R^{-R} \frac {e^{-2\pi+i x}}{\cosh(2\pi i+x)}\;dx+\int_{2\pi}^0 \frac {e^{-i R-y}}{\cosh (-R+iy)}\;dy=2\pi \left(e^{-\frac {\pi}2}-e^{-\frac {3\pi}2}\right)$$

I'll let you prove that the two integrals in $y$ disappear as $R\to\infty$ so that only remains :

$$\lim_{R\to \infty} \int_{-R}^R \frac {e^{i x}}{\cosh(x)}\;dx-\lim_{R\to \infty}\int_{-R}^R \frac {e^{-2\pi-i x}}{\cosh(2\pi i-x)}\;dx=2\pi \left(e^{-\frac {\pi}2}-e^{-\frac {3\pi}2}\right)$$

it is easy to show that $\ \cosh(2\pi i+x)=\cosh(x)$ (use exponential notation) so that :

$$(1-e^{-2\pi})\int_{-\infty}^\infty \frac {e^{i x}}{\cosh(x)}\;dx=2\pi \left(e^{-\frac {\pi}2}-e^{-\frac {3\pi}2}\right)$$

and the result (keeping the real part) : $$\int_{-\infty}^\infty \frac {\cos x}{\cosh x}\;dx=2\pi \frac{e^{-\frac {\pi}2}}{1+e^{-\pi}}=\frac{\pi}{\cosh \frac{\pi}2}$$

(the second one may be solved the same way...)

  • I just knew contours could be used (as with a lot of these sorts of integrals), but I got stuck picking the right one. +1, of course. – J. M. ain't a mathematician Jul 15 '12 at 12:06
  • @J.M.: I must admit that it is rather laborious this way (I am much more fond of derivation under the integral and so on...) – Raymond Manzoni Jul 15 '12 at 12:17
  • 2
    I prefer real analysis methods to complex ones because of my personal taste, but I also agree that complex method is undisputedly the most general and elegant method to evaluate these kinds of integrals or summations, in the sense that this often shows the glimpse of the true nature behind them. +1, of course! – Sangchul Lee Jul 15 '12 at 12:31
  • @sos440: with clearly the advantage of speed here! :-) (when other methods exist they are often more direct and thus faster than complex integration...). Your nice derivation got my vote too! – Raymond Manzoni Jul 15 '12 at 12:46
5

Note

\begin{align} I(a)=&\int_{0}^\infty \frac{\cosh ax}{\cosh x}\,dx\\ \overset{t=e^{-x}}=&\int_0^1 \frac{t^a}{1+t^2}dt + \int_0^1 \frac{t^{-a}}{1+t^2}\overset{t\to1/t}{dt} =\int_0^\infty \frac{t^a}{1+t^2}dt \\ =& \frac{1}{2} \Gamma \left( \frac{1+a}{2} \right) \Gamma \left(\frac{1-a}{2} \right) =\frac\pi2\sec\frac{a\pi}2 \end{align}

Then $$\int_{-\infty}^\infty \frac{\cos x}{\cosh x}\,dx = 2I(i)=\pi\>\text{sech}\frac\pi2 $$

Quanto
  • 120,125
  • 1
    You may comment on the step leading to the explicit form in terms of the secant function. – Gary Sep 06 '21 at 13:30
  • 5
    The step where you get $\frac\pi2\sec\left(\frac{a\pi}2\right)$ is not clear without any explanation. Also using imaginary values for $a$ requires verification that the contours involved do not contain any singularities. – robjohn Sep 06 '21 at 13:34
  • 2
    The edit to the title of the question was very minor for a question that is 9 years old. – robjohn Sep 06 '21 at 13:36
4

Let us start from the Weierstrass product for the sine function: $$ \sin(x) = x \prod_{n\geq 1}\left(1-\frac{x^2}{\pi^2 n^2}\right)\tag{1} $$ This identity over the real line can be proved by exploiting Chebyshev polynomials, but it holds over $\mathbb{C}$ and it is equivalent to $$ \sinh(x) = x \prod_{n\geq 1}\left(1+\frac{x^2}{n^2\pi^2}\right).\tag{1'} $$ If we apply $\frac{d}{dx}\log(\cdot)$ (the logarithmic derivative) to both sides of $(1)$ we end up with $$ \cot(x)-\frac{1}{x} = \sum_{n\geq 1}\frac{2x}{x^2-n^2 \pi^2} \tag{2}$$ $$ \coth(x)-\frac{1}{x} = \sum_{n\geq 1}\frac{2x}{x^2 + n^2 \pi^2} \tag{2'}$$ and by expanding the main term of the RHS of $(2)$ as a geometric series we have $$ \frac{1-x\cot x}{2} = \sum_{n\geq 1}\frac{\frac{x^2}{n^2 \pi^2}}{1-\frac{x^2}{n^2\pi^2}} =\sum_{n\geq 1}\sum_{m\geq 1}\left(\frac{x^2}{n^2 \pi^2}\right)^m = \sum_{m\geq 1}x^{2m}\frac{\zeta(2m)}{\pi^{2m}} \tag{3}$$ $$ \frac{1-x\coth x}{2} = \sum_{m\geq 1}(-1)^m x^{2m}\frac{\zeta(2m)}{\pi^{2m}}\tag{3'} $$

$(3')$ alone is enough to prove that $\zeta(2m)$ is always a rational multiple of $\pi^{2m}$, related to a coefficient of the Maclaurin series of $\frac{z}{e^z-1}=-\frac{z}{2}+\frac{z}{2}\coth\frac{z}{2}$, i.e. to a Bernoulli number, but that is not the point here.

Let us deal with the second integral:

$$ \int_{0}^{+\infty}\frac{\sin z}{e^z-1}\,dz = \sum_{m\geq 1}\int_{0}^{+\infty}\sin(z) e^{-mz}\,dz = \sum_{m\geq 1}\frac{1}{m^2+1} $$ can be evaluated through $(2')$ by picking $x=\pi$. In a similar fashion

$$ \int_{0}^{+\infty}\frac{\cos z}{e^z+e^{-z}}\,dz = \sum_{m\geq 0}(-1)^m\int_{0}^{+\infty}\cos(z)e^{-(2m+1)z}\,dz = \sum_{m\geq 0}(-1)^m \frac{(2m+1)}{(2m+1)^2+1} $$

can be computed from the Weierstrass product of the cosine function,

$$ \cos(x) = \prod_{m\geq 0}\left(1-\frac{4x^2}{(2m+1)^2\pi^2}\right)\tag{4} $$

$$ \cosh(x) = \prod_{m\geq 0}\left(1+\frac{4x^2}{(2m+1)^2\pi^2}\right)\tag{4'} $$

leading by logarithmic differentiation to

$$ \sum_{m\geq 0}\frac{x}{x^2+(2m+1)^2} = \frac{\pi}{4}\tanh\left(\frac{\pi x}{2}\right)\tag{5} $$

and also to

$$ \sum_{m\geq 0}\frac{(-1)^m(2m+1)}{x^2+(2m+1)^2} = \frac{\pi}{4}\operatorname{sech}\left(\frac{\pi x}{2}\right).\tag{6}$$

Jack D'Aurizio
  • 361,689
0

Second integral $$ \begin{aligned} \int_0^{\infty} \frac{\sin x}{e^x-1} d x&=\int_0^{\infty} \frac{e^{-x} \sin x}{1-e^{-x}} d x \\ & =\sum_{n=0}^{\infty} \int_0^{\infty} e^{-(n+1) x} \sin x d x \\ & =\sum_{n=0}^{\infty} \frac{1}{(n+1)^2+1} \\ & =\sum_{n=1}^{\infty} \frac{1}{n^2+1} \end{aligned} $$ To get rid of the square of $n$, we resolve it into two fractions and then reunite them as

$$ \begin{aligned} \int_0^{\infty} \frac{\sin x}{e^x-1} d x & =\frac{1}{2 i} \sum_{n=1}^{\infty}\left(\frac{1}{n-i}-\frac{1}{n+i}\right) \\ & =\frac{1}{2 i} \sum_{n=1}^{\infty}\left(\frac{1}{n-i}+\frac{1}{-n-i}\right) \\ & =\frac{1}{2 i}\left(\sum_{n=-\infty}^{\infty} \frac{1}{n-i}+\frac{1}{i}\right) \end{aligned} $$ Using the result$$ \pi \cot (\pi z)=\lim _{N \rightarrow \infty} \sum_{k=-N}^N \frac{1}{z+k} \text {, where } z \notin \mathbb{Z} $$ We can now conclude that

$$ \begin{aligned} \int_0^{\infty} \frac{\sin x}{e^x-1} d x & =\frac{1}{2 i}\left[\pi \cot (-i \pi)+\frac{1}{i}\right] \\ & =-\frac{1}{2}+\frac{\pi}{2} \operatorname{coth} \pi \end{aligned} $$

Lai
  • 31,615