The Wicked Integral

My brother's friend gave me the following wicked integral with a beautiful result

\begin{equation} {\Large\int_0^\infty} \frac{dx}{\sqrt{x} \bigg[x^2+\left(1+2\sqrt{2}\right)x+1\bigg] \bigg[1-x+x^2-x^3+\cdots+x^{50}\bigg]}={\large\left(\sqrt{2}-1\right)\pi} \end{equation}

He claimed the above integral can be generalised to the following form \begin{equation} {\Large\int_0^\infty} \frac{dx}{\sqrt{x} \bigg[x^2+ax+1\bigg] \bigg[1-x+x^2-x^3+\cdots+(-x)^{n}\bigg]}=\ldots \end{equation} This is a challenging problem. How to prove it and what is the closed-form of the general integral?

• Is your brother's friend named Cleo? – Git Gud Oct 17 '14 at 18:00
• Let $x=-y$, then $1-x+x^2-x^3+\cdots+x^{50}=1+y+y^2+y^3+\cdots+y^{50}=\frac{1-y^{51}}{1-y}$ – mike Oct 17 '14 at 18:01
• Hint: 1) substitute $x$ by $1/x$ and combine the new integral with the old to get rid of the horrible factor at end 2) change variable to $u = \sqrt{x} - \frac{1}{\sqrt{x}}$. – achille hui Oct 17 '14 at 18:04
• It's a special case of the integral $$\int_{0}^{\infty} \frac{1}{\sqrt{x}} \left(\frac{x}{x^{2}+2ax+1} \right)^{r} \frac{x+1}{x(x^{s}+1)} \ dx = \frac{B(r - \frac{1}{2}, \frac{1}{2})}{2^{r-1/2} (1+a)^{r-1/2}} .$$ There is an entire chapter in the book Irresistible Integrals devoted to this integral. – Random Variable Oct 18 '14 at 3:37
• It's a good book, but not so good that I would necessarily recommend buying it. That paper covers the most interesting chapter in the book. – Random Variable Oct 19 '14 at 15:05

Indeed let $$I(n,a)=\int_0^\infty\frac{dx}{\sqrt{x}(1+ax+x^2)(\sum_{k=0}^n(-x)^k)}$$ The change of variables $x\leftarrow 1/x$ yields $$I(n,a)=\int_0^\infty\frac{(-1)^nx^{n+1}dx}{ \sqrt{x}(1+ax+x^2)(\sum_{k=0}^n(-x)^k)}$$ Thus $$2I(n,a)=\int_0^\infty\frac{1+x}{\sqrt{x}(1+ax+x^2)}dx= 2\int_0^\infty\frac{1+t^2}{ 1+at^2+t^4}dt$$ Or equivalently, setting $u=t-1/t$, $$I(n,a)= \int_{-\infty}^\infty\frac{du}{ 2+a+u^2} =\frac{\pi}{\sqrt{2+a}}.$$
• I think it is very unintuitive that this is independent of $n$. It would be nice if someone offered an intuitive explanation of that fact. – becko Oct 17 '14 at 22:09
• Nice answer. It's all true if $n \geq 0$ and $a > -2$. – user153012 Oct 17 '14 at 23:40