<s>[INST] Can you solve $\int 1/(x^2+1)^2\, dx$ I know that the integral looks like like the anti-derivative of $\arctan$, but i don't know how to use this fact so I tried to use a fraction decomposition to: $$\frac{1}{(x^2+1)^2}$$
to solve the anti-derivative : $$\int \frac{1}{(x^2+1)^2}\, dx$$
so :$$\frac{1}{(x^2+1)^2}=\frac{A}{x^2+1}+\frac{B}{x^2+1}\iff \frac{1}{x^2+1}=A+B$$
$$1+0x^2=(A+B)x^2+(A+B)1$$
Thus I got this system of equations:
$$\cases{A+B=1 \\ A+B=0}$$ Which is impossible. I also tried to use substitution but it didn't help me.
 [/INST] If we use the substitution $x = \tan \theta$, $dx = \sec^2 \theta \,d\theta$, the integral becomes \begin{align*}
\int \frac{1}{(x^2+1)^2}\, dx &= \int \frac{\sec^2 \theta}{(\tan^2\theta + 1)^2}\,d\theta\\
&= \int \frac{\sec^2\theta}{\sec^4 \theta}\,d\theta\\
&= \int\cos^2\theta \,d\theta\\
&= \frac{1}{2}(\theta + \sin\theta\cos\theta) + C.
\end{align*}  I will leave that last integral to you, but we can use the double angle formula for cosine.  So, we just need to undo the substitution.  Given that $x = \tan\theta$, we can conclude that $\theta = \arctan x$ and  $$\sin\theta = \frac{x}{\sqrt{1+x^2}}\quad\text{and}\quad \cos\theta = \frac{1}{\sqrt{1+x^2}}.$$
This follows from the fact that $$x^2 + 1 = \tan^2\theta + 1 = \sec^2\theta \implies \cos^2\theta = \frac{1}{1+x^2}.$$
This gives us
$$\int \frac{1}{(x^2+1)^2}\, dx = \frac{1}{2}(\theta + \sin\theta\cos\theta) +C= \frac{1}{2}\left(\arctan x + \frac{x}{1+x^2}\right) +C.$$
</s>