A Dodgy Contour Integration Method Giving the Correct Result

complex-analysiscontour-integrationdivergent-series

Consider the following integral
$$I = \int_{-\infty}^\infty \frac{x}{\sinh x}dx$$

Using contour integration with some rectangular contour, it is not too hard to show that the integral evaluates to $\pi^2/2$. However, as shown in this reply, it is apparently possible to get the correct answer using a semi-circular contour in the upper half-plane, despite the fact that the integral over the contour technically doesn't vanish. As the radius of the semi-circular contour tends to infinity, there are an infinite number of poles contained within the contour with residues $i\pi n$ and $-i\pi n$ for $n$ is even and odd respectively. By assuming that the integral on the semi-circular contour vanishes, the residue theorem yields $$I = 2\pi i \sum_{n=0}^\infty (-1)^n (i\pi n) = -2\pi^2\sum_{n=0}^\infty (-1)^n n = \frac{\pi^2}{2}$$
if we consider that the last series goes to $-1/4$.

Now, despite the fact that the final answer is correct, the method used seems heretical for three reasons:

  1. Assuming the integral on the semi-circular contour vanishes when it clearly doesn't on the imaginary axis.

  2. Considering an infinite number of poles within the contour (although it's not too hard to accept that the residue theorem can also be used if the number of poles within a contour is countably infinite).

  3. Assuming that the last traditionally divergent series actually converges in this context.

Why does this nevertheless yield the correct result? It's a safe assumption that it is not coincidental, since the entire family of integrals
$$I(n) = \int_{-\infty}^\infty \left(\frac{x}{\sinh x}\right)^n dx$$
can seemingly be evaluated correctly by using this method, with the only difference being the type of divergent series at the end.

Best Answer

Considering that zeta-regularization applied to $\sum_{n=1}^{\infty} (-1)^n n$ yields the correct answer, we may attempt to regularize the integral first and then appeal to the principle of analytic continuation.

In this pursuit, it doesn't really matter if we use a semicircular contour or rectangular contour. (Indeed, continuously deforming a contour while avoiding the singularities does not change the value of a contour integral.) What matters most is the fact that the sum of residues diverges as the contour encompasses larger region. So, we will stick to rectangular contours.

First, we introduce a parameter $s$ and note that

\begin{align*} \int_{-\infty}^{\infty} \frac{x}{\sinh x} \, \mathrm{d}x &= 2 \int_{0}^{\infty} \frac{x}{\sinh x} \, \mathrm{d}x \\ &= 2 \lim_{s \to 1} \int_{0}^{\infty} \frac{x^s}{\sinh x} \, \mathrm{d}x = 2 \lim_{s \to 1} J(s), \end{align*}

where $J(s)$ is defined for all $s \in \mathbb{C} \setminus \mathbb{Z}$ by

$$ J(s) = \frac{1}{1 - e^{2\pi i s}} \int_{\mathcal{C}} \frac{z^s}{\sinh z} \, \mathrm{d}z $$

and $\mathcal{C}$ is the clockwise-oriented Hankel contour, composed of a small circle about $0$ and two half-infinite lines "just right" above and below the positive $x$-line:

Hankel contour

Now replace each of the two half-infinite lines by a line segment of length $R$ , and denote the resulting "truncated" Hankel contour by $\mathcal{C}_R$.

Truncated Hankel contour

Then we may write $J(s)$ as

$$ J(s) = \lim_{R\to\infty} J_R(s), \qquad\text{where}\qquad J_R(s) := \frac{1}{1 - e^{2\pi i s}} \int_{\mathcal{C}_R} \frac{z^s}{\sinh z} \, \mathrm{d}z. $$

From this point on, we assume $-2 < \operatorname{Re}(s) < -1$ and $R = (N+\frac{1}{2})\pi$ for $N = 0, 1, 2, \ldots$. Then, as we continuously inflate the contour $\mathcal{C}_R$ to a clockwise-oriented square $\mathcal{S}_R$ with vertices $\pm R \pm iR$, the deformation will sweep poles of the integrand at $z = \pm \pi i, \pm 2\pi i, \ldots, \pm N\pi i$. Hence,

\begin{align*} J_R(s) &= \frac{2\pi i}{1 - e^{2\pi i s}} \biggl[ \sum_{n = \pm 1, \ldots, \pm N} \,\underset{z=n\pi i}{\mathrm{Res}}\, \frac{z^s}{\sinh z} + \frac{1}{2\pi i} \int_{\mathcal{S}_R} \frac{z^s}{\sinh z} \, \mathrm{d}z\biggr] \\ &= \frac{2\pi i}{1 - e^{2\pi i s}} \biggl[ \pi^s (e^{i\pi s/2} + e^{3i\pi s/2}) \sum_{n = 1}^{N} (-1)^n n^s + \mathcal{O}(N^{1+\operatorname{Re}(s)}) \biggr] \\ &= \frac{\pi^{s+1}}{\sin(\pi s/2)} \sum_{n = 1}^{N} (-1)^{n-1} n^s + \mathcal{O}(N^{1+\operatorname{Re}(s)}). \end{align*}

So, as $N \to \infty$, it follows that

\begin{align*} J(s) &= \frac{\pi^{s+1}}{\sin(\pi s/2)} \sum_{n = 1}^{\infty} (-1)^{n-1} n^s \\ &= \frac{\pi^{s+1}}{\sin(\pi s/2)} (1 - 2^{1+s}) \zeta(-s). \end{align*}

However, since $\mathbb{C}\setminus\mathbb{Z}$ is connected and both sides of the above equality are holomorphic functions on $\mathbb{C}\setminus\mathbb{Z}$ that agree on a non-empty open subset, they must agree on all of $\mathbb{C}\setminus\mathbb{Z}$ by the principle of analytic continuation. This justifies OP's heuristics, and in particular,

$$ I = 2 \lim_{s \to 1} J(s) = \frac{2\pi^2}{\sin(\pi/2)} (1 - 2^{2}) \zeta(-1) = \frac{\pi^2}{2}. $$


Addendum. The above argument also shows that, for any $\operatorname{Re}(s) > 0$,

$$ \int_{0}^{\infty} \frac{x^s}{\sinh x} \, \mathrm{d}x = \frac{\pi^{s+1}}{\sin(\pi s/2)} (1 - 2^{1+s}) \zeta(-s) $$

On the other hand, the left-hand side can be easily computed as:

\begin{align*} \int_{0}^{\infty} \frac{x^s}{\sinh x} \, \mathrm{d}x &= 2 \sum_{n=0}^{\infty} \int_{0}^{\infty} x^s e^{-(2n+1)x} \, \mathrm{d}x \\ &= 2 \sum_{n=0}^{\infty} \frac{\Gamma(s+1)}{(2n+1)^{s+1}} \\ &= 2 \Gamma(s+1) (1 - 2^{-s-1}) \zeta(s+1). \end{align*}

Comparing both sides, we get

$$ \zeta(-s) = - \frac{2 \Gamma(s+1)}{(2\pi)^{s+1}} \zeta(s+1) \sin(\pi s/2) $$

and this is just the Riemann's functional equation for $\zeta(\cdot)$ in disguise.