# 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.

• You've completed the square incorrectly: $x^2+x+1 = (x+1/2)^2 + 3/4$. – Chappers Feb 23 '17 at 2:43
• You wrote $$x^2+x+1=(x+1)^2-1$$ which is wrong. – Juniven Feb 23 '17 at 2:45
• Thanks to you both for pointing that out, I really don't know why I did that. I went over the completing the square part too fast and nerver questioned this silly result when I checked my answer. – user409521 Feb 23 '17 at 3:02

At the start your first step is wrong.

$x^2 + x + 1 \not\equiv (x+1)^2 -1$

A rather unfortunate minor error which cascades into what follows.

$(x+1)^2-1=x^2+2x+1-1$
$=x^2+2x \ne x^2+x+1$
$x^2+x+\frac 14 +1-\frac 14$
$=(x+\frac 12)^2 -\frac 34$
$=(x+\frac 12)^2 -(\frac {\sqrt3}2)^2$