<s>[INST] How to integrate $(x^2 - 1)/(x^2 + 1)$? I have gone until separating $(x^2 - 1)/(x^2 + 1)$ into $x^2/(x^2 + 1)$ - $1/(x^2 + 1)$. The latter fraction I can substitute by $\tan u$, but how to solve the first fraction and how does it all come together?
 [/INST] $$ \int \frac{x^2 -1}{x^2 + 1} dx = \int \frac{x^2 +1 - 1 - 1}{x^2+1}dx = \int dx - 2 \int\frac{dx}{x^2+1} = x - 2 \arctan x + C $$
</s>