<s>[INST] Complicated integration How can this be integrated? :
$$\int_{b}^{a} x \left ( \frac{D}{a-b} \right ) \left ( \frac{a-x}{a-b} \right )^{D-1}dx$$
The solution is :
$$\frac{a+(D)(b)}{D+1}$$
 [/INST] \begin{align}
S &= \int_{b}^{a} x \left( \frac{D}{a-b} \right) \left( \frac{a-x}{a-b} \right)^{D-1} \,\mathrm{d}x \\\\
&= \frac{D}{\left(a-b\right)^D} \int_b^a x(a-x)^{D-1}\,\mathrm{d}x\\\\
&= \frac{D}{\left(a-b\right)^D} \int_b^a x(a-x)^{D-1}\,\mathrm{d}x
\end{align}
Let $y=a-x$ so that $x=a-y$, and
\begin{align}
S&= \frac{D}{\left(a-b\right)^D} \int_b^a x(a-x)^{D-1}\,\mathrm{d}x \\\\
&= \frac{D}{\left(a-b\right)^D} \int_{a-b}^0 (y-a)y^{D-1}\,\mathrm{d}y\\\\
&=\frac{D}{\left(a-b\right)^D} \left(\int_{a-b}^0 y^D\,\mathrm{d}y - a\int_{a-b}^0 y^{D-1}\,\mathrm{d}y\right)\\\\
&=\frac{D}{\left(a-b\right)^D} \left(a\int_0^{a-b} y^{D-1}\,\mathrm{d}y - \int_0^{a-b} y^D \,\mathrm{d}y\right)\\\\
&=\frac{D}{\left(a-b\right)^D} \left(\frac{a}{D}(a-b)^D-\frac{1}{D+1} (a-b)^{D+1}\right)\\\\
&=D\left(\frac{a}{D}-\frac{a}{D+1}+\frac{b}{D+1}\right)\\\\
&=D\left(\frac{aD+a}{D^2+D}-\frac{aD}{D^2+D}+\frac{bD}{D^2+D}\right)\\\\
&=\boxed{\displaystyle\frac{a+Db}{D+1}}
\end{align}
</s>