Help computing a double integral on $|x-y|$ If $f(x) = x e^{-x^2}$, how can you compute the double integral:
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} |x-y|f(x)f(y)\,dx\,dy $$
I know that:
$$ \int x e^{-x^2} dx = -\frac{1}{2}e^{-x^2} + C$$
 A: Observe that the integral over the 1st and 3rd quadrants are the same; so are those of the 2nd and the 4th quadrants. So, rewrite the integral as,
$$I=2\left(\int_{Q_1}+\int_{Q_2}\right)   |x-y|f(x)f(y)\,dx\,dy $$
Furthermore, the 2nd-quadrant integral can be rewritten as an equivalent 1st quadrant one,
$$\int_{Q_2}  |x-y|f(x)f(y)\,dx\,dy =-\int_{Q_1} (x+y)f(x)f(y)\,dx\,dy $$
Thus, the integral $I$ becomes,
$$I=2\int_{Q_1}  |x-y|xy e^{-(x^2+y^2)}\,dx\,dy -2\int_{Q_1} (x+y)xy e^{-(x^2+y^2)}\,dx\,dy $$
Then, rewrite above integrals in polar coordinates and recognize the symmetry around $\theta=\pi/4$ in the first integral,
$$I=4\int_0^{\pi/4} (\cos^2\theta \sin\theta - \cos\theta \sin^2\theta)d\theta \int_0^{\infty}r^4 e^{-r^2}dr$$
$$ -2\int_0^{\pi/2}(\cos^2\theta \sin\theta + \cos\theta \sin^2\theta)
d\theta \int_0^{\infty}r^4 e^{-r^2}dr $$
Carrying out the integrals over $r$ and $\theta$ to obtain,
$$I = 4\times \frac 16 (2-\sqrt{2})\times \frac{3\sqrt{\pi}}{8}-2\times\frac 23\times \frac{3\sqrt{\pi}}{8} = -\frac{\sqrt{2\pi}}{4}$$
A: $$ I=\iint_{\mathbb{R}^2} xy|x-y| \exp\left[-(x^2+y^2)\right]\,dx\,dy $$
can be easily computed by switching to polar coordinates. It equals
$$ \int_{0}^{+\infty}\int_{0}^{2\pi}\rho^4 e^{-\rho^2}\cos\theta\sin\theta|\cos\theta-\sin\theta|\,d\theta\,d\rho $$
which by Fubini's theorem is simply the product between
$$ \int_{0}^{+\infty}\rho^4 e^{-\rho^2}\,d\rho = \frac{1}{2}\int_{0}^{+\infty}x\sqrt{x}e^{-x}\,dx = \tfrac{1}{2}\Gamma\left(\tfrac{5}{2}\right)=\frac{3\sqrt{\pi}}{8} $$
and
$$  \int_{0}^{\pi}\sin(2\theta)|\cos\theta-\sin\theta|\,d\theta $$
which can be computed by splitting $[0,\pi]$ into four congruent sub-intervals. The final outcome is 
$$ I = -\frac{3\sqrt{\pi}}{8}\cdot\frac{2\sqrt{2}}{3} = -\frac{\sqrt{2\pi}}{4}.$$
A: The substitution $x=u+v, y=u-v$ transforms the given integral into $$\iint_{\mathbb{R}^2}2|v|(u^2-v^2)e^{-2u^2-2v^2}(2\,du\,dv)=16(I_2 I_1-I_0 I_3),$$ where $I_k=\int_0^\infty x^k e^{-2x^2}\,dx$: $$I_0=\frac{\sqrt{\pi}}{2\sqrt{2}},\ I_1=\frac{1}{4},\ I_2=\frac{\sqrt{\pi}}{8\sqrt{2}},\ I_3=\frac{1}{8}$$ ($I_0$ is known, $I_1$ is evaluated like you noted, and the rest are done with integration by parts; alternatively, all four are evaluated using the $\Gamma$-function).
This is yet another "separating" substitution (suggested in my comment initially).
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[#ffe,15px]{\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\verts{x - y}\pars{x\expo{-x^{2}}}\pars{y\expo{-y^{2}}}\dd x\,\dd y}
\\[5mm] = &\
\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\bracks{\vphantom{A^{A^{A}}}\verts{z}\delta\pars{z - x + y}}
\pars{x\expo{-x^{2}}}\pars{y\expo{-y^{2}}}\dd x\,\dd y\,\dd z
\\[5mm] = &\
\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\bracks{\verts{z}\int_{-\infty}^{\infty}\expo{\ic k\pars{z - x + y}}
{\dd k \over 2\pi}}\pars{x\expo{-x^{2}}}
\pars{y\expo{-y^{2}}}\dd x\,\dd y\,\dd z
\\[5mm] = &\
{1 \over 2\pi}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\expo{\ic kz}\verts{z}
\verts{\int_{-\infty}^{\infty}x\expo{-x^{2} - \ic k x}\dd x}^{2}
\dd k\,\dd z
\\[5mm] = &\
{1 \over 2\pi}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\expo{\ic kz}\verts{z}
\verts{\int_{-\infty}^{\infty}x\exp\pars{-\bracks{x + \ic\,{k \over 2}}^{2} - {k^{2} \over 4}}\dd x}^{\ 2}
\dd k\,\dd z
\\[5mm] = &\
{1 \over 2\pi}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\expo{-k^{2}/2 + \ic kz}\verts{z}
\verts{\int_{-\infty + \ic k/2}^{\infty + \ic k/2}
\pars{x - \ic\,{k \over 2}}
\exp\pars{-x^{2}}\dd x}^{\ 2}\dd k\,\dd z
\\[5mm] = &\
{1 \over 2\pi}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\expo{-k^{2}/2 + \ic kz}\verts{z}{\pi k^{2} \over 4}\,\dd k\,\dd z
\\[5mm] = &\
{1 \over 8}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
\exp\pars{-\,{1 \over 2}\bracks{k - \ic z}^{2} -
{z^{2} \over 2}}\verts{z}k^{2}\,\dd k\,\dd z
\\[5mm] = &\
{1 \over 8}\int_{-\infty}^{\infty}\expo{-z^{2}/2}\verts{z}
\int_{-\infty - \ic z}^{\infty - \ic z}\expo{-k^{2}/2}
\pars{k^{2} + 2\ic kz - z^{2}}\,\dd k\,\dd z
\\[5mm] = &\
{1 \over 8}\int_{-\infty}^{\infty}\expo{-z^{2}/2}\verts{z}\
\underbrace{\int_{-\infty}^{\infty}\expo{-k^{2}/2}
\pars{k^{2} - z^{2}}\,\dd k}
_{\ds{\root{2\pi}\pars{1 - z^{2}}}}\ \dd z
\\[5mm] = &\
{\root{2\pi} \over 4}\
\underbrace{\int_{0}^{\infty}\expo{-z^{2}/2}z\pars{1 - z^{2}}\,\dd z}
_{\ds{=\ -1}}\ =\
\bbox[15px,#ffd,border:1px solid navy]{-\,{\root{2\pi} \over 4}}
\approx -0.6267
\end{align}
