Evaluating $\int\limits_a^b x (b-x)^{n-1} (x-a)^{k-n} dx$ I have an integral:
$$\int\limits_a^b x (b-x)^{n-1} (x-a)^{k-n} \, dx$$
Where $0 \leq a \leq b$ are fixed/known reals and $1 \leq n \leq k$ are fixed/known integers.
At first I thought binomial theorem but I think that requires the variables to have absolute value under $1$.
How can I tackle this?
 A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
Set $\ds{x \equiv a + \pars{b - a}t}$:
\begin{align}
&\bbox[10px,#ffd]{\int_{a}^{b}x\pars{b - x}^{n - 1}
\pars{x - a}^{k - n}\,\dd x}
\\[5mm] = &\
\int_{0}^{1}\bracks{a + \pars{b - a}t}
\bracks{\pars{b - a}\pars{1 - t}}^{n - 1}
\bracks{\pars{b - a}t}^{n - k}\pars{b - a}\dd t
\\[5mm] = &\
\pars{b - a}^{2n -k}\bracks{%
a\int_{0}^{1}t^{n - k}\pars{1 - t}^{n - 1}\dd t +
\pars{b - a}\int_{0}^{1}t^{n - k + 1}\pars{1 - t}^{n - 1}\,\dd t}
\\[5mm] = &\
\pars{b - a}^{2n -k}\bracks{%
a\,{\Gamma\pars{n - k + 1}\Gamma\pars{n} \over
\Gamma\pars{2n - k + 1}} +
\pars{b - a}{\Gamma\pars{n - k + 2}\Gamma\pars{n} \over
\Gamma\pars{2n - k + 2}}}
\\[5mm] = &\
\pars{b - a}^{2n -k}\bracks{%
a\,{\Gamma\pars{n - k + 1}\Gamma\pars{n} \over
\Gamma\pars{2n - k + 1}} +
\pars{b - a}{\pars{n - k + 1}\Gamma\pars{n - k + 1}\Gamma\pars{n} \over
\Gamma\pars{2n - k + 2}}}
\\[5mm] = &\
\bbx{\pars{b - a}^{2n - k}\,\bracks{\pars{a + b}n - bk + b}\,
{\Gamma\pars{n - k + 1}\Gamma\pars{n} \over
\Gamma\pars{2n - k + 2}}}
\end{align}
A: Start with the following substitution: $$\frac{b-x}{b-a}=t \Rightarrow x=b-(b-a)t\Rightarrow dx=-(b-a)dt$$
This will give us:
$$I=\int_{a}^{b} \color{red}{x} \color{blue}{(b-x)^{n-1}} \color{green}{(x-a)^{k-n}} dx$$
$$=(b-a)\int_0^1\color{red}{(b-t(b-a))} \color{blue}{((b-a)t)^{n-1}}\color{green}{((1-t)(b-a))^{k-n}}dt$$
$$=\color{orange}{(b-a)^{k}}\int_0^1 \color{red}{(b-t(b-a))}\color{blue}{t^{n-1}}\color{green}{(1-t)^{k-n}}dt$$
Now split in two parts and use the Beta function to get:
$$I=(b-a)^k \left(b\int_0^1 t^{n-1}(1-t)^{k-n}dt-(b-a)\int_0^1 t^n(1-t)^{k-n}dt\right)$$
$$=(b-a)^k \left(bB(n,k-n+1)-(b-a)B(n+1,k-n+1)\right)$$
$$=(b-a)^{k}\left(b\frac{\Gamma(n)\Gamma(k-n+1)}{\Gamma(k+1)}-(b-a)\frac{\Gamma(n+1)\Gamma(k-n+1)}{\Gamma(k+2)}\right)$$
$$=(b-a)^k\left(b\frac{(n-1)!(k-n)!}{k!}-(b-a)\frac{n!(k-n)!}{(k+1)!}\right)$$
$$=(b-a)^k\frac{n!(k-n)!}{k!}\left(\frac{b}{n}-\frac{b-a}{k+1}\right)=\boxed{\frac{(b-a)^k}{\binom{k}{n}}\left(\frac{b}{n}-\frac{b-a}{k+1}\right)}$$
