Double Integral of absolute value How should I calculate the integral of $\int _0^1\:\:\int _0^1\:\left|x-y\right|dxdy$?
I understand that I need to split in two parts: $x<y$ and $x\ge y$
But I don't understand how to calculate it.
 A: a drawing can surely help you. when $x<y$ the integral is in the triangle above the line $x=y$ thus you have
$$\int_0^1\Bigg[\int_x^1(y-x)dy\Bigg]dx$$
when $x>y$ the integral is defined in the triangle under the line $x=y$ thus you have
$$\int_0^1\Bigg[\int_0^x(x-y)dy\Bigg]dx$$
Calculate the two integral and get the sum as a result
A: Hint: $$\left\{ (x,y) : 0\leq x\leq 1, 0 \leq y \leq 1\right\} = \left\{ (x, y) : 0\leq x \leq 1, 0 \leq y < x\right\} \cup  \left\{ (x, y) : 0\leq x \leq 1, x\leq y \leq 1\right\} $$
is disjoint, so integral equal to sum of integrals over these two sets.
Also, using geometric interpretation may help: this integral equal to doubled (because of symmetry) volume of pyramid with height 1 and right triangle with legs of length 1 in base.  So, integral equals $\frac{2}{3}\cdot\frac{1}{2}\cdot 1 = \frac{1}{3}$.
A: Your integral can be understood as an integral which its integrand is a piecewise function with respect to the region of integration.
$$\int _0^1\int _0^1f(x,y)\,dxdy$$
$$f(x,y) = |x-y| = \begin{cases}+(x-y), \: x\geq y \\ \\ -(x-y), \: x<y \end{cases}$$
So you have to split the region of integration in separate regions until you end up with "normal functions" for every one of them.
In your case, Yalikesifulei's answer and tommik's answer do the trick because $f(x,y)$ is fixed on $[+(x-y)]$ in the first region and fixed on $[-(x-y)]$ in the second one.
$$\int \int_D f(x,y)\,dxdy = \int \int_{D_1} f(x,y)\,dxdy + \int \int_{D_2} f(x,y)\,dxdy$$
$$D = D_1 \cup D_2$$
$$\left\{ (x,y) : 0\leq x\leq 1, 0 \leq y \leq 1\right\} = \left\{ (x, y) : 0\leq x \leq 1, 0 \leq y < x\right\} \cup  \left\{ (x, y) : 0\leq x \leq 1, x\leq y \leq 1\right\} $$
