Integral $\int\left(\frac{1}{x^4+x^2+1}\right)dx$ Someone can halp me to solve this integral:
$$\int\left(\frac{1}{x^4+x^2+1}\right)$$
solution$$\frac{1}{4}\ln\left(\frac{x^2+x+1}{x^2-x+1}\right)+\frac{1}{2\sqrt3}\arctan\frac {x^2-1}{x\sqrt3}$$ 
I don't manage using partial fraction because $${x^4+x^2+1}$$ has $\Delta\lt 0$ and substituing $t=x^2,$ $2x$ appears.That's a problem. 
 A: HINT: $$x^4+x^2+1=(x^2+1)^2-x^2=(x^2-x+1)(x^2+x+1)$$ then $$\dfrac
{1}{x^4+x^2+1}=\dfrac{1}{(x^2-x+1)(x^2+x+1)}=-\dfrac12\left(\dfrac{x-1}{x^2-x+1}\right)+\dfrac12\left(\dfrac{x+1}{x^2-x+1}\right).$$
A: Hint :
$$x^4+x^2+1=(x^2+1)^2−x^2=(x^2−x+1)(x^2+x+1)$$
So $$∫ \frac {1}{x^4+x^2+1}dx=\int\frac {1}{(x^2−x+1)(x^2+x+1)}dx$$
$$=\int\frac {1-x}{2(x^2−x+1)}+\frac {1+x}{2(x^2+x+1)}dx$$
$$=-\int\frac {x-1}{2(x^2−x+1)}dx+\int\frac {x+1}{2(x^2+x+1)}dx$$
$$=-\int\frac {2x-2}{4(x^2−x+1)}dx+\int\frac {2x+2}{4(x^2+x+1)}dx$$
$$=-\int\frac {2x-1}{4(x^2−x+1)}dx+\int\frac {1}{4(x^2−x+1)}dx+\int\frac {2x+1}{4(x^2+x+1)}dx+\int\frac {1}{4(x^2+x+1)}dx$$
$$=\int\frac {2x+1}{4(x^2+x+1)}dx-\int\frac {2x-1}{4(x^2−x+1)}dx+\int\frac {1}{4(x^2−x+1)}dx+\int\frac {1}{4(x^2+x+1)}dx$$
$$=\frac{1}{4}\ln\left(\frac{x^2+x+1}{x^2-x+1}\right)+\int\frac {1}{4(x^2−x+1)}dx+\int\frac {2x+1}{4(x^2+x+1)}dx$$
A: Notice, $$\int \frac{1}{x^4+x^2+1}\ dx$$ $$=\int \frac{\frac{1}{x^2}}{x^2+\frac{1}{x^2}+1}\ dx$$
$$=\frac{1}{2}\int \frac{\left(1+\frac{1}{x^2}\right)-\left(1-\frac{1}{x^2}\right)}{x^2+\frac{1}{x^2}+1}\ dx$$
$$=\frac{1}{2}\left(\int \frac{\left(1+\frac{1}{x^2}\right)}{x^2+\frac{1}{x^2}+1}\ dx-\int \frac{\left(1-\frac{1}{x^2}\right)}{x^2+\frac{1}{x^2}+1}\ dx\right)$$
$$=\frac{1}{2}\left(\int \frac{d\left(x-\frac{1}{x}\right)}{\left(x-\frac{1}{x}\right)^2+(\sqrt{3})^2}-\int \frac{d\left(x+\frac{1}{x}\right)}{\left(x+\frac{1}{x}\right)^2-(1)^2}\right)$$
$$=\frac12\left(\frac{1}{\sqrt 3}\tan^{-1}\left(\frac{x-\frac{1}{x}}{\sqrt 3}\right)-\frac{1}{2}\ln\left|\frac{x+\frac{1}{x}-1}{x+\frac{1}{x}+1}\right|\right)+C$$
$$=\frac{1}{2\sqrt 3}\tan^{-1}\left(\frac{x^2-1}{x\sqrt 3}\right)-\frac{1}{4}\ln\left|\frac{x^2-x+1}{x^2+x+1}\right|+C$$
A: HINT:
$$\dfrac2{x^4+x^2+1}=\dfrac{x^2+1-(x^2-1)}{x^4+x^2+1} =\dfrac{1+\dfrac1{x^2}}{x^2+1+\dfrac1{x^2}}-\dfrac{1-\dfrac1{x^2}}{x^2+1+\dfrac1{x^2}}$$
Now as $\int\left(1+\dfrac1{x^2}\right)dx=x-\dfrac1x,$
write the denominator as $\left(x-\dfrac1x\right)^2+3$
Similarly for the second integral.
A: Fact : Every polynomial can be factored as a product of linear factors. 
Fact : Every polynomial having only real coefficients can be factored as a product of linear and quadratic factors, where every factors are polynomials of real coefficients.
So the integration of rational function $P(x) / Q(x)$ can be done in algorithmic way (where $P$ and $Q$ is a polynomial in real coefficients) :
(1) Factor $Q(x)$ to have $f_1(x) \cdots f_n(x) \cdot g_1(x) \cdots g_m(x)$ where $f_i$ and $g_j$ are polynomials with real coefficients, $f_i$ are linear, $g_j$ are quadratic. 
(2) $P(x)/Q(x) = a(x) + \sum_{i} b_i/f_i(x) + \sum_j (c_j x + d_j)/g_j(x)$ where $a(x)$ is a polynomial, $b_i, c_j, d_j$ are all reals. 
(3) Do a term by term integration. 
In this way, the issue is to factor $x^4 + x^2 + 1$. As done by previous answers, it is $(x^2 + x + 1)(x^2 - x + 1)$. 
