# Integrating a product of two functions - one lags the other

Integrating a product of two functions - one "lags" the other

I am wondering if there is a way to integrate the following function without first expanding the brackets:

$\int\limits_{x1}^{x2} x^2\left(x-a\right)^2\,dx$

The idea behind the question is a bit more complex than I am letting on, but this example gets to the heart of the problem.

____________________________________________________________________________

For the interested reader I will give a bit more background; I am really trying to do the following integral:

$\int\limits_{x1}^{x2} Bx_{k1}^{n1}(tx1(x))Bx_{k2}^{n2}(tx2(x))\,dx$

where the functions tx1 and tx2 return values ranging from [0,1] over the domain to be integrated. Actually, I can just tell you what they are.

$tx1=\frac{250x}{21}-\frac{5}{7}$ and $tx2=\frac{250x}{21}$ while $x_1=0.06$ and $x_2=0.084$

The Bx functions are Bernstein basis polynomials. In the above example, I have used the "square" function instead.

Note that I can solve this problem by converting the Bernstein polynomials to the power basis (this is akin to expanding the brackets in the original question). However, I am trying to avoid doing this for reasons of numerical stability and efficiency.