The best way of integrating irrational functions Ok, so, here is the example integral:
$$I=\int\frac{x-2-\sqrt{-x^2-4x+4}}{x^2-\sqrt{-x^2-4x+4}}dx$$
I always solve these types of integrals using Euler's substitutions, but, recently, I came across some more difficult integrals like the one above which, after using Euler's substitution, become the integral of a rational function which is too complex to calculate, or at least to me.
So, what I did with the integral above is use second Euler's substitution:
$$\sqrt{ax^2+bx+c}=x\cdot t \pm \sqrt{c}$$
which gives:
$$\sqrt{-x^2-4x+4}=x\cdot t-2$$
Then, we have:
$$x=\frac{4-2t}{1-t^2},\ \ \ dx=\frac{2(t^2-1)+2t(4-2t)}{(1-t^2)^2}dt$$
After the substitution, the integral becomes:
$$I=\int \frac{\frac{4-2t}{1-t^2}-2-\frac{4-2t}{1-t^2}\cdot t+2}{\frac{(4-2t)^2}{(1-t^2)^2}-\frac{4-2t}{1-t^2}\cdot t+2}\cdot \frac{2(t^2-1)+2t(4-2t)}{(1-t^2)^2}dt$$
Which, after some calculation is:
$$I=\int\frac{8-40t+24t^3-8t^4}{2t^3-6t^2+14t-14}dt$$
Then, I can divide them and get two integrals, one from the table and the other one of a rational function with numerator's degree lower than denominator's.
Then, I should integrate that remaining rational function, but I'm not sure how, since I can't factor the polynomial in denominator.
My question is, is there a simpler way to calculate integrals like this one and if there isn't, what do I do with the remaining integral of rational function? What if I get a polynomial of degree $5$, $6$, $7$ etc. in denominator?
Thank you for your time.
There is a mistake in your computation. I added my comments here since there is a limited number of characters I can put into the comment window.
\begin{equation}
x=\frac{4-2t}{1-t^2},\ \ \ dx=\frac{-2(t^2-4 t+1)}{(1-t^2)^2}dt
\end{equation}
Then after the substitution, the integral becomes: 
\begin{equation}
I=\int \frac{\frac{4-2t}{1-t^2}-2-\frac{4-2t}{1-t^2}\cdot t+2}{\frac{(4-2t)^2}{(1-t^2)^2}-\frac{4-2t}{1-t^2}\cdot t+2}\cdot \frac{-2(t^2-4 t+1)}{(1-t^2)^2}dt
\end{equation}
Which, after some calculation is:
\begin{equation}
I=\int \frac{2 (t-2) ((t-4) t+1)}{(t+1) (t (t-2) (2 t+5)+9)} dt
\end{equation}
Then, I can divide them and get two integrals:
\begin{equation}
I=\int \frac{-2}{(t+1)} dt + \int \frac{6 t^2-16 t+14}{2 t^3+t^2-10 t+9} dt =-2 \log (t+1) +\int \frac{6 t^2+2 t -10}{2 t^3+t^2-10 t+9}+\int \frac{24- 18 t}{2 t^3+t^2-10 t+9}=-2 \log (t+1)+\log (2 t^3+t^2-10 t+9)+2 \int \frac{12- 9 t}{2 t^3+t^2-10 t+9}
\end{equation}
There is a mistake in your computation. I added my comments here since there is a limited number of characters I can put into the comment window.
\begin{equation}
x=\frac{4-2t}{1-t^2},\ \ \ dx=\frac{-2(t^2-4 t+1)}{(1-t^2)^2}dt
\end{equation}
Then after the substitution, the integral becomes: 
\begin{equation}
I=\int \frac{\frac{4-2t}{1-t^2}-2-\frac{4-2t}{1-t^2}\cdot t+2}{\frac{(4-2t)^2}{(1-t^2)^2}-\frac{4-2t}{1-t^2}\cdot t+2}\cdot \frac{-2(t^2-4 t+1)}{(1-t^2)^2}dt
\end{equation}
Which, after some calculation is:
\begin{equation}
I=\int \frac{2 (t-2) ((t-4) t+1)}{(t+1) (t (t-2) (2 t+5)+9)} dt
\end{equation}
Then, I can divide them and get two integrals:
\begin{equation}
I=\int \frac{-2}{(t+1)} dt + \int \frac{6 t^2-16 t+14}{2 t^3+t^2-10 t+9} dt =-2 \log (t+1) +\int \frac{6 t^2+2 t -10}{2 t^3+t^2-10 t+9}+\int \frac{24- 18 t}{2 t^3+t^2-10 t+9}=-2 \log (t+1)+\log (2 t^3+t^2-10 t+9)+2 \int \frac{12- 9 t}{2 t^3+t^2-10 t+9}
\end{equation}