Evaluating $\sum_{n=1}^{\infty} \frac{1}{n^2+1}$ [duplicate]

While I know that $$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^{2}}{6}$$

But trying to evaluate this has left me stumped $$\sum_{n=1}^{\infty} \frac{1}{n^2+1}$$

I evaluated it through wolfram alpha, it gave me $\frac{1}{2}(\pi\coth(\pi)-1)$.

What would be a good way to start evaluating this series?


This sum is harder, and perhaps less natural, to find than the sum for $\sum \frac{1}{n^2}$. We use Fourier series of $e^{x}$ with respect to $\{e^{i nx} / 2\pi\}$and apply Parseval's theorem.

Note that we can use this method of evaluation to find $\sum \frac{1}{n^2}$, too! We do the same for the (simpler) function $f(x) = x$. We could also directly evaluate the Fourier series for $f(x) = (\pi - |x|)^2$ on $(-\pi, \pi)$ at $x = 0$ to conclude the same (this function aso gives us the sum $\sum \frac{1}{n^4} = \frac{\pi^4}{90}$). (Source of these examples to Rudin's Principles of Mathematical Analysis)

We begin by calculating $\displaystyle \int_{-\pi}^{\pi} |f(x)|^2 \, dx = \int_{-\pi}^{\pi} e^{2x} \, dx = \frac{e^{2\pi} - e^{-2\pi}}{2}$.

Moving on to the Fourier coefficients, we have $c_n = \displaystyle \dfrac{1}{\sqrt{2\pi}} \int_{-\pi}^{\pi} e^{-inx+x} \, dx = \dfrac{1}{\sqrt{2\pi}}\left( \int_{-\pi}^{\pi} e^x \cos(nx)\,dx - i\int_{-\pi}^{\pi} e^x \sin(nx)\,dx\right).$ Integrating the first integral with parts $f = \cos(nx)$ and $e^x\,dx = dg$ we get $$\left.e^x \cos(nx)\right|_{-\pi}^{\pi} + n\int_{-\pi}^{\pi} e^x \sin(nx)\,dx$$

We integrate by parts again and combine the resulting "like terms" (integrals) to get $$(n^2+1) \int_{-\pi}^{\pi} e^x \cos(nx) \, dx = e^x (\cos(nx) + n \sin(nx))|_{-\pi}^{\pi} = (-1)^n (e^{\pi} - e^{-\pi})$$

and so $$\frac{1}{\sqrt{2\pi}} \int_{-\pi}^{\pi} e^x \cos(nx) = \frac{(-1)^n}{\sqrt{2\pi}} \frac{e^{\pi} - e^{-\pi}}{n^2 + 1}.$$

Similarly, we get $$\dfrac{1}{\sqrt{2\pi}} \int_{-\pi}^{\pi} e^x \sin(nx) \, dx = -\frac{n(-1)^n}{\sqrt{2\pi}} \frac{e^{\pi} - e^{-\pi}}{n^2 + 1}.$$

Hence $$|c_n|^2 = \frac{(e^\pi - e^{-\pi})^2 + n^2 (e^{\pi} - e^{-\pi})^2}{2\pi(n^2+1)^2} = \frac{1}{2\pi}\frac{(e^{\pi}-e^{-\pi})^2}{n^2+1}$$ since $|a+bi|^2 = a^2 + b^2$.

Putting it all together using Parseval's formula we have

\begin{align} \sum_{n=-\infty}^{\infty} |c_n|^2 &= \int_{-\pi}^{\pi} |f(x)|^2 \, dx \\ \frac{1}{2\pi} \sum_{n=-\infty}^{\infty} \frac{(e^\pi - e^{-\pi})^2}{n^2+1} &= \frac{e^{2\pi}-e^{-2\pi}}{2}\\ \sum_{n=-\infty}^{\infty} \frac{1}{n^2 + 1} &= \pi\frac{e^{2\pi} - e^{-2\pi}}{(e^\pi - e^{-\pi})^2}\\ 2 \sum_{n=1}^{\infty} \frac{1}{n^2+ 1} &= \pi \frac{e^\pi + e^{-\pi}}{e^{\pi} - e^{-\pi}} - 1\\ \sum_{n=1}^{\infty} \frac{1}{n^2 + 1} &= \frac{\pi \coth \pi - 1}{2} \end{align}

where we use $e^{2\pi} - e^{-2\pi} = (e^{\pi} - e^{-\pi})(e^{\pi}+e^{-\pi})$ and $c_n = c_{-n}$ in the third line.


This is relatively straightforward if you know the series expansion for $\cot(x)$ from calculus:

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


Why do you find it ridiculous ?

It is very classical, in particular for all series of the form

$$\sum_{n=1}^{\infty} R(n) \ \ \text{where} \ \ R=P/Q \ \ \text{is a rational expression with} \ \ deg(Q)>deg(P)+1$$

For individual cases, you may find astute ways for expressing your series for example as a Fourier sum, but for a general technique, you need residue calculus (part of complex function theory).

See the interesting paper http://www1.american.edu/academic.depts/cas/mathstat/People/kalman/pdffiles/Sixways.pdf .


The simplest way is using contour integration. With some experience you can do the entire computation completely in your head. I'll write down the solution doing all the computations as I write along. For a counterclockwise contour $C$ that doesn't contain any poles of a meromorphic function $g(z)$, we have for an analytic function $f(z)$:

$$\oint_C \frac{f'(z}{f(z)}g(z) dz = 2\pi i\sum_n g(\alpha_n) $$

where the $\alpha_n$ are the zeros of $f(z)$ inside the contour $C$.

If the contour does contains poles of $g(z)$ you just add the residues at these points to the summation. To calculate the summation, we can take $f(z) = \sin(\pi z)$ as this function has its zeros at the integers. The summation can thus be obtained by taking $g(z) = \frac{1}{1+z^2}$ and integrating along a contour that encircles the positive real axis, such that the poles of $g(z)$ at $z = \pm i$ are left outside.

Consider the contour integral that starts just below the point $z = 1$, moves to a point just below $z = R$, crosses the real axis to just above $z = R$ and then moves just to the left of $z = 1$, crosses the real axis there and then we complete the contour. In the limit of $R\to\infty$ this will yield the desired summation. The integrand being an even function, we can also consider a similar contour that encircles the negative real axis, from just below $z=-R$ to just below $z = -1$, crossing the real axis to the right of $z = -1$ to just above the real axis and then we move just above the real axis to just above $z = -R$ and then we move back to the starting point. The sum of the two contour integrals is thus twice the desired summation.

Then consider cutting open the two contours near $z = \pm R$ and connecting the two parts of the two contours above the real axis and do the same below the real axis. In the limit of $R\to\infty$ the integrals along the parts of the contours joining the two parts can be made arbitrarily small as the modulus of the integrand goes to zero far enough for $z\to \infty$.

The resulting contour is now a clockwise contour that only contains the poles at $z = 0$ and at $z = \pm i$. The residue at the pole at $z = 0$ is $g(1) = 1$. The residue at $z = \pm i$ is:

$$\lim_{z\to\pm i} (z-\pm i)\frac{\pi\cot(\pi z)}{z^2+1} = -\frac{\pi}{2} \coth(\pi)$$

So, the sum of the two contour integrals is equal to twice the summation we want to evaluate times $2\pi i$, but this is also equal to minus $2\pi i$ times $-\pi\coth(\pi)$ plus 1, therefore the desired summation is:

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

So, the only computations to get to the answer were just trivial applications of L'Hopital's rule, simple enough to do in your head.


Using the Fourier Series for the function $f$ defined by $f(x) = e^{-k\lvert x\rvert}, x \in [-\pi, \pi]$ and $f(x)= f(x+2\pi)$ allows you to find the sum $$\sum^\infty_{n=1} \frac{1}{n^2 + k^2}$$ for any $k > 0$. (At least, I believe that is the correct function; I may be off by a little bit). The idea is to find the coefficients in the Fourier series and use Parseval's Identity or perhaps just find the Fourier series and plug in the correct value for $x$.