Evaluating $\int_{-\infty}^\infty\frac1{1+x^2+x^4+\cdots}\ \text{dx}$

Define $$f_k(x) = \left(\sum_{n=0}^{k-1} x^{2n}\right)^{\!-1} = \begin{cases} \frac{1-x^2}{1-x^{2k}}, & |x| \ne 1 \\ \frac{1}{k}, & |x| = 1. \end{cases}$$ Consequently, we have $$\lim_{k \to \infty} f_k(x) = \begin{cases} 0, & |x| \ge 1 \\ 1-x^2, & |x| < 1. \end{cases}$$ If we can justify interchanging the limit with the integral, we immediately obtain $$\lim_{k \to \infty} \int_{x=-\infty}^\infty f_k(x) \, dx = \int_{x=-1}^1 1-x^2 \, dx = \frac{4}{3}.$$ Making this a formal argument, however, requires a little more justification than what is provided here.


A little animation that might be of interest: enter image description here


This is a bit overkill for solving the question at hand, but for completness I'll add an answer for how one can evaluate the integral for a general value of $n$ using residue calculus giving us the result

$$\int_{-\infty}^\infty\frac{{\rm d}x}{1+x^2+\ldots+x^{2n}} = \frac{2\pi}{n+1}\frac{\cos\left(\frac{\pi}{2n+2}\right)}{\sin\left(\frac{3\pi }{2 n+2}\right)}\tag{1}$$

Taking the limit $n\to\infty$ in $(1)$ we get $\frac{4}{3}$, but this can of course be found by simpler methods as pointed to in the other answers.


By summing the geometrical series in the denominator we get

$$\int_{-\infty}^\infty\frac{{\rm d}x}{1+x^2+\ldots+x^{2n}} = \int_{-\infty}^\infty \frac{x^2-1}{x^{2n+2}-1}{\rm d}x$$

We now integrate the function $f(z) = \frac{z^2-1}{z^{2n+2}-1}$ around a semi-circle contour of radius $R$ in the upper half-plane. By the residue theorem we have

$$\oint f(z)\,{\rm d}z = \int_{-R}^R\frac{x^2-1}{x^{2n+2}-1}{\rm d}x + \int_{\rm semi-circle} \frac{z^2-1}{z^{2n+2}-1}{\rm d}z = 2\pi i \sum \text{Res}[f(z);z_k]$$

where $z_k$ are the poles of $f$ inside the contour. For $R>1$ these are given by the zeros of $z^{2n+2}-1$ in the upper half-plane (the singularities at $z=\pm 1$ are removable) so $z_k = e^{\frac{2\pi i}{2n+2} k}$ for $k=1,2,\ldots,n$. Since the poles of $f$ are simple the residues of $f$ are given by $$\text{Res}[f(z);z_k] = \frac{z_k^2-1}{\frac{d}{dz}(z^{2n+2}-1)_{z=z_k}} = \frac{z_k^2-1}{(2n+2)z_k^{2n+1}} = \frac{1}{2n+2}(z_k^3 - z_k)$$ where we have used $z_k^{2n+2} = 1$ to simplify. Taking $R\to \infty$ we find that the contribution from the semi-circle vanishes by a standard $M-L$ estimate since $|f(z)| \leq \frac{R^2}{R^{2n+2}-1} \sim \frac{1}{R^{2n}}$ and $\lim_{R\to\infty}\pi R \cdot \frac{1}{R^{2n}} = 0$ for all $n\geq 1$. This leads to

$$\int_{-\infty}^\infty\frac{z^2-1}{z^{2n+2}-1}{\rm d}z = \frac{2\pi i}{2n+2}\sum_{k=1}^n e^{3\frac{2\pi i}{2n+2} k} - e^{\frac{2\pi i}{2n+2} k} \\= \frac{2\pi i}{2n+2}\left(\frac{1+e^{\frac{3 i \pi }{n+1}}}{1-e^{\frac{3 i \pi }{n+1}}} - \frac{1+e^{\frac{i \pi }{n+1}}}{1-e^{\frac{i \pi }{n+1}}}\right) = \frac{2\pi}{n+1}\frac{\cos\left(\frac{\pi}{2n+2}\right)}{\sin\left(\frac{3\pi }{2 n+2}\right)}$$ where the sum above is another two geometrical series and I used Euler's formula to simplify the result.


As Simple Art suggested in the comments, we proceed by observing that the denominator is a geometric series. Consider

$$\lim_{k\to\infty}1+x^2+\cdots+x^{2k}\text{.}$$

This clearly diverges for any $|x|\geq 1$. The ratio between consecutive terms is $x^2$, so the infinite sum is simply

$$\frac{1}{1-r}=\frac{1}{1-x^2}\text{.}$$

We thus are effectively evaluating

$$\int_{-1}^{1}1-x^2\text{ }dx$$

(The bounds are set so that the geometric series is defined.) This is simply $\frac{4}{3}$, and there is your limit.

Formalizing this argument rigorously, however, is left to you.