TITLE: Another messy integral: $I=\int \frac{\sqrt{2-x-x^2}}{x^2}\ dx$
QUESTION [7 upvotes]: I found the following question in a practice book of integration:-
$Q.$ Evaluate $$I=\int \frac{\sqrt{2-x-x^2}}{x^2}\ dx$$ For this I substituted $t^2=\frac {2-x-x^2}{x^2}\implies x^2=\frac{2-x}{1+t^2}\implies 2t\ dt=\left(-\frac4{x^3}+\frac 1{x^2}\right)\ dx$. Therefore $$\begin{align}I&=\int\frac {\sqrt{2-x-x^2}}{x^2}\ dx\\&=\int \left(\frac tx\right)\left(\frac{2t\ dt}{-\frac4{x^3}+\frac 1{x^2}}\right)\\&=\int \frac{2t^2\ dt}{\frac{x-4}{x^2}}\\&=\int \frac{2t^2(1+t^2)\ dt}{{x-4}\over{2-x}}\\&=\int \frac{2t^2(1+t^2)(5+4t^2-\sqrt{8t^2+9})\ dt}{\sqrt{8t^2+9}-(8t^2+9)}\end{align}$$ Now I substituted $8t^2+9=z^2 \implies t^2=\frac {z^2-9}8 \implies 2t\ dt=z/4\ dz$. So, after some simplification, you get $$\begin{align}I&=-\frac1{512}\int (z^2-9)(z+1)(z-1)^2\ dz\end{align}$$ I didn't have the patience to solve this integration after all these substitutions knowing that it can be done (I think I have made a mistake somewhere but I can't find it. There has to be an $ln(...)$ term, I believe). Is there an easier way to do this integral, something that would also strike the mind quickly? I have already tried the Euler substitutions but that is also messy.

REPLY [4 votes]: Let $$\displaystyle I = \int \frac{\sqrt{2-x-x^2}}{x^2}dx = \int \sqrt{2-x-x^2}\cdot \frac{1}{x^2}dx\;, $$ Now Using Integration by parts
$$\displaystyle I = -\frac{\sqrt{2-x-x^2}}{x}-\int\frac{1+2x}{2\sqrt{2-x-x^2}}\cdot \frac{1}{x}dx $$
So $$\displaystyle I = -\frac{\sqrt{2-x-x^2}}{x}-\underbrace{\int\frac{1}{\sqrt{2-x-x^2}}dx}_{J}-\underbrace{\int\frac{1}{x\sqrt{2-x-x^2}}dx}_{K}$$
So for Calculation of $$\displaystyle J = \int\frac{1}{\sqrt{2-x-x^2}}dx = \int\frac{1}{\sqrt{\left(\frac{3}{2}\right)^2-\left(\frac{2x+1}{2}\right)^2}}dx$$
Now Let $\displaystyle \left(\frac{2x+1}{2}\right)=\frac{3}{2}\sin \phi\;,$ Then $\displaystyle dx = \frac{3}{2}\cos \phi d\phi$
So we get $$\displaystyle J = \int 1d\phi = \phi+\mathcal{C_{1}} = \sin^{-1}\left(\frac{2x+1}{3}\right)+\mathcal{C}$$
Similarly for calculation of $$\displaystyle K = \int \frac{1}{x\sqrt{2-x-x^2}}dx$$
Put $\displaystyle x=\frac{1}{u}$ and $\displaystyle dx = -\frac{1}{u^2}dt$
So we get $$\displaystyle K = -\int\frac{1}{\sqrt{2u^2-u-1}}du = -\frac{1}{\sqrt{2}}\int\frac{1}{\sqrt{\left(u-\frac{1}{4}\right)^2-\left(\frac{3}{4}\right)^2}}dx$$
So we get $$\displaystyle J = -\frac{\sqrt{2}}{3}\ln\left|\left(u-\frac{1}{4}\right)+\sqrt{\left(u-\frac{1}{4}\right)^2-\left(\frac{3}{4}\right)^2}\right|+\mathcal{C_{2}}$$
So we get $$\displaystyle J = -\frac{\sqrt{2}}{3}\ln\left|\left(\frac{1}{x}-\frac{1}{4}\right)+\sqrt{\left(\frac{1}{x}-\frac{1}{4}\right)^2-\left(\frac{3}{4}\right)^2}\right|+\mathcal{C_{2}}$$
So $$\displaystyle I = -\frac{\sqrt{2-x-x^2}}{x}-\sin^{-1}\left(\frac{2x+1}{3}\right)+\frac{\sqrt{2}}{3}\ln\left|\left(\frac{1}{x}-\frac{1}{4}\right)+\sqrt{\left(\frac{1}{x}-\frac{1}{4}\right)^2-\left(\frac{3}{4}\right)^2}\right|+\mathcal{C}$$