TITLE: Which methods to use to integrate $\int{\frac{x^4 + 1}{x^2 +1}}\, dx$
QUESTION [12 upvotes]: 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?

REPLY [10 votes]: 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$$