$I(a,b)=\int_a^bx^n(x-a)^{-1/2}(b-x)^{-1/2}dx$ How can we evaluate this integral for natural $n$?
$$I(a,b)=\int_a^bx^n(x-a)^{-1/2}(b-x)^{-1/2}dx$$
The integral is reminiscent of the beta function, but I couldn't connect them. I tried a trigonometric substitution, but the x^n made things difficult. I also tried the substitution $u=a+b-x$
$$I(a,b)=\int_a^b(a+b-x)^n(x-a)^{-1/2}(b-x)^{-1/2}dx$$
I don't know where to take it from there. I wanted to try using a dogbone contour, but I don't really have enough experience with that
 A: Given the integral
$$I(a,b)=\int_{a}^{b} x^n \, (x-a)^{-1/2} \, (b-x)^{-1/2} \, dx$$
then by making the change of variable $x = a + (b-a) \, t$ then the integral can be placed into the form
$$ I = a^n \, \int_{0}^{1} t^{-1/2} \, (1-t)^{-1/2} \, \left(1 - \frac{a-b}{a} \, t\right)^{n} \, dt.$$
This can be associated to the hypergeometric integral form
$${}_{2}F_{1}(a, b; c; z) = \frac{\Gamma(c)}{\Gamma(b) \, \Gamma(b-c)} \, \int_{0}^{1} t^{b-1} \, (1-t)^{c-b-1} \, (1 - z \, t)^{-a} \, dt $$
and leads to the form
$$ I = \pi \, a^n \, {}_{2}F_{1}\left(-n, \frac{1}{2}; 1; \frac{a-b}{a}\right).$$
Using
$$ {}_{2}F_{1}\left(-n, \frac{1}{2}; 1; z\right) = (1-z)^{n/2} \, P_{n}\left(\frac{2-z}{2 \, \sqrt{1-z}}\right),$$
where $P_{n}(x)$ is the Legendre polynomial, then
\begin{align}
I &= \pi \, a^n \, {}_{2}F_{1}\left(-n, \frac{1}{2}; 1; \frac{a-b}{a}\right) \\
&= \pi \, a^n \, \left(\frac{b}{a}\right)^{n/2} \, P_{n}\left(\frac{a+b}{2 \, \sqrt{a b}} \right) \\
I &= \pi \, (a \, b)^{n/2} \, P_{n}\left(\frac{a+b}{2 \, \sqrt{a \, b}}\right).
\end{align}
This gives
$$ \int_{a}^{b} x^n \, (x-a)^{-1/2} \, (b-x)^{-1/2} \, dx = \begin{cases} \pi \, a^n \, {}_{2}F_{1}\left(-n, \frac{1}{2}; 1; \frac{a-b}{a}\right) & \text{or} \\
\pi \, (a \, b)^{n/2} \, P_{n}\left(\frac{a+b}{2 \, \sqrt{a \, b}}\right) \end{cases}. $$
A: Let $x(t)=(1-t)a+tb$. Note that
$$\int_a^b f(x)\mathrm dx=\int_0^1 f(x(t))x'(t)\mathrm dt$$
In your example, this gives us
$$\int_a^b x^n (x-a)^{-1/2}(b-x)^{-1/2}\mathrm dx \\= \int_0^1 \big((1-t)a+tb\big)^n \big((1-t)a+tb-a\big)^{-1/2}(b-(1-t)a-tb)^{-1/2}\mathrm dt \\ \int_0^1 \big((1-t)a+tb\big)^n t^{-1/2}(b-a)^{-1/2}(1-t)^{-1/2}(b-a)^{-1/2}\mathrm dx \\ =\frac{1}{b-a}\int_0^1\big((1-t)a+tb\big)^n t^{-1/2}(1-t)^{-1/2}\mathrm dt$$
Now expand using the binomial theorem:
$$=\frac{1}{b-a}\int_0^1\bigg[\sum_{k=0}^n \binom{n}{k} a^{n-k}(1-t)^{n-k}b^k t^k\bigg] t^{-1/2}(1-t)^{-1/2}\mathrm dt \\ = \frac{1}{b-a}\sum_{k=0}^n\binom{n}{k}a^{n-k}b^k \int_0^1(1-t)^{n-k+1/2-1}t^{k+1/2-1} \mathrm dt$$
Now use the Beta function both on the integral and the binomial coefficient (https://proofwiki.org/wiki/Binomial_Coefficient_expressed_using_Beta_Function):
$$=\frac{1}{b-a}\sum_{k=0}^n  \frac{a^{n-k}b^k}{n+1}\frac{\mathrm B\left(n-k+\frac{1}{2},k+\frac{1}{2}\right)}{\mathrm B\left(n-k+1,k+1\right)}$$
Maybe there is a nicer way to express this, I'm not sure. Also this approach only works for integer $n$, there is probably a good way to extend it to non-integer $n$ using generalized hypergeometric function.
