Integrating $\displaystyle\int \frac{1+x^2}{1+x^4}dx$ I am trying to integrate this function, which I got while solving $\int\frac{1}{\sin^4( x) + \cos^4 (x)}$:

$$\int \frac{1+x^2}{1+x^4}\mathrm dx$$

I think to factorise the denominator, and use partial fractions. But I cant seem to find roots of denominator. I also am unable to think substitution.
 A: Hint: $$\int\frac{1+x^{2}}{1+x^{4}}dx=\frac{1}{2}\int\left(\frac{1}{x^{2}+\sqrt{2}x+1}+\frac{1}{x^{2}-\sqrt{2}x+1}\right)dx$$ $$=\frac{1}{2}\int\left(\frac{1}{\left(x+\frac{1}{\sqrt{2}}\right)^{2}+\frac{1}{2}}+\frac{1}{\left(x-\frac{1}{\sqrt{2}}\right)^{2}+\frac{1}{2}}\right)dx.$$
A: Roots can be complex as well. 
$x^4+1=0 \Leftrightarrow x \in \{e^{i k \pi / 4} \ ,\  k \in \{1,3,5,7 \} \}$.
You have 4 complex roots which are all different; hence, using denominator factorization and partial fractions as you mentioned should do the trick.
A: $$\sin^2 x =\frac{1}{2}{(1- \cos2x)}$$
$$\cos^2 x =\frac{1}{2}{(1+\cos2x)}$$
$$\sin^4 x + \cos ^4 x =\frac{1}{4}\left[(1- \cos2x)^2 +(1+ \cos2x)^2 \right]
=\frac{1}{2}((1+ \cos^2 2x)$$
$$\implies 2 \int \frac{dx}{1+ \cos^2 2x}$$
$$= 2 \int \frac{\sec^2 2x}{\sec^2 2x+ 1}{dx}$$
$$t= \tan2x$$
$$\implies 2 \int \frac{dt}{2 + t^2}$$
$$\frac{1}{\sqrt2} \tan^{-1} \left(\frac{t}{\sqrt2}\right)$$
A: One may write
$$
\int \dfrac{1+x^2}{1+x^4}dx=\int \dfrac{1+\frac1{x^2}}{\frac1{x^2}+x^2}dx=\int \dfrac{\left(x-\frac1x\right)'}{\left(x-\frac1x\right)^2+2}\:dx
$$ then one may conclude easily.
A: A more general approach would be to identify that we have a quotient of polynomials and realize we can do factorization and partial fraction decomposition. @Salem is on this track but does not mention how very general it is. It will work on any fraction of polynomials $$\frac{P(x)}{Q(x)} = \sum_{\forall i} \frac{P_i(x)}{Q_i(x)}$$ where for complex numbers and real polynomials these $P_i$ and $Q_i$ are ensured to be of maximum degree 2 and have real roots. So we are sure to get away with really nice terms to integrate once we have done the decomposition.
A: Let $$I = \int\frac{1}{\sin^4 x+\cos^4 x}dx = \int\frac{1}{\sin^2 x\cos^2 x\left(\tan^2 x+\cot^2 x\right)}dx$$
$$I =\int\frac{\sin^2 x+\cos^2 x}{\sin^2 x\cos^2 x\left(\tan^2 x+\cot^2 x\right)}dx= \int\frac{\sec^2 x+\csc^2 x}{(\tan x-\cot x)^2+\left(\sqrt{2}\right)^2}dx$$
Now Put $\tan x-\cot x = t\;,$ Then $(\sec^2 x+\csc^2 x)dx=dt$
$$I = \int\frac{1}{t^2+(\sqrt{2})^2}dt = \frac{1}{\sqrt{2}}\tan^{-1}\left(\frac{t}{\sqrt{2}}\right)+\mathcal{C}$$
So $$I = \int\frac{1}{\sin^4 x+\cos^4 x}dx = \frac{1}{\sqrt{2}}\tan^{-1}\left(\frac{\tan x-\cot x}{\sqrt{2}}\right)+\mathcal{C}.$$
