Evaluate the following integral:
$\int \frac{(x-1)^{2}}{x^{4}+x^{2}+1} d x$
re-writing the given equation as
$\int \frac{x^{2}-2 x+1}{x^{4}+x^{2}+1} d x$
$\int \frac{1-\frac{2}{x}+\frac{1}{x^{2}}}{x^{2}+1+\frac{1}{x^{2}}} d x$
$\int \frac{1+\frac{1}{x^{2}}}{\left(x-\frac{1}{x}\right)^{2}+3} d x-\int \frac{2 x}{x^{4}+x^{2}+1} d x$
Substituting $\mathrm{tas} \mathrm{x}-\frac{1}{\mathrm{x}}$ and $\mathrm{z}$ as $\mathrm{x}^{2}$
$\left(1+\frac{1}{x^{2}}\right) d x=d t$ and $2 x d x=d z$
$\int \frac{d t}{(t)^{2}+3}-\frac{3}{2} \int \frac{d z}{z^{2}+z+1}$
$\int \frac{d t}{(t)^{2}+3}-\int \frac{d z}{\left(z+\frac{1}{2}\right)^{2}+\frac{3}{4}}$
Using identity $\int \frac{1}{x^{2}+1} d x=\arctan (x)$
$\frac{1}{\sqrt{3}} \arctan \left(\frac{t}{\sqrt{3}}\right)-\frac{2}{\sqrt{3}} \arctan \left(\frac{2 z+1}{\sqrt{3}}\right)+c$
Substituting $\mathrm{t}$ as $\mathrm{x}-\frac{1}{\mathrm{x}}$ and $\mathrm{z}$ as $\mathrm{x}^{2}$
$\frac{1}{\sqrt{3}} \arctan \left(\frac{x-\frac{1}{x}}{\sqrt{3}}\right)-\frac{2}{\sqrt{3}} \arctan \left(\frac{2 x^{2}+1}{\sqrt{3}}\right)+c$