Help finding integral: $\int \frac{dx}{x\sqrt{1 + x + x^2}}$

Since the integrand is a quadratic irrational function of the type $R(x,\sqrt{1+x+x^{2}})$, you may use the Euler substitution $\sqrt{1+x+x^{2}}=x+t$. You get

$$\begin{eqnarray*} \int \frac{dx}{x\sqrt{1+x+x^{2}}} &=&\int \frac{2}{t^{2}-1}\,dt \\ &=&-2\operatorname{arctanh}t+C \\ &=&-2\operatorname{arctanh}\left( \sqrt{1+x+x^{2}}-x\right)+C. \end{eqnarray*}$$


Make the substitution $x = \frac{1}{t}$ and this reduces to finding

$$\int \frac{\text{d}t}{\sqrt{t^2 + t + 1}}$$

which can easily be reduced to finding the standard integral:

$$ \int \frac{\text{d}z}{\sqrt{z^2 + 1}} = \sinh^{-1}(z) + C$$

This substitution can be used for finding

$$\int \frac{\text{d}x}{x\sqrt{P(x)}}$$

where $P(x)$ is a quadratic polynomial in $x$.


$\displaystyle\int\frac{1}{x\sqrt{x^2+x+1}}dx=\int\frac{1}{x\sqrt{(x+\frac{1}{2})^2+\frac{3}{4}}}dx$.$\;\;$ Now let $x+\frac{1}{2}=\frac{\sqrt{3}}{2}\tan\theta$, $dx=\frac{\sqrt{3}}{2}\sec^{2}\theta d\theta$

to get $\displaystyle\int\frac{1}{(\frac{\sqrt{3}}{2}\tan\theta-\frac{1}{2})(\frac{\sqrt{3}}{2}\sec\theta)}\frac{\sqrt{3}}{2}\sec^{2}\theta d\theta=\int\frac{\sec\theta}{\frac{\sqrt{3}}{2}\tan\theta-\frac{1}{2}}d\theta=\int\frac{1}{\frac{\sqrt{3}}{2}\sin\theta-\frac{1}{2}\cos\theta}d\theta$

$\;\;=\displaystyle\int\frac{1}{-\cos(\theta+\frac{\pi}{3})}d\theta=-\int\sec\big(\theta+\frac{\pi}{3}\big)d\theta=-\ln\left|\sec\big(\theta+\frac{\pi}{3}\big)+\tan\big(\theta+\frac{\pi}{3}\big)\right|+C$

$\;\;=-\displaystyle\ln\left|\frac{-2\sqrt{x^2+x+1}}{\sqrt{3}x}-\frac{x+2}{\sqrt{3}x}\right|+C=-\ln\left|\frac{2\sqrt{x^2+x+1}+x+2}{\sqrt{3}x}\right|+C$

$\;\;\displaystyle=\ln\left|\frac{\sqrt{3}x}{2\sqrt{x^2+x+1}+x+2}\right|+C=\ln|x|-\ln\left(2\sqrt{x^2+x+1}+x+2\right)+C$