Some method to solve $\int \frac{1}{\left(1+x^2\right)^{2}} dx$ and some doubts. First approach.
$\int \frac{1}{1+x^2} dx=\frac{x}{1+x^2}+2\int \frac{x^2}{\left(1+x^2\right)^2} dx=\frac{x}{1+x^2}+2\int \frac{1}{1+x^2}dx-2\int \frac{1}{\left(1+x^2\right)^2}dx$ 
From this relationship, I get:
$2\int \frac{1}{\left(1+x^2\right)^2}dx=\frac{x}{1+x^2}+\int \frac{1}{1+x^2}dx$ Then:
$\int \frac{1}{\left(1+x^2\right)^2}dx=\frac{1}{2}\left[\frac{x}{1+x^2}+\arctan x\right]+C$ This is a recursive solution.
Second approach.
$x=\tan t$ in $t\in (- \pi/2, \pi/2)$, i.e. $t=\arctan x$, then $dx=(1+x^2) dt$.
$\int \frac{1}{\left(1+x^2\right)^2}dx=\int \frac{1}{1+x^2}dt=\int \frac{\cos^2t}{\sin^2t+\cos^2t}dt=\int \cos^2t dt=\frac{1}{2}\int \left(1+\cos 2t \right) dt=\frac{t}{2}+\frac{1}{4}\sin 2t$
This result can be rewritten (using trigonometric formulas):
$\frac{t}{2}+\frac{1}{4}\sin 2t=\frac{t}{2}+\frac{1}{2}\sin t \cos t$
From $\cos^2 t=\frac{1}{1+x^2}$, I have:
$|\cos t|=\sqrt{\frac{1}{1+x^2}}$ but in $t\in (- \pi/2, \pi/2)$, $|\cos t|=\cos t$. So:
$\cos t=\sqrt{\frac{1}{1+x^2}}$. Now I have a problem: $|\sin t|=\sqrt{\frac{1}{1+x^2}}$, but $|\sin t|\neq \sin t$ for $t\in (- \pi/2, \pi/2)$. Any suggestions, please? This integral can be solved in other ways?
Thanks.
 A: One way to make the trigonometric solution substitution solution end nicely, without worries about signs, is to note that 
$$\sin t \cos t =\frac{\sin t}{\cos t} \cos^2 t.$$
Since $\cos^2 t=\frac{1}{\sec^2 t}=\frac{1}{1+\tan^2 t}$, we get that
$$\sin t \cos t =\tan t\frac{1}{1+\tan^2 t}=\frac{x}{1+x^2}.$$
Another way: The following is closer to your calculation. Use the fact that $\sin t\cos t$ has the same sign as $\tan t$ to resolve ambiguities of sign. We know from your calculation that $\sin t \cos t =\pm \frac{x}{1+x^2}$. But this has the same sign as $\tan t$, that is, the same sign as $x$. That resolves the $\pm$ problem in favour of $\frac{x}{1+x^2}$, which has the same sign as $x$.
A: This integral can be evaluated in that way too as shown below :
$$\int \frac{1}{a^2+x^2} dx=\frac{1}{a} \arctan  \frac{x}{a} +c(a)   $$
$$\frac {d}{da} (\int \frac{1}{a^2+x^2} dx)= \frac {d}{da}(\frac{1}{a} \arctan  \frac{x}{a} +c(a) )  $$
$$\int \frac{-2a}{(a^2+x^2)^2} dx= \frac{-1}{a^2} \arctan  \frac{x}{a} + \frac{1}{a}  \frac{-x/a^2}{(1+x^2/a^2)}+c_1(a) )  $$
for $a=1$
$$-2\int \frac{1}{(1+x^2)^2} dx= - \arctan  x +  \frac{-x}{(1+x^2)}+c_1(1)  $$
$$\int \frac{1}{(1+x^2)^2} dx= \frac{1}{2}  \arctan  x +  \frac{x}{2(1+x^2)}+k  $$
A: If we use this identity $\sin(2t)=\frac{2\tan(t)}{1+\tan^2(t)}$, the confusion should not arise.
