TITLE: How to integrate $\int_a^b (x-a)(x-b)\,dx=-\frac{1}{6}(b-a)^3$ in a faster way?
QUESTION [6 upvotes]: $\displaystyle \int_a^b (x-a)(x-b)\,dx=-\frac{1}{6}(b-a)^3$
$\displaystyle \int_a^{(a+b)/2} (x-a)(x-\frac{a+b}{2})(x-b)\, dx=\frac{1}{64}(b-a)^4$ 
Instead of expanding the integrand, or doing integration by part, is there any faster way to compute this kind of integral?

REPLY [5 votes]: You can first get rid of the integration bounds by the linear transform $a+(b-a)t$:
$$\int_a^b (x-a)(x-b)\,dx=(b-a)^3\int_0^1t(t-1)\,dt.$$
Mentally expanding the polynomial, the integral is $\frac13-\frac12=-\frac16$.
For the other case, $a+(b-a)t/2$:
$$ \int_a^{(a+b)/2} (x-a)(x-\frac{a+b}{2})(x-b)\, dx=\frac{(b-a)^4}{16}\int_0^1t\left(t-1\right)(t-2)\,dt.$$
Also mentally, $(\frac14-1+1)$$\frac1{16}=\frac1{64}$.

Also, using a remark by @mickep, Newton's formula applies and
$$\int_0^1t(t-1)\,dt=\frac16\left(0-4\frac12\frac12+0\right)=-1,$$
$$\int_0^1t(t-1)(t-2)\,dt=\frac16\left(0+4\frac12\frac12\frac32+0\right)=\frac14.$$