How to integrate $\mid xy - x - y \mid $ I'm studying the region $D = \{(x,y)\in\mathbb{R}^2:0\leq x \leq 3 \land 2 \leq y \leq 4\}$ and I want to find where  $ xy - x - y \leq 0$ and  $ xy - x - y \geq 0$. I need to integrate the absolute value of this polynomial on $D$ and I want to spit the integral up. I just don't know how to split $D$ up, some help would be appreciated.
 A: Draw a figure! It shows the rectangle $D=[0,3]\times[2,4]$ and the hyperbola $(x-1)(y-1)=1$, whose right branch intersects the top and bottom edges of $D$ at $x={4\over3}$ and at $x=2$.  To simplify the computations we write the arc $\gamma$ within $D$ in the form
$$x={y\over y-1}\qquad(2\leq y\leq 4)\ .$$
To the left of $\gamma$ we have $xy-x-y<0$, and to the right of it we have $xy-x-y>0$. We therefore can write
$$\int_D|xy-x-y|\>{\rm d}(x,y)=\int_2^4\left(\int_0^{y/(y-1)}(x+y-xy)\>dx +\int_{y/(y-1)}^3(xy-x-y)\>dx\right) \,dy$$
My computer obtained $8+\log 3$ as end result.
A: Let us call $f(x,y)=x+y-xy$. Then you are interested in 
$$
A=\{(x,y)\in D~:~f(x,y)\geq 0\}\text{ and }B=\{(x,y)\in D~:~f(x,y)\leq0\}.
$$
First, we consider
$$
f(x,y)=x+(1-x)y.
$$
We can see that $x=1$ is somehow special. If $x\in[0,1]$ and $y\geq 0$, then $x+(1-x)y$ is a sum of two nonnegative numbers. Hence $f(x,y)\geq 0$. So we can see $[0,1]\times[2,4]\subseteq A$.
Next, for $x>1$ we see
$$
x+(1-x)y\geq 0\Leftrightarrow x\geq (x-1)y \Leftrightarrow y\leq \frac{x}{x-1}.
$$
Define $g(x)=\frac{x}{x-1}$. Then $A$ contains all $(x,y)$ below the graph of $g$. But $g(x)>4$ for $x\in\left(1,\frac43\right)$ and $g(x)<2$ for $x>2$. Therefore,
$$
A=\left[0,\frac43\right]\times[2,4]\cup \left\{(x,y)~:~2\leq y\leq g(x),~x\in\left[\frac43,2\right]\right\}
$$
and
$$
B=\left\{(x,y)~:~4\geq y\geq g(x),~x\in\left[\frac43,2\right]\right\}\cup[2,3]\times[2,4].
$$
