Integral of this weird function $ \int \frac{1}{(x^2+x+1)^2}dx $ I put this equation into Symbolab and it produced me a very complex result
Basically this is the result but I believe there is a simpler way to solve this question
$$
\frac{2}{3\sqrt{3}}\left(2\arctan \left(\frac{2x+1}{\sqrt{3}}\right)+\sin \left(2\arctan \left(\frac{2x+1}{\sqrt{3}}\right)\right)\right)+C
$$
This was my question
$$
\int \frac{1}{\left(x^2+x+1\right)^2}dx
$$
 A: Substitute $y=x+\frac12$\begin{align}
&\int \frac{1}{(x^2+x+1)^2}dx\\
=& \int \frac{1}{(y^2+\frac34)^2}dy
= \int \frac{2}{3y}\ d\bigg( \frac{y^2}{y^2 +\frac34}\bigg)
\overset{ibp}=\frac{2y}{3(y^2+\frac34)}+\frac23\int \frac1{y^2+\frac34}dy\\
=&\ \frac{8y}{3(4y^2+3)}+ \frac4{3\sqrt3}\tan^{-1}\frac{2y}{\sqrt3}+C
\end{align}
A: Under $x+\frac12=\frac{\sqrt3}{2}\tan\theta$ or $\theta=\arctan\bigg(\frac{2x+1}{\sqrt3}\bigg)$, one has
\begin{eqnarray}
&&\int \frac{1}{(x^2+x+1)^2}dx\\
&=& \int \frac{1}{((x+\frac12)^2+\frac34)^2}dy\\
&=& \frac{8\sqrt3}{9}\int\frac{1}{\sec^4\theta}\sec^2\theta d\theta\\
&=& \frac{8\sqrt3}{9}\int\cos^2\theta d\theta\\
&=& \frac{4\sqrt3}{9}\int(1+\cos(2\theta)) d\theta\\
&=& \frac{2\sqrt3}{9}\bigg[2\theta+\sin(2\theta)\bigg]+C.
\end{eqnarray}
Using
$$ \sin(2x)=\frac{2\tan x}{1+\tan^2x} $$
one has
$$ \sin(2\theta) = \frac{2x+1}{2\sqrt3}\frac{1}{x^2+x+1}$$
and hence
$$ \int \frac{1}{(x^2+x+1)^2}dx=\frac{2\sqrt3}{9}\bigg[2\arctan\bigg(\frac{2x+1}{\sqrt3}\bigg)+\frac{2x+1}{2\sqrt3}\frac{1}{x^2+x+1}\bigg]+C. $$
