I am trying to calculate the following integral $$I=\int\dfrac{dx}{x\sqrt{2+x-x^2}}$$
The answer in my textbook is $$-\dfrac{1}{\sqrt2}\ln\bigl|\dfrac{\sqrt{2+x-x^2}+\sqrt2}{x}+\dfrac{1}{2\sqrt2}\bigr|$$
Note that $-x^2+x+2=-(x+1)(x-2)=(2-x)(x+1),$ so the second Euler substitution is applicable. Let $$\sqrt{2+x-x^2}=t(x+1)$$ $$\sqrt{x+1}\sqrt{2-x}=t(x+1)$$ $$\sqrt{2-x}=t\sqrt{x+1} $$ $$2-t^2=x(1+t^2)$$ $$ x=\dfrac{2-t^2}{1+t^2}$$ Now we need $$\sqrt{2+x-x^2}=\dfrac{3t}{1+t^2}$$ and $$dx=\dfrac{-6t}{(1+t^2)^2}dt$$
So $$I=\int\dfrac{\frac{-6t}{(1+t^2)^2}dt}{\frac{2-t^2}{1+t^2}\cdot\frac{3t}{1+t^2}}=-2\int\dfrac{dt}{2-t^2}$$
Well, I don't see where my mistake is, but integrating the function $\dfrac{1}{(2-t^2)^2}$ won't be fun, even though it is rational.
So what am I missing, why does this problem become so technically diffucult, and what else should I try? Thanks!