# Integrating a function over a domain

How could you integrate the function $f(x,y) = x^2 + y^2$ over the triangle with vertices $(0,0)$, $(0,1)$ and $(1,0)$?

I define the set $D = \{(x,y)\; |\; 0\leq x\leq 1 \text{ and } 0\leq y\leq x\}$ and then calculate

$$\int_0^1 \int_0^x x^2 + y^2 \; \mathrm{d}y \; \mathrm{d}x = \frac{1}{3},$$

but apparantly the answer is $\frac{1}{6}$.

-
The answer is definitely 1/6. The first integration will give you $\frac{2x^3}{3}$.... – Simon Hayward Dec 11 '12 at 20:29

I think you have the limits changed and wrong. I think it must be

$$\int_0^1dx\int_0^{1-x}(x^2+y^2)dy=\int_0^1\left.\left(x^2y+\frac{1}{3}y^3\right|_0^{1-x}\right)dx=\int_0^1\left(x^2(1-x)+\frac{1}{3}(1-x)^3\right)dx=$$

$$=\frac{1}{3}-\frac{1}{4}-\frac{1}{12}(0-1)=\frac{2}{12}=\frac{1}{6}$$

-
Thanks a lot. What about if we integrate over a different domain. For example the triangle with vertices $(0,0)$, $(1,0)$, $(1,2)$. How do we define $D$? $D=\{ (x,y)\;|\; 0\leq x \leq 1 \;\;\; 0\leq y \leq 2x\}$ Is this right? – inttri Dec 11 '12 at 20:34
Yes, it is right in that case. – DonAntonio Dec 11 '12 at 20:36

You are mistaken in defining the integration domain. Correct domain is $$D = \{(x,y) |\;\; 0\leqslant x\leqslant 1, \;\; \; 0\leqslant y\leqslant 1-x\}$$

-

Look at the graph of the region. You have described this region

However, the region in question is really this one.

Thus, your domain is $$D=\{(x,y)|0\le x \le 1 \text{ and } 0 \le y \le 1-x\}$$

I believe you can take it from here.

-