<s>[INST] Integrate squared trigonometric function I'm trying to integrate $\int_a^b \left( \frac{1}{1+x^2}  \right)^2 dx$
I know that $\frac{d}{dx} \arctan(x) = \frac{1}{1+x^2}$, but how can I integrate with the squared part?
I've tried substitution with no success.
 [/INST] Hint. Note that
$$\left( \frac{1}{1+x^2}  \right)^2 = \frac{1-x^2+x^2}{(1+x^2)^2}= \frac{1}{1+x^2}  -\frac{x^2}{(1+x^2)^2}=\frac{1}{1+x^2}  +\frac{x}{2}\left(\frac{1}{1+x^2}\right)'.$$
then integrate by parts the last term.
</s>