<s>[INST] Indefinite integral through factorization So I have
$$\int \frac{1}{(x^2+1)^2}dx$$
And the professor does some magic

I'm confused. what's with the derivative?
I solved the integral via substitution but I'm curious how this works, so I can learn it
thanks! 
 [/INST] It is possible to shorten this magic as follows
\begin{eqnarray*} \int \frac{1}{(x^2+1)^2}dx
& = & \int \frac{1+x^2 - x^2}{(x^2+1)^2}dx \\
& = & \int \frac{1}{x^2+1}dx - \frac{1}{2}\int x\frac{2x}{(x^2+1)^2}dx \\
& = & \arctan x - \frac{1}{2}\left(- \frac{x}{x^2+1} + \int \frac{1}{x^2+1}dx\right) \\
& = & \arctan x + \frac{1}{2}\frac{x}{x^2+1} - \frac{1}{2}\arctan x \;(+C) \\
& = & \frac{1}{2}\left(\arctan x + \frac{x}{x^2+1}\right) \;(+C) \\
\end{eqnarray*}
</s>