<s>[INST] How to calculate $\int \frac{x^2 }{(x^2+1)^2} dx$? I'm trying  to calculate $\int \frac{x^2 }{(x^2+1)^2} dx$ by using the formula:
$$ \int udv = uv -\int vdu $$
I supposed that $u=x$ s.t $du=dx$, and also that $dv=\frac{x}{(x^2+1)^2}dx$, but I couldn't calculate the last integral. what is the tick here? 


the answer must be: $ \frac{1}{2}arctan\ x - \frac{x}{2(1+x^2)} $ + C 


 [/INST] $$\int\dfrac{x^2}{(x^2+1)^2}dx$$
$$=x\int\dfrac x{(x^2+1)^2}dx-\int\left[\frac{dx}{dx}\cdot\int\dfrac x{(x^2+1)^2}dx\right]dx$$
$$=x\cdot\frac{-1}{1+x^2}+\int\dfrac{dx}{1+x^2}=\cdots$$
</s>