Which methods to use to integrate $\int{\frac{x^4 + 1}{x^2 +1}}\, dx$ I have this integral to evaluate:
$$\int{\frac{x^4 + 1}{x^2 +1}}\, dx$$
I have tried substitution, trig identity and integration by parts but I'm just going round in circles. 
Can anyone explain the method I need to work this out?
 A: HINT:
As $x^4-1=(x^2)^2-1=(x^2+1)(x^2-1),$
$$\frac{x^4 + 1}{x^2 +1}=\frac{x^4-1+2}{x^2 +1}=x^2-1+\frac2{x^2+1}$$
Generalization :
If the integrand is $$\frac{a_0+a_1x+a_2x^2+a_3x^3+\cdots}{ax^2+bx+c},$$
just divide to get the quotient of the form $b_0+b_1x+b_2x^2+\cdots$ which is easily integrable and the remaining part will be of the form  $\frac{px+q}{ax^2+bx+c}$
If $p=0$ check the $I_2$ below.
else we set $px+q=r\frac{d(ax^2+bx+c)}{dx}+ s=r(2ax)+rb+s$
Comparing the coefficients of $x,2ar=p\implies r=\frac p{2a}$
and Comparing the constants, $rb+s=q\implies s=q-rb=q-\frac{pb}{2a}$ 
$$\text{So, }\int \frac{px+q}{ax^2+bx+c} dx$$
$$=r \int \frac{d(ax^2+bx+c)}{dx}\frac1{ax^2+bx+c}dx+s\int\frac1{ax^2+bx+c}dx $$
$$=\frac p{2a}\int \frac{d(ax^2+bx+c)} {ax^2+bx+c}+\left(q-\frac{pb}{2a}\right)\int\frac1{ax^2+bx+c}dx $$
$$\text{Now, } \int \frac{d(ax^2+bx+c)} {ax^2+bx+c}=\ln|ax^2+bx+c|+C$$
$$\text{and } I_2=\int\frac1{ax^2+bx+c}dx =\int\frac{4a}{(2ax+b)^2+4ac-b^2}dx $$
If $4ac-b^2=0,$ put $2ax+b=u$ in $I_2$
If $4ac-b^2>0, 4ac-b^2=t^2$(say, ) $I_2=4a\int \frac{dx}{(2ax+b)^2+t^2}$ and put $2ax+u=t\tan\theta$
If $4ac-b^2<0, 4ac-b^2=-t^2$(say, ) $I_2=4a\int \frac{dx}{(2ax+b)^2-t^2}$ and put $2ax+u=t\sec\theta$
A: Whenever you have a rational polynomial with a numerator of equal or larger degree than the denominator, try to factor the numerator if possible, or simply, use polynomial long division.   


*

*lab bhattacharjee noticed a nice way to simplify the rational integrand by manipulating the numerator to make life easier. 

*But suppose you're tired and not feeling particularly creative; polynomial long division will give you the same result:


Dividing numerator by denominator using simple but quick polynomial long division gives us:
$$\frac{x^4 + 1}{x^2 +1}=(x^2-1)+\frac2{x^2+1}$$
So, we can express our integral as follows: $$\int \frac{x^4 + 1}{x^2 +1} \, dx\;= \;\;\int x^2 \,dx \;\;- \;\;\int \,dx \;\;+\;\; 2\int \frac 1{x^2+1}\,dx$$
No doubt, you can handle the first two integrals. And for the third: notice that the third integral is in perfect form which integrates nicely to $$2\int \frac 1{x^2+1}\,dx\;\; = \;\;\;2\tan^{-1}(x) + C$$
A: I think lab bhattacharjee's way is probably the best, but since you mentioned you tried it, I believe trig substitution would work as well.  The substitution
$$x=\tan t,dx=\sec^2tdt$$
would result with
$$\int\tan^4t+1=\int(\sec^2t-1)\tan^2t+1dt$$
$$\int\tan^2t\sec^2tdt+\int1-(\sec^2t-1)dt$$
Clear the parentheses, integrate, and backsubstitution should be rather easy.
A: Let's try some imaginary stuff.
$\dfrac{x^4}{x^2+1}=\dfrac{Ax^3}{x+i}+\dfrac{Bx^3}{x-i} \implies A=B= \dfrac{1}{2}$
$\dfrac{x^4+1}{x^2+1}= \dfrac{1x^3}{2(x+i)}+\dfrac{1x^3}{2(x-i)}+\dfrac{1}{x^2+1}$
