Improper Integrals – Evaluating Integral of x^2/cosh(x) from -Infinity to Infinity

contour-integrationimproper-integrals

  • I need to compute the improper integral
    $$
    \int_{-\infty}^{\infty}\frac{x^{2}}{\cosh\left(x\right)}\,{\rm d}x
    $$

    using contour integration and possibly principal values. Trying to approach this as I would normally approach evaluating an improper integral using contour integration doesn't work here, and doesn't really give me any clues as to how I should do it.
  • This normal approach is namely evaluating the contour integral
    $$
    \oint_{C}{\frac{z^2}{\cosh\left(z\right)}\mathrm{d}z}
    $$

    using a semicircle in the upper-half plane centered at the origin, but the semicircular part of this contour integral does not vanish since $\cosh\left(z\right)$ has period $2\pi\mathrm{i}$ and there are infinitely-many poles of the integrand along the imaginary axis given by $-\pi\mathrm{i}/2 + 2n\pi\mathrm{i}$ and
    $\pi\mathrm{i}/2 + 2n\pi\mathrm{i}$ for
    $n \in \mathbb{Z}$.
  • The residues of the integrand at these simple poles are $-\frac{1}{4}\mathrm{i}\pi^{2}\left(1 – 4n\right)^{2}$ and $\frac{1}{4}\mathrm{i}\left(4\pi n + \pi\right)^{2}$, so that even when we add up all of the poles, we have the sum $4\pi^{2}\mathrm{i}\sum_{n = 0}^{\infty}\,n$, which clearly diverges.

Any hints would be greatly appreciated.

Best Answer

Integrals of the form

$$\int_{-\infty}^\infty \frac{p(x)}{\cosh x}\,dx,$$

where $p$ is a polynomial can be evaluated by shifting the contour of integration to a line $\operatorname{Im} z \equiv c$. We first check that the integrals over the vertical segments connecting the two lines tend to $0$ as the real part tends to $\pm\infty$:

$$\lvert \cosh (x+iy)\rvert^2 = \lvert \cosh x\cos y + i \sinh x\sin y\rvert^2 = \sinh^2 x + \cos^2 y,$$

so the integrand decays exponentially and

$$\left\lvert \int_{R}^{R + ic} \frac{p(z)}{\cosh z}\,dz\right\rvert \leqslant \frac{K\,c}{\sinh R}\left(R^2+c^2\right)^{\deg p/2} \xrightarrow{R\to \pm\infty} 0.$$

Since $\cosh \left(z+\pi i\right) = -\cosh z$, and the only singularity of the integrand between $\mathbb{R}$ and $\mathbb{R}+\pi i$ is a simple pole at $\frac{\pi i}{2}$ (unless $p$ has a zero there, but then we can regard it as a simple pole with residue $0$) with the residue

$$\operatorname{Res}\left(\frac{p(z)}{\cosh z};\, \frac{\pi i}{2}\right) = \frac{p\left(\frac{\pi i}{2}\right)}{\cosh' \frac{\pi i}{2}} = \frac{p\left(\frac{\pi i}{2}\right)}{\sinh \frac{\pi i}{2}} = \frac{p\left(\frac{\pi i}{2}\right)}{i},$$

the residue theorem yields

$$\begin{align} \int_{-\infty}^\infty \frac{p(x)}{\cosh x}\,dx &= 2\pi\, p\left(\frac{\pi i}{2}\right) + \int_{\pi i-\infty}^{\pi i+\infty} \frac{p(z)}{\cosh z}\,dz\\ &= 2\pi\, p\left(\frac{\pi i}{2}\right) - \int_{-\infty}^\infty \frac{p(x+\pi i)}{\cosh x}\,dx\\ &= 2\pi\, p\left(\frac{\pi i}{2}\right) - \sum_{k=0}^{\deg p} \frac{(\pi i)^k}{k!}\int_{-\infty}^\infty \frac{p^{(k)}(x)}{\cosh x}\,dx.\tag{1} \end{align}$$

Since $\cosh$ is even, only even powers of $x$ contribute to the integrals, hence we can from the beginning assume that $p$ is an even polynomial, and need only consider the derivatives of even order.

For a constant polynomial, $(1)$ yields

$$\int_{-\infty}^\infty \frac{dx}{\cosh x} = 2\pi - \int_{-\infty}^\infty \frac{dx}{\cosh x}\Rightarrow \int_{-\infty}^\infty \frac{dx}{\cosh x} = \pi.$$

For $p(z) = z^2$, we obtain

$$\begin{align} \int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx &= 2\pi \left(\frac{\pi i}{2}\right)^2 - \int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx - (\pi i)^2\int_{-\infty}^\infty \frac{dx}{\cosh x}\\ &= - \frac{\pi^3}{2} - \int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx + \pi^3, \end{align}$$

which becomes

$$\int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx = \frac{\pi^3}{4}.$$

Related Question