Evaluating $\int \frac{1}{{x^4+1}} dx$ I am trying to evaluate the integral
$$\int \frac{1}{1+x^4} \mathrm dx.$$
The integrand $\frac{1}{1+x^4}$ is a rational function (quotient of two polynomials), so I could solve the integral if I can find the partial fraction of $\frac{1}{1+x^4}$. But I failed to factorize $1+x^4$. 
Any other methods are also wellcome. 
 A: $$I =\int \frac{1}{{x^4+1}} dx$$
If we add and subtract $2x^2$ to $x^4 + 1$, we get:
$$\int \frac{1}{{x^4 + 2x^2 + 1 - 2x^2}}$$
We know $x^4 + 2x^2 + 1 = (x^2 + 1)^2$
$$\int \frac{1}{{(x^2 + 1)^2 - 2x^2}}$$
We know $a^2 - b^2 = (a - b)(a + b)$
Hence, $(x^2 + 1)^2 - 2x^2 = (x^2 + 1 - \sqrt{2}x)(x^2 + 1 + \sqrt{2}x)$
$$\int \frac{1}{{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)}}$$
Now using partial fraction decomposition:
$$\frac{1}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)} = \frac{Ax + B}{x^2-\sqrt{2}x+1} + \frac{Cx + D}{x^2+\sqrt{2}x+1}$$
After you have found A, B, C and D, its just a basic $\frac{linear}{quadratic}$ type integral.
A: Without using fractional decomposition:
$$\begin{align}\int\dfrac{1}{x^4+1}~dx&=\dfrac{1}{2}\int\dfrac{2}{x^4+1}~dx
\\&=\dfrac{1}{2}\int\dfrac{(x^2+1)-(x^2-1)}{x^4+1}~dx
\\&=\dfrac{1}{2}\int\dfrac{x^2+1}{x^4+1}~dx-\dfrac{1}{2}\int\dfrac{x^2-1}{x^4+1}~dx
\\&=\dfrac{1}{2}\int\dfrac{1+\dfrac{1}{x^2}}{x^2+\dfrac{1}{x^2}}~dx-\dfrac{1}{2}\int\dfrac{1-\dfrac{1}{x^2}}{x^2+\dfrac{1}{x^2}}~dx
\\&=\dfrac{1}{2}\left(\int\dfrac{1+\dfrac{1}{x^2}}{\left(x-\dfrac{1}{x}\right)^2+2}~dx-\int\dfrac{1-\dfrac{1}{x^2}}{\left(x+\dfrac{1}{x}\right)^2-2}~dx\right)
\\&=\dfrac{1}{2}\left(\int\dfrac{d\left(x-\dfrac{1}{x}\right)}{\left(x-\dfrac{1}{x}\right)^2+2}-\int\dfrac{d\left(x+\dfrac{1}{x}\right)}{\left(x+\dfrac{1}{x}\right)^2-2}\right)\end{align}$$
So, finally solution is $$\int\dfrac{1}{x^4+1}~dx=\dfrac{1}{4\sqrt2}\left(2\arctan\left(\dfrac{x^2-1}{\sqrt2x}\right)+\log\left(\dfrac{x^2+\sqrt2x+1}{x^2-\sqrt2x+1}\right)\right)+C$$
A: Hint:
$$x^4+1=(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1) \tag{1}$$
You can integrate using partial fraction decomposition. Since
$$x^4+1=(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1),$$
then
$$\frac{1}{x^4+1}=\frac{Ax+B}{x^2-\sqrt{2}x+1}+\frac{Cx+D}{x^2+\sqrt{2}x+1}=\frac{(Ax+B)(x^2+\sqrt{2}x+1)+(Cx+D)(x^2-\sqrt{2}x+1)}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)} = \\
= \frac{x^3(A+C)+x^2(A\sqrt{2}+B+D-C\sqrt{2})+x(B\sqrt{2}-D\sqrt{2})+B+D}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)}$$
$$\begin{cases}
A+C=0;\\
B+D+\sqrt{2}(A-C)=0; \\
B-D=0; \\
B+D=1.
\end{cases}$$
$$
A=-C=-\frac{1}{2\sqrt{2}}; \\
B=D=\frac{1}{2}$$
$$
\frac{1}{x^4+1}=\frac{1}{2\sqrt{2}}\left(\dfrac{-x+\sqrt{2}}{x^2-\sqrt{2}x+1}+ \dfrac{x+\sqrt{2}}{x^2+\sqrt{2}x+1} \right).
$$
Added
Decomposition (1) can be done using one of the following ways:


*

*Completion to the full square 
$$x^4+1=x^4 +2x^2+1 -2x^2=(x^2+1)^2-\left(\sqrt{2}x\right)^2 = \\ =\big(x^2-\sqrt{2}x +1 \big)\big( x^2+\sqrt{2}x +1 \big).$$

*Let $\omega_i, \ i\in\{1,\, 2,\,3,\,4\}   $ are roots of the equation $x^4+1=0$ over $\mathbb{C}:$ $\omega_1=\frac{\sqrt{2}}{2}(1-i), \ \omega_2=\frac{\sqrt{2}}{2}(1+i) \ \omega_3=\frac{\sqrt{2}}{2}(-1+i), \ \omega_4=\frac{\sqrt{2}}{2}(-1-i). $ Then use the decomposition into prime factors and multiply pairwise complex conjugate:
$x^4+1= \left( x-\frac{\sqrt{2}}{2}(1-i) \right)\left( x-\frac{\sqrt{2}}{2}(1+i) \right)\left( x-\frac{\sqrt{2}}{2}(-1+i) \right)\left( x-\frac{\sqrt{2}}{2}(-1-i) \right) = \\ =\big(x^2-\sqrt{2}x +1 \big)\big( x^2+\sqrt{2}x +1 \big).$
A: The indefinite integral is a rational fraction and is typically solved using partial fractions decomposition.
You first factor the denominator $x^4+1$, which has four complex roots, the fourth roots of minus one, let $\omega_0$, $\omega_1$, $\omega_2$, and $\omega_3$. Then you decompose
$$\frac1{x^4+1}=\frac a{x-\omega_0}+\frac b{x-\omega_1}+\frac c{x-\omega_2}+\frac d{x-\omega_3}$$
The unknown coefficients are found by multiplying by one of the denominators and taking the limit to the root:
$$a=\lim_{x\to\omega_0}\frac{x-\omega_0}{x^4+1}=\frac1{4\omega_0^3},$$
and similarly for the other terms.
Then, a single term is integrated with a complex logarithm
$$\int\frac{dx}{x-\omega}=\ln(x-\omega)=\ln|x-\omega|+i\angle(x-\omega).$$
Here we have $\omega_0=\dfrac{1+i}{\sqrt2}$, hence
$$\ln\sqrt{(x-\frac1{\sqrt2})^2+(\frac1{\sqrt2})^2}-i\arctan\frac{\frac1{\sqrt2}}{x-\frac1{\sqrt2}}\\
=\frac12\ln(x^2-\sqrt2x+1)-i\frac\pi2+i\arctan(\sqrt2x-1).$$
Repeat for the four terms (there is a lot of symmetry) and form the linear combination.
