Evaluate integral inside integral I am struggling in evaluating the follow type of integral:
$$\int_{-\infty}^{x}f(z)\left[\int_{z}^{\infty}g(y)\,\mathrm dy\right] \,\mathrm dz.$$
I did some research and found out that the above expression is equivalent to the following, which might be easier to evaluate:
$$\int_{-\infty}^{\infty}\left[\int_{-\infty}^{\min(x,y)}\, f(z)\mathrm dz\right] g(y)\,\mathrm dy.$$
I am unable to see how those two expressions are equivalent and therefore struggling with this type of integral. Could anyone please guide me how to approach this integral or point me to any reference materials?
 A: First, sketch the domain of integration based on the first formula:

Then let's see what happens if we want $y$ to be the integration variable in the outer integral. Obviously we will have to integrate from $-\infty$ to $+\infty$ with respect to $y$.
The question remains: given an $y$ (blue lines) what is the domain of integration with respect to $z$?
It is easy to see that if $y<x$ then the domain is $(-\infty,y)$ if, however, if $y>x$ then the domain is $(-\infty,x)$. So, the domain is $(-\infty,\min(x,y)).$
A: Let's just assume that all integrals exist and converge.
Then, $$\int_{-\infty}^x f(z)\left[\int_z^\infty g(y)dy\right]dz =\\
=\int_{-\infty}^x \left[\int_z^\infty f(z) g(y)dy\right]dz$$
Now, try to draw the area you are integrating over. You are given a certain $x$ and you integrate over $z$ where $z$ goes from $-\infty$ to $x$. Then, for each $z$, you integrate over $y$ from $z$ to $\infty$. Therefore, you are integrating over the set
$$\{(z,y)| z< x\land y>z\}$$
It's a good idea to draw this set. Drawing it, you can imagine how to first integrate over $y$ and then over $z$:


*

*$y$ can take any value from $-\infty$ to $\infty$.

*If $y < x$, then $z$ can take any value from $-\infty$ to $y$ (to the line $y=z$, no further

*If $y>x$, then $z$ cannot take any value up to $y$ since $z$ must be smaller than $x$, so $z$ can take any value from $-\infty$ up to $x$.


Therefore,
$$\int_{-\infty}^x \left[\int_z^\infty f(z) g(y)dy\right]dz = \\
\int_{-\infty}^\infty \left[\int_{-\infty}^{\min(x,y)} f(z) g(y)dz\right]dy$$
A: A common way is to bring it all to indicatrice function : 
$$
\int_{-\infty}^{x}f(z)\left[\int_{z}^{\infty}g(y)dy\right]dz=
\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} f(z)g(y)1_{\{z \le y\}}1_{\{z \le x\}}dzdy$$
And then 
$$1_{\{z \le y\}}1_{\{z \le x\}} = 1_{\{z \le \text{min}(x,y)\}}$$
Assuming your functions are all integrable or positive, use Fubini's theorem, your integral become
$$
\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} f(z)g(y)1_{\{z \le \text{min}(x,y)\}}dzdy = \int_{-\infty}^{\infty}\left[\int_{-\infty}^{\text{min}(x,y)} f(z)dz\right] g(y)dy$$
