# Computing $\sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1}$ using Fourier series.

$$f$$ is a $$2 \pi$$ periodic function on $$] - \pi,\pi[$$ defined as :

$$f(x) = e^{-x}$$

Using Fourier series, compute the sums :

$$\sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1} , \sum_{- \infty}^{+ \infty} \frac{1}{n^2 + 1}$$

How do I compute $$\sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1}$$ ?

I have computed the fourier coefficient and found that:

$$a_0 = \frac{2}{\pi} (1 - e^{- \pi})$$

$$a_n = \frac{2}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} )$$

$$b_n = \frac{2n}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} )$$

Using Dirichlet theorem and taking $$x = 0$$ to make the $$b_n$$ disappear, I get:

$$S_f (1) = \frac{2}{\pi} (1 - e^{- \pi}) + \sum_{n = 1}^{+ \infty} \frac{2}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} ) . (-1)^n = 1$$

I do not see how to proceed to get the value of the sum?

The same problem for the second sum.

• "same problem for the second sum" - not exactly; once you find the first sum, multiply it by $2$ and add $1$. – user170231 Jan 30 at 16:20
• @user170231 Thank you. I'm still stuck with the first sun though. – Zouhair El Yaagoubi Jan 30 at 16:21
• Your coefficients are not correct: $$a_0=\frac1\pi\int_{-\pi}^\pi e^{-x}\,\mathrm dx=\frac{e^\pi-e^{-\pi}}\pi=\frac{2\sinh\pi}\pi$$ Similarly you should have ended up with $$a_n=\frac{2(-1)^n\sinh\pi}{\pi(n^2+1)}\text{ and }b_n=\frac{2n(-1)^n\sinh\pi}{\pi(n^2+1)}$$ I think you are just missing a factor of $e^\pi$ in certain places. (NB: $2\sinh\pi=e^\pi-e^{-\pi}$.) – user170231 Jan 30 at 17:04
• @user170231 To compute the coefficients, I used the formula: $$a_n = \frac{2}{\pi} \int_{0}^{\pi} f(x) cos (nx)$$ and : $$b_n = \frac{2}{\pi} \int_{0}^{\pi} f(x) sin (nx)$$ Isn't it correct? – Zouhair El Yaagoubi Jan 30 at 17:18
• The formula I cited specifically works only for functions that are $2\pi$-periodic over the interval $(-\pi,\pi)$. There is a formula for $P$-periodic functions over the interval $(x_0,x_0+P)$ listed on the page I linked under the section "A more general definition" (Eq. 4) for the more general case. It suggests$$a_n=\frac2\pi\int_0^\pi f(x)\cos nx\,\mathrm dx$$works for a function $f(x)$ that is $\pi$-periodic over $(0,\pi)$. – user170231 Jan 30 at 18:33

