integrate square of $\arctan x$. Tricky

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

I ran across an integral I am having a time solving. The solution merely works out to $\displaystyle\frac{1+x\tan^{-1}x}{\tan^{-1}x-x}$, but for the life of me I can not find a suitable method to tackle it.

Does anyone have any hints on a good strategy, substitution, parts, etc?. Thanks much.


Solution 1:

With $x = \tan(u)$, $\mathrm{d}x = \frac{1}{\cos^2(u)}\mathrm{d} u$, thus $$ \int \left(\frac{\tan^{-1}x}{x-\tan^{-1}x}\right)^{2} \mathrm{d}x = \int \left( \frac{u}{\tan(u) - u} \cdot \frac{1}{\cos(u)} \right)^2 \mathrm{d} u = \int \left( \frac{u}{\sin(u) - u \cdot \cos(u)} \right)^2 \mathrm{d} u $$ Now, observe that $$ \mathrm{d} \left( \frac{1}{\sin(u)-u \cos(u)} \right) = \frac{-u \sin(u) \mathrm{d} u }{(\sin(u)-u \cos(u))^2} $$ This allows to integrate by parts: $$ \begin{eqnarray} I &=& \int \left( \frac{u}{\sin(u) - u \cdot \cos(u)} \right)^2 \mathrm{d} u = \int \left( -\frac{u}{\sin(u)} \right) \mathrm{d}\left( \frac{1}{\sin(u)-u \cos(u)} \right) \\ &=& -\frac{u}{\sin(u)\left(\sin(u)-u \cos(u) \right)} + \int \frac{1}{\sin(u)-u \cos(u)} \mathrm{d} \left( \frac{u}{\sin(u)} \right) \\ &=& -\frac{u}{\sin(u)\left(\sin(u)-u \cos(u) \right)} + \int \frac{\mathrm{d}u}{\sin^2(u)} \\ &=& -\frac{u}{\sin(u)\left(\sin(u)-u \cos(u) \right)} - \frac{1}{\tan(u)} + C \\ &=& -\frac{\arctan(x)}{\frac{x}{\sqrt{1+x^2}} \left(\frac{x}{\sqrt{1+x^2}} -\arctan(x) \cdot \frac{1}{\sqrt{1+x^2}} \right)} - \frac{1}{x} + C \\ &=& -\frac{1}{x} \left( 1+ \frac{(1+x^2) \arctan(x) }{x - \arctan(x)}\right) + C = -\frac{ 1 + x \arctan(x) }{x - \arctan(x)} + C \end{eqnarray} $$

Solution 2:

The denominator suggests that maybe an integration by parts will help where $v=\frac{1}{x-\arctan x}$. This may make for a strange looking $dv$ that is not readily apparent from the given integral.

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

So let's try $dv=\frac{-\frac{x^2}{1+x^2}}{(x-\arctan x)^2}$ and $u =-\arctan^2x\frac{1+x^2}{x^2}$. Note that $u = -\left(\frac{1}{x^2}+1\right)\arctan^2 x$.

Computing $du$, we have \begin{align} du &=\left[-\left(\frac{1}{x^2}+1\right)\frac{2\arctan x}{1+x^2}+\frac{2\ \arctan^2x}{x^3}\right]dx\\ &=\frac{2\arctan x}{x^3}\left(\arctan x-x\right)\ dx\end{align}

Applying the integration by parts formula $\int u\,dv=uv-\int v\,du$, the given intergal is equal to $$-\left(\frac{1}{x^2}+1\right)\arctan^2 x\frac{1}{x-\arctan x}+\int\frac{2\arctan x}{x^3}\,dx$$

The new integral can be handled with another integration by parts where $u$ is $\arctan x$ and $dv$ is $2x^{-3}$. That will leave you with a rational function in $x$, which can be integrated using partial fraction decomposition. Once all of the integration is complete, the terms should add together to give what you know the antiderivative to be (perhaps with a constant difference). These next steps are "ugly" details, but follow the description above. We have \begin{align}&-\frac{\left(\frac{1}{x^2}+1\right)\arctan^2 x}{x-\arctan x}-\frac{\arctan x}{x^2}+\int\frac{1}{x^2(1+x^2)}\ dx\\ =&-\frac{\left(\frac{1}{x^2}+1\right)\arctan^2 x}{x-\arctan x}-\frac{\arctan x}{x^2}+\int\frac{1}{x^2}\ dx-\int\frac{1}{x^2+1}\ dx\\ =&-\frac{\left(\frac{1}{x^2}+1\right)\arctan^2 x}{x-\arctan x}-\frac{\arctan x}{x^2}-\frac{1}{x}-\arctan x+C\\ =&\frac{1+x\arctan x}{x^2(x-\arctan x)}-\frac{\arctan x(x-\arctan x)}{x^2(x-\arctan x)}\\&-\frac{x(x-\arctan x)}{x^2(x-\arctan x)}-\frac{x^2(x-\arctan x)\arctan x}{x^2(x-\arctan x)}+C\\ \\ =&-\frac{\left(1+x^2\right)\arctan^2 x}{x^2(x-\arctan x)}-\frac{\arctan x(x-\arctan x)}{x^2(x-\arctan x)}\\&-\frac{x(x-\arctan x)}{x^2(x-\arctan x)}-\frac{x^2(x-\arctan x)\arctan x}{x^2(x-\arctan x)}+C\\ \\ =&\frac{-x^2-x^3\arctan x}{x^2(x-\arctan x)}+C\\ =&-\frac{1+x\arctan x}{(x-\arctan x)}+C\\ \end{align}