# How to solve $\int_0 ^1 \left( \frac{x^2}{1+x^2} \right)\frac{1-x\tan(x)+ \tan(x)-x}{1 -x\tan(x)-\tan(x)-x}dx$?

I saw this interesting problem:

$$\int_0 ^1 \left( \frac{x^2}{1+x^2} \right)\frac{1-x\tan(x)+ \tan(x)-x}{1 -x\tan(x)-\tan(x)-x}dx$$

I tied all the tricks that I know and non of them were useful at all after some thoughts I tried to graph the function to if there is some way I can use king's rule after some substitution to simplify the integral and the graph is very strange

So one of my friends tried to use wolfram alpha and it gave two different values!

This made is integral more strange and I don't know how it is possible that wolfram found two different values. I think it might be related to Riemann's rearrangement theorem.

• Have you checked for convergence? Commented Mar 2 at 4:49
• @BenjaminWang I couldn't prove either convergence or divergence and I think it is very difficult to prove.
– pie
Commented Mar 2 at 4:50
• This integral definitely diverges, because the pole occurs when $(1-x)(1+\tan x)=2\tan x$ which can be linearly approximated and doesn't share any roots with the numerator. This makes the pole $\sim x^{-1}$ Commented Mar 2 at 5:59
• @NinadMunshi Then what are those values that wolfram found ?
– pie
Commented Mar 2 at 6:30

The integral diverges at the singularity $$s=0.40262817\dots$$ which is the solution to $$x+\arctan x=\pi/4$$. The integral \begin{align}I=&\int \frac{x^2}{1+x^2}\left (\frac{1}{1-\tan(1+\arctan x)}-1\right)\\=&\int B(x)\frac{1}{1-\tan(1+\arctan x)}+C(x)\end{align} where both $$B,C$$ are bounded functions. Near the singularity $$s$$, $$B\neq 0$$ and $$\frac{1}{1-\tan(1+\arctan x)}=\frac D{x-s}+E(x)$$ with $$D=-\frac {s^2+1}{2s^2+4}\neq 0$$ and $$E$$ bounded. thus the integral diverges.

The integrand has the form

$$\frac{x^2}{1+x^2}\ \frac {(1-x)(1-\tan x)}{(1-x)-(1+x)\tan x}$$

It has a simple pole at

$$x=\frac{1-\tan x}{1+\tan x} = \frac{\cos x-\sin x}{\cos x+\sin x}$$

with $$x=0.4\dots$$ inside the interval of integration.

Setting $$\tan x = \frac{1-x-\epsilon}{1+x + \epsilon},$$

the expression not odd wrt to the singular point, so the definite integral makes no sense, not even as a principal value, because the weights of integration of the positive and negative parts on both sides of the pole are different.

Mathematica NIntegrate yields random values for different values of WorkingPrecision and complaints about lack of convergency.

  NIntegrate[ x^2/(1 +  x^2) ((1 - x) (1 - Tan[x]))/
((1 - x) - (1 + x) Tan[x]),
{x, 0,1}, WorkingPrecision -> #] & /@ {16, 32, 64} //
Quiet

{0.05450521388384730,
-0.041473061817256730764505273808547,
0.06152386453244370124428309681908080225858385539795037284604940271}