I'm having a hard time:
- (1) visualizing the function $z = |x-y|$
- (2) finding the limits of integration of $x$ and $y$ over the unit square.
Do you guys have any tips to help me get started? I graphed the function on an online graphing application and saw that it's like a semi-folded diamond. But, I have no clue how to define the bounds of integration over the unit square.
Thanks!
I assume the unit square is the region $$ S = \{ (x,y) \colon 0\le x\le 1\text{ and }0\le y \le 1 \} $$
There are a couple ways to do this problem, the easiest is to do an area integral (double integral) over the region $S$.
(The other way would be to treat $z = |x-y|$ as a function of 3 variables and do a volume integral. Both methods amount to the same thing)
We need to integrate the surface $f(x,y) = |x-y|$ over the region $S$.
The first step to doing this is getting an intuition on what this graph looks like. Since you have already employed 3d graphing tools, we could skip this step. However, since this is a useful skill and you specifically ask how to do it, I will explain the method I would use.
I would graph a series of 2d plots in planes parallel to the zx-plane and zy-plane. For example, I would graph the function in the plane $x=0$ (the same as the zy-plane). The function reduces to $f(y)= |y|$. We already know what this looks like. Then I would graph $f$ in the $x=1$ plane: $f(y) =|1-y|$. We know what this looks like too. After you do this for a series of $x$ values, a picture should coalesce. We should have some idea of what this thing is doing.
Now for the actual integration. Here we have to realize what absolute value is. Absolute value is a piece-wise defined function: $$ |k| = k \text{ if } k\ge 0$$ $$ \text{ or } -k \text{ otherwise} $$
What this tells us is that we need to split or domain (region $S$ ) into parts where $x-y$ is positive and parts where $x-y$ is negative. Conveniently the these two areas are split by the line $y=x$ (it should be fairly obvious why this is the case). We need to integrate $x-y$ over the "positive" region,$S_1$ (bottom half of unit square) and $-(x-y)$ over the negative region, $S_2$ (top half of unit square), as indicated by the piece-wise definition of $|k|$.
So we have
$$ \int_S |x-y|dA = \int_{S_1} (x-y)dA + \int_{S_2}(y-x)dA$$
which becomes $$ = \int_0^1\int_0^x(x-y)dydx + \int_0^1\int_0^y(y-x)dxdy $$
Hopefully this is helpful. And hopefully I didn't make an arithmetic errors in here.