TITLE: Integrating a Rational Function
QUESTION [6 upvotes]: 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$$

REPLY [4 votes]: 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{ #}$$