Evaulating the trigonometric integral $\int \frac{1}{(x^2+1)^2} \, dx$ Problem:
Evaluate the following integral:
\begin{eqnarray*}
\int \frac{1}{(x^2+1)^2} \, dx \\
\end{eqnarray*}
Answer:
To do this, I let $x = \tan u$. Now we have $dx = \sec^2 u du$.
\begin{eqnarray*} \int \frac{1}{(x^2+1)^2}  \, dx &=& \int \frac{\sec^2{u} \, du}{(\tan^2{u} + 1)^2} \\
\int \frac{1}{(x^2+1)^2}  \, dx &=& \int \frac{1}{\sec^2{u}} \, du
 = \int \cos^2{u} \, du \\
\int \frac{1}{(x^2+1)^2}  \, dx &=& \int \frac{\cos{(2u)} + 1}{2} \, du 
 = \frac{\sin(u)}{4} + \frac{u}{2} \\
\int \frac{1}{(x^2+1)^2}  \, dx &=& \frac{\sqrt{1 - \cos^2{u}}}{4} + \frac{u}{2} \\
\end{eqnarray*}
Now, I think I am right so far but I do not know have to get rid of the $u$ in
the $\cos^2(u)$ term. Please help.
Thanks
Bob  

$$
\begin{aligned}
\int \frac{1}{\left(x^{2}+1\right)^{2}} d x &=-\frac{1}{2} \int \frac{1}{x} d\left(\frac{1}{x^{2}+1}\right) \\
& \stackrel{IBP}{=} -\frac{1}{2 x\left(x^{2}+1\right)}-\frac{1}{2} \int \frac{1}{x^{2}\left(x^{2}+1\right)} d x \\
&=-\frac{1}{2 x\left(x^{2}+1\right)}-\frac{1}{2} \int\left(\frac{1}{x^{2}}-\frac{1}{x^{2}+1}\right) d x \\
&=-\frac{1}{2 x\left(x^{2}+1\right)}+\frac{1}{2 x}+\frac{1}{2} \arctan x+C \\
&=\frac{x}{2\left(x^{2}+1\right)}+\frac{1}{2} \arctan x+C
\end{aligned}
$$
