Solving double integral in GIF function $\displaystyle\int_{0}^{1}\int_{0}^{1}\left\lfloor\frac{x-y}{x+y}\right\rfloor\mathrm dx\mathrm dy$
I don’t know how to proceed even though I know how to integrate gif in single integral. Also I can draw graph but here how to draw?
I assumed $x-y=u$ and $x+y=v$ for change of variable but then I got stuck with the fraction $u/v$.
Please help me in this.
Thanks in advance.
 A: $\left\lfloor\dfrac{x-y}{x+y}\right\rfloor\!=\!0\;\;\,\forall(x,y)\!\in\![0,1]^2\!\setminus\!\{(0,0)\}$ such that $0\!<\!y\!\leqslant\!x$.
$\left\lfloor\dfrac{x-y}{x+y}\right\rfloor\!=\!1\;\;\,\forall(x,y)\!\in\![0,1]^2\!\setminus\!\{(0,0)\}$ such that $y\!=\!0$.
$\left\lfloor\dfrac{x-y}{x+y}\right\rfloor\!=\!-1\;\;\forall(x,y)\!\in\![0,1]^2\!\setminus\!\{(0,0)\}$ such that $y\!>\!x$.
Consequently,
$\displaystyle\int_{0}^{1}\!\!\!\int_{0}^{1}\left\lfloor\frac {x-y}{x+y}\right\rfloor\mathrm dx\mathrm dy=-\dfrac12\,$.
A: Let $\;T_1=\big\{(x,y):(x,y)\in[0,1]^2\,\land\;x<y\big\}\,.$
Let $\;T_2=\big\{(x,y):(x,y)\in[0,1]^2\,\land\;x>y\big\}\,.$
It results that
$\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\leqslant-1\;\;$ for all $\;(x,y)\in T_1\;,$
$\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\geqslant1\;\;$ for all $\;(x,y)\in T_2\;.$
We are going to prove that
$\displaystyle\iint_{T_1}\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy=-\infty\;.$
For any $\;k>0\;$ it results that
$\displaystyle\iint_{T_1}\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy\leqslant\!\iint_{T_1}\dfrac{x+y}{x-y}\,\mathrm dx\mathrm dy<\!\iint_{T_1}\dfrac{2x}{x-y}\,\mathrm dx\mathrm dy=$
$=\displaystyle\int_0^1\!\mathrm dx\int_x^1\!\dfrac{2x}{x-y}\,\mathrm dy<\!\int_{\frac12}^{\frac34}\!\mathrm dx\int_{x+\frac{1-x}{\exp(4k)}}^1\!\dfrac{2x}{x-y}\,\mathrm dy\leqslant$
$\displaystyle\leqslant\!\int_{\frac12}^{\frac34}\!\!\mathrm dx\int_{x+\frac{1-x}{\exp(4k)}}^1\!\dfrac1{x-y}\,\mathrm dy=\!\int_{\frac12}^{\frac34}\!\!\mathrm dx\bigg[\!-\!\log(y-x)\bigg]_{x+\frac{1-x}{\exp(4k)}}^1\!\!=$
$\displaystyle=\!\int_{\frac12}^{\frac34}\!\!\left[-\!\log(1\!-\!x)+\log\left(\!\frac{1\!-\!x}{\exp(4k)}\!\right)\right]\!\mathrm dx= \!\int_{\frac12}^{\frac34}\!\!\log\left(\!\frac1{e^{4k}}\!\right)\mathrm dx=$
$\displaystyle=\!\int_{\frac12}^{\frac34}\!\!-4k\,\mathrm dx=-k\;.$
Since $\displaystyle\iint_{T_1}\!\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy\!<\!-k\;$ for any $\;k>0\;,\;$ it follows that
$\displaystyle\iint_{T_1}\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy=-\infty\;.\quad\color{blue}{(1)}$
Analogously, we can prove that
$\displaystyle\iint_{T_2}\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy=+\infty\;.\quad\color{blue}{(2)}$
Consequently ,
$\displaystyle\int_0^1\!\!\!\int_0^1\!\left\lfloor\frac {x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy=\!\iint_{T_1\cup T_2}\!\left\lfloor\dfrac{x+y}{x-y}\right\rfloor\!\mathrm dx\mathrm dy\;\;$ is undefined.
A: Your substitution also works. We have
$$\begin{cases}u=x-y\\v=x+y\end{cases}\implies\begin{cases}x=\frac{u+v}2\\y=\frac{-u+v}2\end{cases}\implies\left|\frac{\partial(x,y)}{\partial(u,v)}\right|=\frac12$$
so the integral transforms to
$$\int_0^1\int_0^1\left\lfloor\frac{x-y}{x+y}\right\rfloor\,dx\,dy=\frac12\int_{-1}^1\int_{\max(-u,u)}^{\min(u+2,-u+2)}\left\lfloor\frac uv\right\rfloor\,dv\,du$$
The limits with respect to $v$ follow from plugging the boundaries of $[0,1]^2$ into the equations above.
$$x=0\implies u+v=0$$
$$x=1\implies u+v=2$$
$$y=0\implies u-v=0$$
$$y=1\implies u-v=-2$$
In other words, the starting square gets mapped to another square with area $2$, centered at $(0,1)$, and rotated by $45^\circ$.
Now,
$$\begin{cases} \displaystyle \min\left\{\frac uv : u<0 \land -u \le v\le u+2\right\} = -1 \\[1ex] \displaystyle \max\left\{ \frac uv : u<0 \land -u \le v \le u+2\right\} = 0 \end{cases} \implies \left\lfloor \frac uv \right\rfloor = -1$$
$$\begin{cases} \displaystyle \min\left\{\frac uv : u>0 \land u \le v\le -u+2\right\} = 0 \\[1ex] \displaystyle \max\left\{ \frac uv : u>0 \land u \le v \le -u+2\right\} = 1 \end{cases} \implies \left\lfloor \frac uv \right\rfloor = 0$$
It follows that
$$\int_0^1\int_0^1\left\lfloor\frac{x-y}{x+y}\right\rfloor\,dx\,dy = \frac12 \left(0 - \int_{-1}^0 \int_{-u}^{u+2} dv \, du\right) = \boxed{-\frac12}$$
