Integrate: $$\int \:x\left(\frac{1-x^2}{1+x^2}\right)^2dx$$
My attempt:
$$\text{Let} \ u = x, v'=\left(\frac{1-x^2}{1+x^2}\right)^2\\$$ \begin{align} \int \:x\left(\frac{1-x^2}{1+x^2}\right)^2dx & = x\left(x-2\arctan \left(x\right)+\frac{2x}{1+x^2}\right)-\int \frac{3x+x^3-2\arctan \left(x\right)-2x^2\arctan \left(x\right)}{1+x^2}dx\\ & = x\left(x-2\arctan \left(x\right)+\frac{2x}{1+x^2}\right)-\left(\frac{1}{2}x^2-2x\arctan \left(x\right)+\ln \left|x^2+1\right|-2\ln \left|\frac{1}{\sqrt{x^2+1}}\right|+\frac{1}{2}\right)\\ & = \frac{1}{2}x^2+\frac{2x^2}{x^2+1}-\ln \left|x^2+1\right|+2\ln \left|\frac{1}{\sqrt{x^2+1}}\right|-\frac{1}{2}+C,C \in \mathbb{R} \end{align}
I left out the small details, otherwise this post would be quite long. I tried to do this with $u$-substitution but I'm not sure how I can do that here.
Let $x^2=t\implies xdx=\frac{dt}{2}$ $$\int x\left(\frac{1-x^2}{1+x^2}\right)^2dx=\int \left(\frac{1-t}{1+t}\right)^2\frac{dt}{2}$$ $$=\frac12\int \left(\frac{2}{1+t}-1\right)^2 dt$$ $$=\frac12\int \left(1+\frac{4}{(1+t)^2}-\frac{4}{1+t}\right) dt$$ $$=\frac12 \left(t-\frac{4}{1+t}-4\ln|1+t|\right)+C$$ $$=\frac{x^2}{2}-\frac{2}{1+x^2}-2\ln(1+x^2)+C$$