<s>[INST] Trigonometric-substitutions for $\int \frac{x}{\sqrt{x^2+x+1}}\,dx$ Working integrals involving trigonometric substitutions, I evaluate
$$\int \frac{x}{\sqrt{x^2+x+1}}\,dx$$
and I am not sure what I am doing wrong.
What I do is change the denominator to $x^2+x+1=(x+1)^2-1$ then let  $v=x+1$ and so $dv=dx$ such that I get
$$\int \frac {v-1}{\sqrt{v^2-1}}\,dv$$
Then, I set $v=a\sec\theta$ such that $dv=a\sec\theta\tan\theta\,d\theta$ and $a=1$ and I get,
$$\int \frac {(\sec\theta-1)}{\sqrt{\sec^2\theta-1}}\,\sec\theta\tan\theta\,d\theta$$
$$=\;\int \sec^2\theta-\sec\theta\,d\theta$$
$$\tan\theta - \ln|\sec\theta+\tan\theta|+C$$
Getting back in terms of the initial variable $x$ I get,
$$=\;\sqrt{v^2-1}-\ln|v+\sqrt{v^2-1}|+C$$
$$=\; \sqrt{x^2+x+1}-\ln|x+1+\sqrt{x^2+x+1}|+C$$
Which is incorrect. What I should get is
$$=\; \sqrt{x^2+x+1}-\frac 12\ln|x+\frac 12+\sqrt{x^2+x+1}|+C$$
The fact that my answer is so close and has the correct form leads me to believe that my substitutions might be correct and that I am making silly arithmetic mistakes somewhere. 
All help is appreciated.
 [/INST] $$\int\frac{xdx}{\sqrt{x^{2}+x+1}}$$
$$x^{2}+x+1=(x+\frac{1}{2})^{2}+\frac{3}{4}=\frac{3}{4}\left[ (\frac{2x+1}{\sqrt{3}})^{2}+1 \right]$$
$$\frac{2x+1}{\sqrt{3}}=z\Rightarrow dz=\frac{2}{\sqrt{3}}dx,x=\frac{\sqrt{3}z-1}{2}$$
$$
\int\frac{xdx}{\sqrt{x^{2}+x+1}}=\frac{\sqrt{3}}{4}\int\frac{(\sqrt{3}z-1)dz}{\sqrt{z^{2}+1}}$$
$$=\frac{3}{8}\int\frac{2z}{\sqrt{z^{2}+1}}-\frac{\sqrt{3}}{4}\int\frac{dz}{\sqrt{z^{2}+1}}$$
</s>