<s>[INST] How to compute $\int_a^b (b-x)^{\frac{n-1}{2}}(x-a)^{-1/2}dx$? I wonder how to compute the following integral (for any natural number $n\geq 0$):
$$\int_a^b (b-x)^{\frac{n-1}{2}}(x-a)^{-1/2}dx.$$
Does anyone know the final answer and how to get there? Is there a trick?
Thank you very much!
 [/INST] $$I=\int_a^b\frac{\sqrt{b-x}^{\,n}}{\sqrt{(b-x)(x-a)}}\,dx$$
$$x=a\cos^2 t+b\sin^2 t:$$
$$\begin{align*}I&=\int_0^{\pi/2}\frac{2(b-a)\cos t\sin t\cdot\sqrt{(b-a)\cos^{2}t}^{\,n}}{\sqrt{(b-a)^2\cos^2 t\sin^2 t}}\,dt\\[7pt]&=2\sqrt{b-a}^{\,n}\int_0^{\pi/2}\cos^{n}t\,dt\\[7pt]&= \left\{ 
  \begin{array}{l l}
    \pi\sqrt{b-a}^{\,n}\frac{1\cdot 3\cdots (n-1)}{2\cdot 4\cdots n}\quad(n\;\text{even})\\[7pt]
    2\sqrt{b-a}^{\,n}\frac{2\cdot 4\cdots (n-1)}{1\cdot 3\cdots n}\quad(n\;\text{odd})
  \end{array} \right.\end{align*}$$
$$\star$$
The latter integral is well known, and can easily be evaluated by parts:
$$\begin{align*}I_n=\int_0^{\pi/2}\cos^nt\,dt\Rightarrow I_n&=(n-1)\int_0^{\pi/2}\sin^2 t\cos^{n-2}t\,dt\\[7pt]&=(n-1)I_{n-2}-(n-1)I_{n}\\[7pt]&\qquad\Rightarrow I_n=\frac{n-1}{n}I_{n-2}\\[7pt]&\qquad\qquad\Rightarrow\left\{ 
  \begin{array}{l l}
    I_n=\frac{1\cdot 3\cdots (n-1)}{2\cdot 4\cdots n}I_0\;(n\;\text{even})\\[7pt]
    I_n=\frac{2\cdot 4\cdots (n-1)}{1\cdot 3\cdots n}I_1\;(n\;\text{odd})\end{array}\right. \\[7pt]&\qquad\qquad\qquad\big(I_0=\dfrac{\pi}{2}\,\;\;I_1=1\big)\end{align*}$$
</s>