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  

$$\int \frac{1}{(x^2+1)^2}dx$$
Apply Trig Substitution: $x=tan(u)$
Then differentiate with respect to 'x' on both sides, then we get $dx=sec^2(u)du$
$$=\int \frac{1}{cos^2(u)(tan^2(u)+1)^2}du$$
Using the identity: $tan^2(x)=-1+sec^2(x)$
$$=\int \frac{1}{(1-1+sec^2(u))^2 cos^2(u)}du$$
Notice that $$\frac{1}{(1-1+sec^2(u))^2 cos^2(u)}=\frac{1}{sec^4(u)cos^2(u)}$$
$$=\int \frac{1}{sec^4(u)cos^2(u)}du$$
$$=\int cos^2(u)du$$
Using the identity: $cos^2(x)=\frac{1+cos(2x)}{2}$
$$=\int \frac{1+cos(2u)}{2}du$$
$$=\frac12 \int 1+cos(2u)du$$
$$=\frac12(\int 1du+\int cos(2u)du)$$
$$=\frac12(u+\frac{1}{2}sin(2u))$$
After substituting back $u=arctan(x)$
$$\int \frac{1}{(x^2+1)^2}dx=\frac12(arctan(x)+\frac{1}{2} sin(2arctan(x)))+C$$