With the correct coefficients (see comments), you have for $$x \in]-\pi,\pi[$$:

$$e^{-x} = \frac{2}{\pi} \sinh(\pi) + 2 \sinh(\pi) \sum_{n=1}^{\infty}\frac{ (-1)^n (n\sin (nx) + \cos(nx)) }{\pi(n^2 + 1)}$$

so

$$e^{x} + e^{-x} = \frac{4}{\pi} \sinh(\pi) + 4 \sinh(\pi) \sum_{n=1}^{\infty}\frac{ (-1)^n \cos(nx) }{\pi(n^2 + 1)}$$

Now we can evaluate this for $$x \to \pm\pi$$. To be more precise (see the answer by @kvantour), the evaluation $$x \to \pm\pi$$ corresponds to the average of the two values at $$\pm\pi$$ which is exactly what the Fourier series converges to at this point of discontinuity.

$$\cosh (\pm \pi) = \frac{2}{\pi} \sinh(\pi)+ 2 \sinh(\pi) \sum_{n=1}^{\infty}\frac{1 }{\pi(n^2 + 1)}$$

and in turn

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

Then the second question follows: $$\sum_{- \infty}^{+ \infty} \frac{1}{n^2 + 1} = 1 + 2 \sum_{1}^{+ \infty} \frac{1}{n^2 + 1} = \pi \coth(\pi) \simeq 1.0037 \; \pi$$

Comment: for comparison, $$\int_{- \infty}^{+ \infty} \frac{1}{x^2 + 1} {\rm{dx}} = \pi$$

• You cannot make the statement $x\rightarrow\pi$ and just know its value. $f(x)$ is discontinuous in that point. – kvantour Jan 31 at 11:52
• @kvantour Thank you. I have adressed that point and edited my answer accordingly. – Andreas Jan 31 at 15:13
• Good point. done. – Andreas Jan 31 at 15:25

When you state Using Fourier series, it does not necessarily mean that you have to use the Fourier Cosine and Sine series. You can also write it in exponential form:

Any periodic function $$\tilde{f}(t)$$ with period $$2\pi$$ can be written as:

$$f(t) = \sum_{n=-\infty}^\infty c_n\,e^{int}$$ with $$c_n=\frac{1}{2\pi}\int_{-\pi}^\pi \tilde f(t)\,e^{-int}\,\textrm{d}t$$ note: we make a distinction between the fourier series $$f(t)$$ and the periodic function $$\tilde f(t)$$ to indicate that they are different when $$\tilde f(t)$$ is discontiniuous.

When you apply this for $$\tilde f(t)$$, which is periodic over $$2\pi$$, discontinuous and defined in the region $$]-\pi,\pi[$$ as $$\exp(-t)$$, you obtain

$$c_n = \frac{\sinh(\pi)}\pi\cdot\frac{(-1)^n\,(1-in)}{1+n^2}$$

giving you:

$$f(t)=\frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{(-1)^n\,(1-in)}{1+n^2}\,e^{int}$$

You already notice the familiar part in the sum which is of interest, the problem is the $$(-1)^n$$. This we can get rid of with the proper choice of $$t$$. If $$t=\pm\pi$$ then $$\exp(\pm in\pi)=(-1)^n$$. But be advised $$f(t)$$ is periodic with a period of $$2\pi$$ and is not continuous in the points $$t=n\pi$$. The value the Fourier Series will return is:

$$f(\pi)=f(-\pi)= \frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{(1-in)}{1+n^2} = \frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{1}{1+n^2}$$

The latter reduction of the sum is straightforward as the imaginary part is zero.

But we cannot use this, as we do not know what $$f(\pi)$$ is since $$\tilde f(t)$$ is discontinuous at these points. Luckily, some smart people solved this conundrum and showed that at a discontinuity, the Fourier series converges to the average of the two values, i.e.

$$f(\pi)=f(-\pi)=\frac{\lim_{t\rightarrow\pi^-}\tilde f(t) + \lim_{t\rightarrow \pi^+}\tilde f(t)}{2} = \frac{\exp(-\pi)+\exp(\pi)}{2} = \cosh(\pi)$$

So in the end, we have the solution: $$f(\pi)=\cosh(\pi)=\frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{1}{1+n^2}$$ or

$$\bbox[5px,border:2px solid #00A000]{\pi \coth(\pi)=\sum_{n=-\infty}^\infty\frac{1}{1+n^2}=1+2\sum_{n=1}^\infty\frac{1}{1+n^2}}$$

remark: computing $$f(0)$$ gives directly, without any fuss:

$$\bbox[5px,border:2px solid #000000]{\frac{\pi}{\sinh(\pi)}=\sum_{n=-\infty}^\infty\frac{(-1)^n}{1+n^2}}$$

• I computed the sum using $f(0)$, but I will pay more attention to the points of discontinuity, so thank you so much for your additional important information. – Zouhair El Yaagoubi Jan 31 at 12:11

Try using Parseval's theorem,

$$\frac{1}{\pi}\int_{-\pi}^\pi |f(x)|^2 dx = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n^2+b_n^2$$

If it comes out too nasty, then I think your coeffecients might be off.

• I do not see how Parseval's theorem will give me the sum, can you elaborate more? Although, I have checked the coefficient well. They seem to be correct. – Zouhair El Yaagoubi Jan 30 at 16:12