<s>[INST] $ \int \frac{x-4}{\sqrt{x^2-4x+5}}\, dx$ I'm trying to solve this irrational integral $$ \int \frac{x-4}{\sqrt{x^2-4x+5}}\, dx$$
doing the substitution
$$ x= \frac{5-t^2}{2 \cdot (2+t)}$$
according to the rule.
So the integral becomes:
$$ \int \frac{1}{2}  \cdot \frac{t^2+8t+11}{t^2+4t+5}\, dt =\frac{1}{2}  \int  1+\frac{4t+7}{t^2+4t+5}\, dt= \frac{1}{2}t+2 \ln (t+2)+\frac{1}{2}\frac{1}{t+2} + cost$$ with $t=-x+ \sqrt{x^2-4x+5}$
The final result according to my book is instead $\sqrt{x^2-4x+5}-2 \ln( x-2+ \sqrt{(x-2)^2+1})$
I don't understant why this difference.
Can someone show me where I'm making mistakes?
 [/INST] To check your results, here's an other approach
$$\int \frac{2x-4-4}{2\sqrt{(x-2)^2+1}}dx=$$
$$\sqrt{x^2-4x+5}-2\int \frac{dx}{\sqrt{(x-2)^2+1}}$$
put
$$x-2=\sinh(t)=\frac{e^t-e^{-t}}{2}$$
the last integrale becomes
$$\int dt=t+C$$
but
$$e^{2t}-2(x-2)e^t-1=0$$
gives
$$e^t=(x-2)+\sqrt{x^2-4x+5}$$
So, the final result is
$$\sqrt{x^2-4x+5}-$$
$$2\ln\Bigl((x-2)+\sqrt{x^2-4x+5}\Bigr)+C$$
</s>