<s>[INST] How to integrate $\int_a^b (x-a)(x-b)\,dx=-\frac{1}{6}(b-a)^3$ in a faster way? $\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?
 [/INST] One way is to use Simpson's rule.
Without it, one could argue what is faster, but: 
If $A=(a+b)/2$ and $D=(b-a)/2$, then your first integrand is
$$
(x-A+D)(x-A-D)=(x-A)^2-D^2.
$$
Thus
$$
\begin{aligned}
\int_a^b (x-a)(x-b)\,dx &=\frac{1}{3}\bigl((b-A)^3-(a-A)^3\bigr)-2D^3\\
&=\frac{1}{3}\bigl(D^3+D^3)-2D^3=-\frac{1}{6}(b-a)^3.
\end{aligned}
$$
For the second one you write the integrand as
$$
\bigl((x-A)^2-D^2\bigr)(x-A)=(x-A)^3-D^2(x-A)
$$
and do a similar calculation. I leave that to you.
</s>