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.