A problem asked by Vijay Kumar Chavan

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

We will use partial fractions method to break down the integrand.

$\frac{1}{x^4+x^2+1} = \frac{1}{(x^2 + 1)^2 - x^2} = \frac{1}{(x^2 + 1 + x)(x^2 +1 - x)}$

Suppose $\frac{1}{(x^2 + 1 + x)(x^2 +1 - x)} = \frac{Ax+B}{x^2+1+x} + \frac{Cx+D}{x^2+1-x}$

or, $1 = (Ax+B)(x^2+1-x) + (Cx+D)(x^2+1+x)$

or, $1 = (A +C)x^3 + (B-A +D+C)x^2 + (A - B +C+D)x + (B + D)$

or, $B +D = 1$, $A + C = 0$, $A - C =1$ and $D-B=0$

So, $A = \frac{1}{2}$, $B = \frac{1}{2}$, $C = -\frac{1}{2}$, $D=\frac{1}{2}$

And we will have

$\frac{1}{x^4+x^2+1} = \frac{1}{2} \frac{x+1}{x^2+x+1} - \frac{1}{2} \frac{x-1}{x^2-x+1}$

We integrate $\frac{x+1}{x^2+x+1}$ and $\frac{x-1}{x^2-x+1}$ separately.

$\int \frac{x+1}{x^2+x+1} \; dx = \frac{1}{2} \int \frac{2x+1 + 1}{x^2 + x + 1} \; dx$

$=\frac{1}{2} \int \frac{2x+1}{x^2+x+1} \; dx + \frac{1}{2} \int \frac{1}{x^2+x+1} \; dx$

$=\frac{1}{2} \ln (x^2+x+1) + \frac{1}{2} \int \frac{1}{(x+\frac{1}{2})^2 + \frac{3}{4}} \;dx$

$=\frac{1}{2} \ln (x^2+x+1) + \frac{1}{2}\frac{2}{\sqrt{3}} \tan^{-1} \left( \frac{x+\frac{1}{2}} {\frac{\sqrt{3}}{2}} \right)$

$=\frac{1}{2} \ln (x^2+x+1) + \frac{1}{\sqrt{3}} \tan^{-1} \left( \frac{2x+ 1} {\sqrt{3}} \right)$

And,

$\int \frac{x-1}{x^2-x+1} \; dx = \frac{1}{2} \int \frac{2x-1 - 1}{x^2 - x + 1} \; dx$

$=\frac{1}{2} \int \frac{2x-1}{x^2-x+1} \; dx - \frac{1}{2} \int \frac{1}{x^2-x+1} \; dx$

$=\frac{1}{2} \ln (x^2-x+1) - \frac{1}{2} \int \frac{1}{(x-\frac{1}{2})^2 + \frac{3}{4}} \;dx$

$=\frac{1}{2} \ln (x^2-x+1) - \frac{1}{2}\frac{2}{\sqrt{3}} \tan^{-1} \left( \frac{x-\frac{1}{2}} {\frac{\sqrt{3}}{2}} \right)$

$=\frac{1}{2} \ln (x^2+x+1) - \frac{1}{\sqrt{3}} \tan^{-1} \left( \frac{2x- 1} {\sqrt{3}} \right)$

So, we have

$\int \frac{1}{x^4+x^2+1} \; dx = \frac{1}{2} \int \frac{x+1}{x^2+x+1} \; dx - \frac{1}{2} \int \frac{x-1}{x^2-x+1} \; dx$

$=\frac{1}{4} \ln (x^2+x+1) + \frac{1}{2\sqrt{3}} \tan^{-1} \left( \frac{2x+ 1} {\sqrt{3}} \right)$

$-\frac{1}{4} \ln (x^2+x+1) + \frac{1}{2\sqrt{3}} \tan^{-1} \left( \frac{2x- 1} {\sqrt{3}} \right)$

$= \frac{1}{4} \ln \frac{x^2+x+1}{x^2-x+1} + \frac{1}{2\sqrt{3}} \left( \tan^{-1} \left( \frac{2x+ 1} {\sqrt{3}} \right)+ \tan^{-1} \left( \frac{2x- 1} {\sqrt{3}} \right) \right)$