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?
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)}$$