Computing $ \int_a^b \frac{x^p}{\sqrt{(x-a)(b-x)}} \mathrm dx$

I would like to compute the integral:

$$ \int_a^b \frac{x^p}{\sqrt{(x-a)(b-x)}} \mathrm dx$$

where $$ a<b$$ and $$ p\in\mathbb{N}$$

$$ \int_a^b \frac{x^p}{\sqrt{(x-a)(b-x)}} \mathrm dx=\frac{2}{b-a} \int_a^b \frac{x^p \mathrm dx}{\sqrt{1-\left(\frac{2x-(a+b)}{b-a}\right)^2}} $$

The substitution $x\rightarrow \frac{2x-(a+b)}{b-a}$ gives:

$$ \frac{1}{2^p} \int_{-1}^{1} \frac{((b-a)x+a+b)^p}{\sqrt{1-x^2}} \mathrm dx$$

I tried to make an integration by parts:

$$ \frac{1}{2^p}\left(2^{p-1}\pi(a^p+b^p)-p(b-a) \int_{-1}^1 \arcsin(x)((b-a)x+a+b)^{p-1} \mathrm dx \right)$$

What about the integral $$ \int_{-1}^1 \arcsin(x)((b-a)x+a+b)^{p-1} \mathrm dx $$?


Let $x = a + (b-a)t$. Then $$I(p) = \int_0^1 \dfrac{(a+(b-a)t)^p}{\sqrt{t(1-t)}} dt$$ We have that $$\int_0^1 \dfrac{t^k dt}{\sqrt{t(1-t)}} = \sqrt{\pi} \dfrac{\Gamma(k+1/2)}{\Gamma(k+1)}$$ The above simplification is possible due to the following reason. Recall that the $\beta$ function is defined as $$\beta(x,y) = \int_0^1 t^{x-1} (1-t)^{y-1} dt$$ The $\beta$-function is closely related to the $\Gamma$ function through the relation $$\beta(x,y) = \dfrac{\Gamma(x) \Gamma(y)}{\Gamma(x+y)}.$$ The proof for the above claim can be seen here.

Hence, we get that $$\int_0^1 \dfrac{t^k dt}{\sqrt{t(1-t)}} = \int_0^1 t^{k-1/2} (1-t)^{-1/2} dt = \int_0^1 t^{(k+1/2)-1} (1-t)^{1/2-1} dt\\ = \beta(k+1/2,1/2) = \dfrac{\Gamma(k+1/2) \Gamma(1/2)}{\Gamma(k+1)} = \sqrt{\pi} \dfrac{\Gamma(k+1/2)}{\Gamma(k+1)}$$ Further, $$\Gamma(1/2) = \sqrt{\pi}$$ You can look up here for some particular values of the $\Gamma$ function. $$\Gamma(k+1/2) = \dfrac{(2k-1)(2k-3)\cdots 1}{2^k} \sqrt{\pi} \text{ where } k \in \mathbb{Z}^+$$ The above is so since $\Gamma(z+1) = z \Gamma(z)$ and $\Gamma(1/2) = \sqrt{\pi}$. $$\Gamma(k+1) = k! \text{ where } k \in \mathbb{Z}^+$$ $$\dfrac{\Gamma(k+1/2)}{\Gamma(k+1)} = \dfrac{(2k-1)(2k-3)\cdots 1}{2^k k!} \sqrt{\pi} = \dfrac1{4^k} \binom{2k}{k} \sqrt{\pi}$$

Hence, $$I(p) = \int_0^1 \sum_{k=0}^{p} \binom{p}{k} a^{p-k}(b-a)^{k} \dfrac{t^{k}}{\sqrt{t(1-t)}} dt\\ = \displaystyle \sum_{k=0}^{p} \left(\binom{p}{k} a^{p-k}(b-a)^{k} \int_0^1 \dfrac{t^{k}}{\sqrt{t(1-t)}} dt \right)\\ = \pi \times \left( \sum_{k=0}^{p} \left( \binom{p}{k}\binom{2k}{k} \dfrac{a^{p-k}(b-a)^{k}}{4^k} \right) \right)$$

We have that $$I(0) = \pi$$ $$I(1) = \dfrac{a+b}{2} \pi$$ $$I(2) = \dfrac{3a^2+2ab+3b^2}{8} \pi$$ $$I(3) = \dfrac{5a^3+3a^2b+3ab^2+5b^3}{16} \pi$$

I am not sure if you can simplify this further in terms of elementary functions.


I would probably find it easiest to reduce the given integral to Euler's integral for Gauss's hypergeometric function: $$ \int_a^b \frac{ x^p \mathrm{d} x}{\sqrt{(b-x)(x-a)}} \stackrel{x = a+(b-a) u}{=} \int_0^1 \frac{(a+(b-a)u)^p }{\sqrt{u(1-u)}} \mathrm{d} u = \\ a^p \int_0^1 u^{-\frac{1}{2}} \left(1-u\right)^{-\frac{1}{2}} \left( 1- \left(1-\frac{b}{a}\right) u \right)^p \mathrm{d} u $$ This is the case of the Euler integral representation of the Gauss's hypergeometric function with parameters $\alpha = \frac{1}{2}$, $\gamma=1$ and $\beta = -p$ and $z=1-\frac{b}{a}$, hence $$ \int_a^b \frac{ x^p \mathrm{d} x}{\sqrt{(b-x)(x-a)}} = a^p \cdot \underbrace{\mathrm{B}\left(\frac{1}{2}, \frac{1}{2}\right)}_{\pi} \cdot {}_2 F_1\left(\frac{1}{2}, -p ; 1; 1 - \frac{b}{a}\right) $$ The hypergeometric series terminates for $p\in \mathbb{N}$, and the result coincides with that of @Marvis, but the above result extends to all the complex values of $p$:

In[29]:= With[{a = 2.4, b = 3.6, p = 3.4}, 
 a^p \[Pi] Hypergeometric2F1[1/2, -p, 1, 1 - b/a]]

Out[29]= 142.388

In[30]:= With[{a = 2.4, b = 3.6, p = 3.4}, 
 NIntegrate[x^p/Sqrt[(b - x) (x - a)], {x, a, b}]]

Out[30]= 142.388