# Find the indefinite integral $\int \left(\frac{\arctan x}{\arctan x - x}\right)^2 dx$.

I am wondering if there is a systematic way to find the indefinite integral

$$\int \left(\frac{\arctan x}{\arctan x - x}\right)^2 dx.$$

It indeed has a clean closed form $$\frac{x^2 + 1}{\arctan x - x} + x.$$

But I am not able to reach it in a logical way. The transformation $t = \arctan x$ doesn't seem to help much.

• Maybe transforming $\frac{\arctan x }{\arctan x - x}$ to $1+\frac{x}{\arctan x - x}$ might help? – ultrainstinct Jan 22 '18 at 1:27

The integrand is $$\left(1+\frac{x}{\arctan x - x}\right)^2 = 1 + \frac{2x}{\arctan x - x} + \frac{x^2}{(\arctan x - x)^2}$$

Observe that $$(\arctan x - x)' = \frac{1}{x^2+1} - 1 = -\frac{x^2}{x^2+1}$$

So we can perform IBP on the last term

$$\int (x^2+1)\left(\frac{1}{(\arctan x - x)^2}\frac{x^2}{x^2+1}\right)dx = \frac{x^2+1}{\arctan x - x} - \int\frac{2x}{(\arctan x - x)^2} dx$$

Thus $$\int \frac{x^2}{(\arctan x - x)^2}dx + \int\frac{2x}{(\arctan x - x)^2} dx = \frac{x^2 + 1}{\arctan x - x}$$

The rest is obvious.

To find the indefinite integral I will make use of the so-called reverse quotient rule (For another example using this method see here).

Recall that if $u$ and $v$ are differentiable functions, from the quotient rule $$\left (\frac{u}{v} \right )' = \frac{u' v - v' u}{v^2},$$ it is immediate that $$\int \frac{u' v - v' u}{v^2} \, dx = \int \left (\frac{u}{v} \right )' \, dx = \frac{u}{v} + C. \tag1$$

Writing the integral as $$I = \int \left (\frac{\arctan (x)}{\arctan (x) - x} \right )^2 \, dx = \int \frac{\arctan^2 (x)}{(\arctan (x) - x)^2} \, dx,$$ we see that $v = \arctan (x) - x$. So $v' = -x^2/(1 + x^2)$. Now for the hard bit. We need to find a function $u(x)$ such that $$u' v - v' u = u'(\arctan (x) - x) + u \frac{x^2}{1 + x^2} = \arctan^2 (x).$$ After a little trial and error we find that if $$u = x\arctan (x) + 1,$$ as $$u' = \arctan (x) + \frac{x}{1 + x^2},$$ then $$u' v - v' u = \arctan^2 (x),$$ as required.

Our integral can now be readily found as it can be rewritten in the form given by (1). The result is: $$I = \int \left (\frac{x \arctan (x) + 1}{\arctan (x) - x} \right )' \, dx = \frac{x \arctan (x) + 1}{\arctan (x) - x} + C.$$

• Nice answer. It would be better if you showed me the deduction way of how to get the form of $u$, i.e., how to solve the differential equation involving $u$, with the difficulty less than solving the original problem. – Zhanxiong Jan 22 '18 at 2:56
• @Zhanxiong - As I said in my answer, this is the hard bit. It requires a little bit of trial and error to see what works and is always one of the problems associated with trying to use the reverse quotient rule to find an integral. Sometimes the method may be easy to apply where the function $u(x)$ can be more or less immediately found by inspection but in this particular case, as I said, it involved a bit of trail and error. Perhaps there is an alternative method for finding this particular integral that is more "obvious" but I have so far been unable to find one. – omegadot Jan 22 '18 at 3:01
• thanks, let's wait for a little more to see if there are other solutions. – Zhanxiong Jan 22 '18 at 3:43