<s>[INST] Integral - using Euler Substitution I've been trying to solve one simple Integral with Euler substitution several times, but can't find where I'm going wrong. The integral is (+ the answer given here, too):
$$\int\frac{1}{x\sqrt{x^2+x+1}} dx=\log(x)-\log(2\sqrt{x^2+x+1}+x+2)+\text{ constant}$$
The problem is, I cannot get this result. Below is my solution of the problem. I've checked it many times, must be something very obvious that I'm missing:
(original image)

Euler Substituion
$\displaystyle\int\frac{dx}{x\sqrt{x^2+x+1}}$
Let $\sqrt{x^2+x+1}=t-x$.
$x^2+x+1=t^2-2xt+x^2$
$x(1+2t)=t^2-1\implies x=\dfrac{t^2-1}{1+2t}$
$dx=\left(\dfrac{t^2-1}{1+2t}\right)'dt=\dfrac{2t(1+2t)-(t^2-1)2}{(1+2t)^2}=\dfrac{2t+4t^2-2t^2+2}{(1+2t)^2}=\dfrac{2(t^2+t+1)}{(1+2t)^2}$
$\sqrt{x^2+x+1}=t-x=t-\dfrac{t^2-1}{1+2t}=\dfrac{t^2+t+1}{1+2t}$
$\implies\displaystyle\int\frac{dx}{x\sqrt{x^2+x+1}}=2\int\frac{\frac{t^2+t+1}{(1+2t)^2}\;dt}{\frac{t^2-1}{1+2t}\cdot\frac{t^2+t+1}{1+2t}}=2\int \frac{1}{t^2-1}\,dt$
$\dfrac{1}{t^2-1}=\dfrac{1}{(t+1)(t-1)}=\dfrac{A}{t+1}+\dfrac{B}{t-1}\implies \begin{eqnarray}&&At-A+Bt+B=1\\&&A+B=0\implies A=-B\\ &&B-A=1\implies B=\frac{1}{2},A=-\frac{1}{2}\end{eqnarray}$
$\implies \displaystyle 2\int \frac{1}{2}\frac{1}{2t-1}\,dt-2\int\frac{1}{2}\frac{1}{t+1}\,dt=\int\frac{1}{t-1}\,dt-\int\frac{1}{t+1}\,dt=$
$=\ln|t-1|-\ln|t+1|=\ln\left|\dfrac{t-1}{t+1}\right|$
$t-x=\sqrt{x^2+x+1}\implies t=\sqrt{x^2+x+1}+x$
$\implies \ln\left|\dfrac{t-1}{t+1}\right|=\ln\left|\dfrac{\sqrt{x^2+x+1}+x-1}{\sqrt{x^2+x+1}+x+1}\right|$

I'll appreciate any help.
Thanks in advance!
 [/INST] You may use substitution x=1/t, or Euler substitution \sqrt{x^2+x+1}=tx-1
</s>