TITLE: Compute $ I_{n}=\int_{-\infty}^\infty \frac{1-\cos x \cos 2x \cdots \cos nx}{x^2}\,dx$
QUESTION [25 upvotes]: I'm very curious about the ways I may compute the following integral. I'd be very glad to know your approaching ways for this integral:
$$
I_{n} \equiv
\int_{-\infty}^\infty
{1-\cos\left(x\right)\cos\left(2x\right)\ldots\cos\left(nx\right) \over x^{2}}
\,{\rm d}x
$$
According to W|A, $I_1=\pi$, $I_2=2\pi$, $I_3=3\pi$, and one may be tempted to think that it's about an arithmetical progression here, but things change (unfortunately) from $I_4$ that is $\frac{9 \pi}{2}$. This problem
came to my mind when I was working on a different problem.

REPLY [4 votes]: I thought it would be worth mentioning that $$\int_{-\infty}^{\infty} \frac{1-\prod_{k=1}^{n}\cos (a_{k}x)}{x^{2}} = \pi a_{n} \tag{1}$$ if the $a_{k}$'s are positive parameters and $a_{n} \ge \sum_{k=1}^{n-1} a_{k}. $
This integral is somewhat similar to the Borwein integral.
We can show $(1)$ by integrating the function $$f(z) = \frac{1-e^{ia_{n}z}\prod_{k=1}^{n-1}\cos(a_{k}z)}{z^{2}}$$ around an indented contour that consists of the real axis and the semicircle above it.
If $a_{n} \ge \sum_{k=1}^{n-1} a_{k}$, then $$1-e^{ia_{n}z}\prod_{k=1}^{n-1}\cos(a_{k}z) = 1- e^{ia_{n}x}\prod_{k=1}^{n-1}\frac{e^{ia_{k}z}-e^{-ia_{k}z}}{2} $$ is bounded in the upper half-plane. (If you expand, all of the exponentials are of the form $e^{ibz}$, where $b\ge 0$.)
So integrating around the contour, we get $$\operatorname{PV} \int_{-\infty}^{\infty} f(x) \, dx - i \pi \operatorname{Res} [f(z), 0] = 0, $$ where $$ \begin{align}\operatorname{Res}[f(z),0] &= \lim_{z \to 0} \frac{1-e^{ia_{n}z}\prod_{k=1}^{n-1}\cos(a_{k}z)}{z} \\ &= \lim_{z \to 0} \left(-ia_{n}e^{ia_{n}z}\prod_{k=1}^{n-1}\cos(a_{k}z)+e^{ia_{n}z} \sum_{k=1}^{n-1} a_{k} \sin(a_{k}z) \prod_{\underset{j \ne k}{j =1}}^{n-1} \cos(a_{j}z)\right) \\ &= -i a_{n}. \end{align}$$
The result follows by equating the real parts on both sides of the equation.