I was wondering how you integrate $\arctan^2(x)$.
I tried doing it by parts and allowing $u=\arctan(x)$ and $\frac{\mathrm dv}{\mathrm dx}=\arctan(x)$. But from then it becomes complicated, I was wondering if there was alternative method, or different way of approaching the question.
Thank you.
Well, we get that
$$\small\begin{align*} \int\arctan^2(x)\mathrm dx&=x\arctan^2(x)-\int\frac{2x}{1+x^2}\arctan(x)\mathrm dx\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)+\int\frac{\log(1+x^2)}{1+x^2}\mathrm dx\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)+\int\log(1+\tan^2(u))\mathrm du\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)-2\int\log(\cos(u))\mathrm du\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)-2\left[\frac12\operatorname{Cl}_2(\pi-2u)-u\log(2)\right]\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)-\operatorname{Cl}_2(\pi-2\arctan(x))+2\arctan(x)\log(2)\\ &=x\arctan^2(x)-\log(1+x^2)\arctan(x)-\Im\operatorname{Li}_2\left(e^{i(\pi-2\arctan(x))}\right)+2\arctan(x)\log(2) \end{align*}$$
Here $\operatorname{Cl_2}(z)$ denotes the Clausen Function and $\operatorname{Li}_2(z)$ the Dilogarithm, or Spence's Function. Recalling the integral representation of the Clausen Function one can verify the result by direct differentation using the Fundamental Theorem of Calculus and the chain rule. The last simplification step is trivial as one can see by examining the series representations of $\operatorname{Li}_2(e^{i\theta})$ and $\operatorname{Cl}_2(\theta)$ and is only here to reexpress the auxiliary function, i.e. the Clausen Function, in terms of the more common Dilogarithm. It was nothing more used then Integration By Parts and a suitable substitution combined with the knowledge about the utilized special functions.