# How to integrate $\frac{1}{\sqrt{x^2+x+1}}$

How to integrate $$\frac{1}{\sqrt{x^2+x+1}}$$

I tried to solve this integral as follows $$\displaystyle \int \frac{1}{\sqrt{x^2+x+1}} \ dx= \int \frac{1}{\sqrt{(x+\frac{1}{2})^2+\frac{3}{4}}} \ dx= \int \frac{1}{\sqrt{(\frac{2x+1}{2})^2+\frac{3}{4}}} \ dx= \int \frac{1}{\sqrt{\frac{3}{4}((\frac{2x+1}{\sqrt{3}})^2+1)}} \ dx= \int \frac{1}{\sqrt{(\frac{2x+1}{\sqrt{3}})^2+1}}\frac{2}{\sqrt{3}} \ dx$$

Substitution $$t=\frac{2x+1}{\sqrt{3}} ;dt=\frac{2}{\sqrt{3}} \ dx$$

$$\displaystyle\int \frac{1}{\sqrt{(\frac{2x+1}{\sqrt{3}})^2+1}}\frac{2}{\sqrt{3}} \ dx= \int \frac{1}{\sqrt{t^2+1}} \ dt$$

Substitution $$\sqrt{u-1}= t;\frac{1}{2\sqrt{u-1}} \ du= dt$$ $$\displaystyle \int \frac{1}{\sqrt{t^2+1}} \ dt= \int \frac{1}{2 \sqrt{u(u-1)}} \ du= \frac{1}{2}\int \frac{1}{\sqrt{u^2-u}} \ du= \frac{1}{2}\int \frac{1}{\sqrt{(u-\frac{1}{2})^2-\frac{1}{4}}} \ du= \int \frac{1}{\sqrt{(2u-1)^2-1}} \ du$$ Substitution $$g= 2u-1;dg= 2 \ du$$

$$\displaystyle \int \frac{1}{\sqrt{(2u-1)^2-1}} \ du= \frac{1}{2}\int \frac{2}{\sqrt{(2u-1)^2-1}} \ du= \frac{1}{2}\int \frac{1}{\sqrt{g^2-1}} \ dg= \frac{1}{2}\arcsin g +C=\frac{1}{2}\arcsin (2u-1) +C= \frac{1}{2}\arcsin (2(t^2+1)-1) +C=\frac{1}{2}\arcsin (2((\frac{2x+1}{\sqrt{3}})^2+1)-1) +C$$

However when I tried to graph it using desmos there was no result, and when i used https://www.integral-calculator.com/ on thi problem it got the result $$\ln\left(\left|2\left(\sqrt{x^2+x+1}+x\right)+1\right|\right)$$ where have I made a mistake?

• I think you got mixed up with the $\arcsin$. Remember, $$\int \frac{1}{\sqrt{\color{red}{1-g^2}}}\, dg = \color{red}{\arcsin g},$$ but $$\int \frac{1}{\sqrt{\color{blue}{g^2-1}}}\, dg = \color{blue}{\ln\left(\left|g + \sqrt{g^2 -1}\right|\right)}.$$ – Minus One-Twelfth Mar 22 at 20:48
• $\int \frac {1}{\sqrt{(x+\frac 12))^2 + \frac 34}}\ dx.$ Substitute $x+\frac 12 = \sqrt{\frac 34} \sinh x$ – Doug M Mar 22 at 21:21

You have got mixed up with the $$\arcsin$$. Note that $$\int\frac{1}{\sqrt{\color{red}{1-g^2}}}\, dg = \color{red}{\arcsin g},$$ but $$\int\frac{1}{\sqrt{\color{blue}{g^2-1}}}\, dg = \color{blue}{\ln\left(\left|g+\sqrt{g^2 -1}\right|\right)}.$$ You can verify this by differentiating the right-hand side, or try to derive this by using a trig. substitution like $$g = \sec \theta$$. See the bottom two answers here for approaches that don't involve hyperbolic functions.

Here $$\int \frac{1}{\sqrt{g^2-1}} \ dg=...$$

Correct is:

$$\int \frac{1}{\sqrt{1-g^2}} \ dg= \arcsin g$$

• eh that is exactly what ive got – Want_to_be_unknown Mar 22 at 20:51
• or yeah you are right gimme a sec – Want_to_be_unknown Mar 22 at 20:51
• I think Minus One-Twelfth gave you a right way in a comment – Aqua Mar 22 at 20:53
• oh man... but that would lead to hyperbolic function which my course hadnt covered yet... – Want_to_be_unknown Mar 22 at 20:55
• You can just do it with the $\ln$'s, don't need to know about hyperbolic functions. Or are you saying your course hasn't taught how to integrate $\frac{1}{\sqrt{x^2 -1}}$ also? – Minus One-Twelfth Mar 22 at 20:56

As you did, by completing the square and with $$y:=\dfrac2{\sqrt3}\left(x+\dfrac12\right)$$,

$$I:=\int\frac{dx}{\sqrt{x^2+x+1}}=\int\frac{dy}{\sqrt{y^2+1}}.$$

Then by some magic $$y:=\dfrac12\left(t-\dfrac1t\right)$$ yields $$dy=\dfrac12\left(1+\dfrac1{t^2}\right)$$ and

$$\int\frac{dy}{\sqrt{y^2+1}}=\int\frac{\dfrac12\left(1+\dfrac1{t^2}\right)}{\dfrac12\left(t+\dfrac1{t}\right)}dt=\log t.$$

Now we need to invert,

$$y=\dfrac12\left(t-\dfrac1t\right)\iff t^2-2yt-1=0\iff t=y\pm{\sqrt{y^2+1}}.$$

Finally, choosing the plus sign and ignoring the additive constant,

$$I=\log\left(x+\dfrac12+\sqrt{x^2+x+1}\right).$$