Integrating a Rational Function I am studying for a test and I am trying to evauate the integral below. I know how to simplify it with partial fractions, but when I try to solve it, I cannot seem to find a substitution that will simplify it enough to solve in reasonably quick . I plugged it into wolfram and as usual it doesn't give a quick way either. If anybody has a way this integral can be solved quickly, as there will be a time crunch on my test. 
$$\int\frac{x^3+x+2}{x^4+2x^2+1}dx$$
 A: Try rewriting your integral like this:
$\int \frac{x(x^2+1)+2}{(x^2+1)^2} dx$
A: From partial fractions and two variable substitutions
$$\begin{align}
\int \frac{x^3+x+2}{x^4+2x^2+1}dx &= \int\frac{x}{x^2+1}dx + 2\int\frac{1}{x^2+1}\frac{1}{x^2+1}dx \\
&= \frac{1}{2}\int\frac{du}{u}+\int\frac{1}{(\tan v)^2+1}dv
\end{align}$$
where $u=x^2+1$ and $v=\arctan x$ (recall that $\frac{d}{dx}\arctan x = \frac{1}{1+x^2} $).  Now since $\tan^2v+1 = \sec^2 v = 1/\cos^2 v$,
$$\begin{align}
\int \frac{x^3+x+2}{x^4+2x^2+1}dx &= \frac{\ln u}{2} + 2\int \cos^2(v)\, dv \\
&= \frac{\ln u}{2}+2\left(\frac{\sin v \cos v}{2} +\frac{v}{2}\right) \\
&= \frac{\ln \left(x^2+1\right)}{2}+\sin \left(\arctan x\right) \cos \left(\arctan x\right) +\arctan x \\
&= \frac{1}{2}\ln \left(x^2+1\right) + \frac{x}{x^2+1} + \arctan x
\end{align}$$
Hope this helps.
A: I think the integral can be solved in a very easy way.
$$
\begin{align}
\int\frac{x^3+x+2}{x^4+2x^2+1}dx&=\int\frac{x^3+x}{x^4+2x^2+1}dx+\int\frac{2}{x^4+2x^2+1}dx\\
&=\int\frac{x^3+x}{x^4+2x^2+1}dx+\int\frac{2}{(x^2+1)^2}dx.
\end{align}
$$
In the RHS part, for the left integral uses substitution $u=x^4+2x^2+1\;\Rightarrow\;du=4(x^3+x)\,dx$ and for the right integral uses substitution $x=\tan\theta\;\Rightarrow\;dx=\sec^2\theta\;d\theta$. Therefore
$$
\begin{align}
\int\frac{x^3+x+2}{x^4+2x^2+1}dx&=\int\frac{1}{4u}du+\int\frac{2\sec^2\theta}{(\tan^2\theta+1)^2}d\theta\\
&=\frac{1}{4}\ln\,|u|+\text{C}+2\int\frac{\sec^2\theta}{\sec^4\theta}d\theta\\
&=\frac{1}{4}\ln\,\left|x^4+2x^2+1\right|+2\int\cos^2\theta\;d\theta+\text{C}.
\end{align}
$$
The rest should be easy to be solved. Just make sure you make appropriate limit for the integral when use substitution method.

$$\text{# }\mathbb{Q.E.D.}\text{ #}$$
