Evaluate $\int \frac{dx}{(x^2-x+1)\sqrt{x^2+x+1}}$ Evaluate $$I=\int \frac{dx}{(x^2-x+1)\sqrt{x^2+x+1}}$$
My book gave the substitution for $$\int \frac{dx}{P\sqrt{Q}}$$ as
$\frac{Q}{P}=t^2$ when $P$ and $Q$ are quadratic expressions
So accordingly i used   
$$\frac{x^2+x+1}{x^2-x+1}=t^2 \tag{1}$$ we get
$$\frac{(1-x^2) \, dx}{(x^2-x+1)^2}=t \,dt$$
Then
$$I=\int \frac{\sqrt{x^2-x+1}\:dt}{1-x^2}$$
By Componendo Dividendo in $(1)$ we get
$$\frac{x^2+1}{x}=\frac{t^2+1}{t^2-1}$$
But how to express integrand purely in terms of $t$?
 A: Alternative approach: Using the substitution $x=(t-1)/(t+1)$ the integral is reduced to $$2\int\frac{t\,dt}{(t^2+3)\sqrt{1+3t^2}}+2\int\frac{dt}{(t^2+3)\sqrt{1+3t^2}}$$ For the first integral use the substitution $1/\sqrt{1+3t^2}=u$ and for the second one use $t/\sqrt{1+3t^2}=v$.
Update: The substitution used above is taken from my favorite Hardy's A Course of Pure Mathematics and is applicable to integrals of the form $$\int\frac{px+q} {(ax^2+2bx+c)\sqrt{Ax^2+2Bx+C}} \, dx$$ where $ax^2+2bx+c=0$ has complex roots (ie $b^2<ac$). The substitution to be used here is $$x=\frac{rt+s} {t+1}$$ where $r, s$ are roots of the quadratic equation $$(Ab-Ba)z^2-(Ca-Ac)z+(Bc-Cb)=0$$ The above equation will always have real roots. After performing the substitution the integral is reduced to the form $$\int \frac{Lt+M} {(\alpha t^2+\beta)\sqrt{\gamma t^2+\delta}} \, dt$$ which can be split into two integrals. The first of these is handled by using substitution $u=1/\sqrt{\gamma t^2+\delta}$ and for the second one the substitution $v=t/\sqrt{\gamma t^2+\delta } $ is used. 
A: We have that $$\frac{x^2+1}{x}=\frac{t^2+1}{t^2-1}\tag{1}$$ so $$\frac{\sqrt{x^2-x+1}}{1-x^2}=\frac{\sqrt{x\left(\frac{t^2+1}{t^2-1}-1\right)}}{1-x\cdot\frac{t^2+1}{t^2-1}+1}=\frac{(t^2-1)\sqrt{\frac{2x}{t^2-1}}}{2(t^2-1)-x(t^2+1)}=\frac{\sqrt{2x(t^2-1)}}{2(t^2-1)-x(t^2+1)}$$ and you can further invoke $(1)$ to solve for $x$ to be substituted into the above expression.
