<s>[INST] $\int \frac{x^{2} \arctan x}{1+x^{2}}dx$ So I have the integral
$$\int \frac{x^{2} \arctan x}{1+x^{2}}dx$$
how can I solve this integral without substituting $u=\arctan x$? 
Because I think that if I do this, lets suppose that in the end I'll have as a solution $\tan u + \cos u$ when I replace $u$, it will look strange.
 [/INST] Since
$$\int\frac{x^2}{1+x^2}dx=\int\left(1-\frac{1}{1+x^2}\right)dx=x-\arctan x+C$$
$$\int\frac{\arctan x}{1+x^2}dx=\int\arctan x\,\,d(\arctan x)=\frac{\arctan^2x}{2}+K$$
Thus, integrating by parts:
$$\begin{align*}u=\arctan x&;\;\;u'=\frac{1}{1+x^2}\\{}\\v'=\frac{x^2}{1+x^2}&;\;\;v=x-\arctan x\end{align*}$$
so
$$\int\frac{x^2\arctan^2 x}{1+x^2}dx=x\arctan x-\arctan^2x-\int \frac{x}{x^2+1}dx+\int\frac{\arctan x}{1+x^2}dx\,dx=$$
$$=x\arctan x-\frac{\arctan^2x}{2}-\frac{1}{2}\log(1+x^2)+C$$
</s>