# Avoiding Contour Integration

One time I boasted, “I can do by other methods any integral anybody else needs contour integration to do.” So Paul puts up this tremendous damn integral he had obtained by starting out with a complex function that he knew the answer to, taking out the real part of it and leaving only the complex part. He had unwrapped it so it was only possible by contour integration! He was always deflating me like that. He was a very smart fellow.

— Richard Feynman

Partially inspired by this excerpt, I’ve had several conversations in the past few months about doing hard integrals without the residue theorem. I think there’s a lot of appeal to avoiding such a high-powered tool, so I both like finding solutions that don’t use it and believe that it’s usually possible to do so. I got stuck though, on

$\displaystyle \int_0^{\infty} \frac{1}{1+z^n}\, dz,$

and because this integral is basically equivalent to the reflection formula for the ${\Gamma}$ function, I thought it would absolutely require some kind of complex analysis to tackle.

I was wrong. The following solution is mostly due to Sameer Kailasa, and evaluates the integral without any complex analysis. It does however, require some pretty technical manipulations, and so to make life easier, I’m going to ignore all issues of convergence/interchanging limits in this post. The fact that the answer works out correctly means that these issues are actually just technical ones, that can be resolved by appropriately applying dominated convergence/Fubini.

We start by evaluating a particular sum. I know of at least one other way to do this, which involves showing that the RHS and LHS share four properties, and then using these to argue that they agree everywhere, but I like this way better, because the tricks used here is more widely applicable than the trick used in the other argument (in the interest of full disclosure, this means that I know of one other instance where this trick is useful, and no other instances where the other trick is useful).

Proposition 1. We have

$\displaystyle \sum_{k=1}^{\infty} \frac{1}{x^2-k^2} =\frac{\pi x\cot \pi x -1}{2x^2}.$

Proof: The Weirstrass factorization theorem allows us to write

$\displaystyle \frac{\sin x}{x} =\left(1-\frac{x}{\pi}\right)\left(1+\frac{x}{\pi}\right)\left(1-\frac{x}{2\pi}\right)\left(1+\frac{x}{2\pi}\right)\cdots =\prod_{k=1}^{\infty} \left(1-\frac{x^2}{k\pi^2}\right).$

Changing variables by ${x\mapsto \pi x}$ gives

$\displaystyle \frac{\sin \pi x}{\pi x}=\prod_{k=1}^{\infty} \left(1-\frac{x^2}{k^2}\right)\implies \ln(\sin \pi x)-\ln \pi x=\sum_{k=1}^{\infty} \ln\left(1-\frac{x^2}{k^2}\right),$

and we differentiate to obtain

$\displaystyle \pi \cot \pi x -\frac{1}{x} =\sum_{k=1}^{\infty} \frac{2x}{x^2-k^2}\implies \sum_{k=1}^{\infty} \frac{1}{x^2-k^2} =\frac{\pi x\cot \pi x -1}{2x^2}.$

$\Box$

Remark The the factorization theorem is technically a complex analytic tool, but I’m willing to use it here because a. it’s really only a technical crutch, not the crux of the argument and b. there’s no sense (to the best of my knowledge) in which its equivalent to the residue theorem/Cauchy’s theorem/anything that does integrals. Also, it can be avoided entirely by using the other argument I mentioned above.

Corollary 2. We have

$\displaystyle \sum_{k=1}^{\infty} \frac{(-1)^k}{x^2-k^2}=\frac{\pi x \csc \pi x-1}{2x^2}.$

Proof: We write

$\displaystyle \sum_{k=1}^{\infty} \frac{(-1)^k}{x^2-k^2}=\sum_{k\text{ even}}\frac{1}{x^2-k^2}-\sum_{k\text{ odd}} \frac{1}{x^2-k^2}=2\sum_{k\text{ even}} \frac{1}{x^2-k^2}-\sum_{k=1}^{\infty}\frac{1}{x^2-k^2}.$

The second sum was evaluated in Proposition 1; the first is

$\displaystyle \sum_{k\text{ even}}\frac{1}{x^2-k^2}=\sum_{k=1}^{\infty}\frac{1}{x^2-4k^2}=\frac{1}{4}\sum_{k=1}^{\infty} \frac{1}{(x/2)^2-k^2},$

and now we can apply Proposition 1 to this sum as well. The result is

$\displaystyle 2\cdot \frac{1}{4}\cdot \frac{\pi\frac{x}{2}\cot\frac{\pi x}{2}-1}{2\cdot \frac{x^2}{4}}-\left(\frac{\pi x\cot \pi x-1}{2x^2}\right)=\frac{\pi x\left(\cot \frac{\pi x}{2}-\cot \pi x\right)-1}{2x^2}.$

Noting that

$\displaystyle \cot \frac{x}{2}-\cot x=\frac{1+\cos x}{\sin x}-\frac{\cos x}{\sin x}=\csc x,$

allows us to finish. $\Box$

Now we’re ready to tackle integral.

Proposition 3. We have

$\displaystyle \int_0^{\infty} \frac{1}{1+z^n}\, dz=\frac{\pi}{n}\csc \frac{\pi}{n}.$

Proof: We start by writing

$\displaystyle \int_0^{\infty} \frac{1}{1+z^n}\, dz=\int_0^{1} \frac{1}{1+z^n}\, dz+\int_1^{\infty} \frac{1}{1+z^n}\, dz,$

and substituting ${u=1/z}$ in the second integral to give

$\displaystyle \int_0^{\infty} \frac{1}{1+z^n}\, dz=\int_0^{1} \frac{1}{1+z^n}\, dz+\int_0^{1} \frac{z^{n-2}}{1+z^n}\, dz=\int_0^1\frac{1+z^{n-2}}{1+z^n}\, dz.$

Since we’re only dealing with ${0 now, we expand the denominator as a geometric series, so

$\displaystyle \int_0^1\frac{1+z^{n-2}}{1+z^n}\, dz=\int_0^1 (1+z^{n-2})\sum_{k=0}^{\infty} (-1)^kz^{nk}\,dz =\sum_{k=0}^{\infty} (-1)^k\int_0^1 z^{nk}+z^{n(k+1)-2}\,dz,$

and evaluating the integral gives

$\displaystyle \sum_{k=0}^{\infty} (-1)^k\left(\frac{1}{nk+1}+\frac{1}{n(k+1)-1}\right)=\sum_{k=0}^{\infty} \frac{(-1)^k}{nk+1}+\sum_{k=0}^{\infty} \frac{(-1)^k}{n(k+1)-1}.$

Now we tweak things a bit to get

$\displaystyle 1+\sum_{k=1}^{\infty}\frac{(-1)^k}{nk+1}-\sum_{k=1}^{\infty}\frac{(-1)^k}{nk-1}=1-2\sum_{k=1}^{\infty}\frac{(-1)^k}{n^2k^2-1}=1+\frac{2}{n^2}\sum_{k=1}^{\infty} \frac{(-1)^k}{\frac{1}{n^2}-k^2}.$

Plugging in the result of Corollary 2 with ${x=1/n}$ now gives

$\displaystyle 1+\frac{2}{n^2}\cdot \frac{\pi \cdot \frac{1}{n}\csc\frac{\pi}{n}-1}{2\cdot \frac{1}{n^2}}=\frac{\pi}{n}\csc \frac{\pi}{n},$

as desired.

$\Box$