Double Integral 70
Easy Iterated Integrals

Calculate the following integral: double integral over 0

Calculate the following integral: $$ \iint_{\substack{0\leqslant x\leqslant1\\0\leqslant y\leqslant1}} |x-y|\,dx\,dy. $$

Explanation of Method

The diagonal $x=y$ splits the unit square into two congruent triangles, on which $|x-y|$ equals $x-y$ and $y-x$ respectively. By the symmetry $x\leftrightarrow y$, both triangles contribute equally, so it suffices to compute one and double it.

  1. Split the square along the diagonal $x=y$.
  2. Integrate $x-y$ over the triangle $x\geqslant y$.
  3. Double the result by symmetry.

Step 1 · Split the region

On the triangle $x\geqslant y$ (vertices $(0,0)$, $(1,0)$, $(1,1)$), $|x-y|=x-y$; on the triangle $x\leqslant y$ (vertices $(0,0)$, $(0,1)$, $(1,1)$), $|x-y|=y-x$. By the symmetry $x\leftrightarrow y$, both integrals are equal, so $I=2I_1$ where $I_1$ is the integral over $x\geqslant y$.

Step 2 · Set up and integrate $I_1$

$$ I_1 = \int_0^1\int_0^x (x-y)\,dy\,dx = \int_0^1\left[xy-\frac{y^2}{2}\right]_0^x dx = \int_0^1\frac{x^2}{2}\,dx = \frac16. $$

Step 3 · Combine the results

$$ I = 2I_1 = 2\cdot\frac16 = \frac13. $$


Additional Notes

Result

The solution to the integral is:

$$ \iint_{\substack{0\leqslant x\leqslant1\\0\leqslant y\leqslant1}} |x-y|\,dx\,dy = \frac13. $$