TITLE: Solving integral $ \int \frac{x+\sqrt{1+x+x^2}}{1+x+\sqrt{1+x+x^2}}\:\mathrm{d}x $
QUESTION [10 upvotes]: there is integral $$ \int \frac{x+\sqrt{1+x+x^2}}{1+x+\sqrt{1+x+x^2}}\:\mathrm{d}x$$
i am trying to separate this :
$$=\int \mathrm{d}x -\int \frac{\mathrm{d}x}{1+x+\sqrt{1+x+x^2}} $$ but have no idea about second

REPLY [11 votes]: We have the algebraic form:
$$
\frac{x+\sqrt{1+x+x^2}}{1+x+\sqrt{1+x+x^2}}.
$$
Multiplying by $\dfrac{(1+x)-\sqrt{1+x+x^2}}{(1+x)-\sqrt{1+x+x^2}}$ yields
$$
\frac{\sqrt{1+x+x^2}-1}{x}=\frac{\sqrt{1+x+x^2}}{x}-\frac1x.
$$
The integral becomes
$$
\int \frac{x+\sqrt{1+x+x^2}}{1+x+\sqrt{1+x+x^2}}\ dx=\int \frac{\sqrt{1+x+x^2}}{x}\ dx-\int \frac1x\ dx.
$$
The left part integral in RHS can be solved using Euler substitution by letting $t-x=\sqrt{1+x+x^2}$, you will get 
$x=\dfrac{t^2-1}{2t+1}$, $dx=\dfrac{2(t^2+t+1)}{(2t+1)^2}\ dt$, and $\sqrt{x^2+x+1}=\dfrac{t^2+t+1}{2t+1}$, then it becomes
$$
\int \frac{\sqrt{1+x+x^2}}{x}\ dx=\int \dfrac{2(t^2+t+1)^2}{(t^2-1)(2t+1)^2}\ dt.
$$
The last part can be solved by using partial fraction decomposition
$$
\dfrac{2(t^2+t+1)^2}{(t^2-1)(1+2t)^2}=-\frac1{t+1}+\frac1{2t+1}-\frac3{2(2t+1)^2}+\frac1{t-1}+\frac12.
$$
I hope I don't mess up and this helps you.