# Where do I fail with this integral (coordinates on a simplex)?

Let us regard the standard simplex in two dimensions

$S = \{ x_1 + x_2 \leq 1, x_1 \geq 0, x_2 \geq 0 \}$

Where does the following calculation fail:

$\int_S x_1^2 = \int_0^1 x_1^2 \int_0^{1-x_1} dx_2 dx_1 = \int x_1^2 ( 1 - x_1 ) dx_1 = \int_0^1 x_1^2 - x_1^3 dx_1 = \frac{1}{3} - \frac{1}{4} = \frac{1}{12}$

while

$\int_S x_1^2 = \int_0^1 \int_0^{1-x_2} x_1^2 dx_1 dx_2 = \int_0^1 \dfrac{(1-x_2)^3}{3} dx_2 = \frac{1}{3}\sum^3_{i=0}\int_0^1 x_2^i dx_2 = \frac{1}{3}\sum^3_{i=0} \dfrac{1}{i+1} dx_2$

$= \frac{1}{3}( \frac{1}{1} - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} ) = \frac{7}{36}$

I suppose the error is the error is in the first equality signs (except I have done some very dumb mistake that I am blind to.

-
thank you very much for pointing out this mistake. - This is, btw, motivated by an algorithm to compute integrals like the above, so there is more behind the question than just an oddity. – shuhalo Oct 19 '11 at 22:57

You wanted $$\int \frac{(1-x_2)^3}{3}\,dx_2,$$ and decided to expand $(1-x_2)^3$ and integrate term by term.
Note that by the Binomial Theorem, or otherwise, $$(1+t)^3=1+3t+3t^2+t^3,$$ so $(1-x_2)^3=1-3x_2 +3x_2^2-x_2^3$.
Expanding is in any case an inefficient way to evaluate the integral. Instead, make the substitution $u=1-x_2$. Then our integral becomes $$\int_1^0 -\frac{u^3}{3}\,du.$$
My goal is scheme for monomials on a simplex. If the polynomial is $x_1 x_2$, then you get a mixed expression $x_1(1-x_1)^2/2$, and substitution does not substantially change the expression. In case there is a better form for $x^k_1(1-x_1)^l$ in general, I am eager to know. – shuhalo Oct 19 '11 at 23:32
@Martin: For $\int_0^1 t^m(1-t)^n\,dt$, where $m$ and $n$ are non-negative integers, there is, as I am sure you know, a simple explicit expression. Without loss of generality assume $m \le n$, else make the change of variable $t'=1-t$. Integrate by parts, letting $u=t^m$ and $dv=(1-t)^n\,dt$. Very conveniently, $uv$ dies at $0$ and $1$, so we get $\frac{m}{n+1}\int_0^1 t^{m-1}(1-t)^{n+1}\,dt$. Keep doing this, until the exponent of $t$ shrinks to $0$. We get that our original integral is a simple ratio of products, which can if we wish be rewritten in terms of binomial coefficients. – André Nicolas Oct 20 '11 at 0:32