# Definite integals that can be expressed in terms of itself

I came across the integral $\int_0^\infty \frac{1}{\left(x^2+1\right) \left(x^{2015}+1\right)}\,dx$ in a Youtube video. It apparently appeared in the MIT Integration Bee of 2015.

In the video, it was shown how, by substituting $u = {1 \over x}$, we can express the integral in terms of itself, and rather elegantly arrive at its value $\pi \over 4$ through the solution of an equation $$\int_0^\infty \frac{1}{\left(x^2+1\right) \left(x^{2015}+1\right)}\,dx = \int_0^\infty \frac{1}{\left(x^2+1\right)}\,dx -\int_0^\infty \frac{1}{\left(x^2+1\right) \left(x^{2015}+1\right)}\,dx$$

In fact, as far as I see for any $k\in \mathbb{R}$ $$\int_0^\infty \frac{1}{\left(x^2+1\right) \left(x^k+1\right)}\,dx = {\pi \over 4}$$

However, when I tried this on Mathematica (ok, Wolfram Desktop actually) it bailed for the more general expression with $k$ and kept grinding away until aborted for $k = 2015$. It would quickly spit out the answer for small $k$ (such as 10) though.

This would churn away until aborted:

Integrate[1/((1 + x^2015)*(1 + x^2)), {x, 0, Infinity}]


This would quickly produce the correct answer:

Integrate[1/((1 + x^10)*(1 + x^2)), {x, 0, Infinity}]


This would quickly give up:

Assuming[Element[k, Integers] && k > 0,  Integrate[1/((1 + x^k)*(1 + x^2)), {x, 0, Infinity}]]


(In fact, I tried this out on Maxima, and that did pretty much the same thing too.)

Is this class of problems too 'rare' to be worth looking for a time efficient algorithm? (I can see that when $k$ is a positive integer, an anti-derivative probably always exists, but is likely a long expression when $k$ is large.)

Update: I have tried out NIntegrate, and that quickly returns 0.785398:

NIntegrate[1/((1 + x^2015)*(1 + x^2)), {x, 0, Infinity}]


I can, as suggested in a comment below, use RootApproximant to get to $\pi\over 4$:

RootApproximant[NIntegrate[1/((1 + x^2015)*(1 + x^2)), {x, 0, Infinity}]/Pi] * Pi


However, this kind of means I already know the answer beforehand, isn't it? Besides, it seems to me that a computer algebra system should get to this analytically rather than numerically.

• f[x_, k_] := 1/((1 + x^k)*(1 + x^2)); RootApproximant[NIntegrate[f[x, #], {x, 0, Infinity}]/Pi] Pi & /@ Range[500, 5000, 500] // Union evaluates to {Pi/4} – Bob Hanlon Feb 21 '18 at 16:07