Help with this one line derivation of manipulating integrals I was reading a paper and the authors stated a step of manipulating integrals that was far from obvious to me:
$$
\begin{align}
&\int_a^\infty (F_Y(z)-F_X(z))dz \\
&= e^{a/s}\int_a^\infty (F_Y(z)-F_X(z))e^{-z/s}dz + \int_a^\infty\left(\frac{e^{c/s}}{s}\int_c^\infty (F_Y(z)-F_X(z))e^{-z/s}dz\right)dc
\end{align}
$$
Some observations:

*

*I think the additional $e^{-z/s}$ is the result of some change of variables in integration.

*The integral in the first part and the inner integral in the second part is the same expression.

With those observations, I still could not derive it after several hours of attempt. I would really appreciate it if anyone knows what is going on.

Update: My hunch is the exact properties of the functions involved do not matter for this step. But in case they do, $F_Y$ and $F_X$ are CDFs of two distinct and bounded random variables with $\max[X] > \max[Y]$. $s$ is some large positive number such that
$$ \int_a^\infty (F_Y(z)-F_X(z))e^{-z/s}dz \geq 0$$
for all $a \in \mathbb{R}$.
 A: With $f(z)=F_Y(z)-F_X(z)$ and $s=1$ the formula is
$$\tag{1}
\int_a^{+\infty}f(z)\,dz=\int_a^{+\infty}f(z)\,e^{a-z}\,dz+\int_a^{+\infty}e^c\int_c^{+\infty}f(z)\,e^{-z}\,dz\,dc\,.
$$
This follows essentially from Fubini:
\begin{align}
&\int_a^{+\infty}\int_c^{+\infty}f(z)\,e^{c-z}\,dz\,dc=\int_a^{+\infty}\int_a^z f(z)\,e^{c-z}\,dc\,dz\tag{2}\\
&=\int_a^{+\infty}f(z)\,e^{-z}(e^{z}-e^{a})\,dz\tag{3}\\
&=\int_a^{+\infty}f(z)(1-e^{a-z})\,dz\,.\tag{4}
\end{align}
For any $s\not=0$ their formula is
$$\tag{1s}
\int_a^{+\infty}f(z)\,dz=\int_a^{+\infty}f(z)\,e^{\frac{a-z}{s}}\,dz+\frac{1}{s}\int_a^{+\infty}\int_c^{+\infty}f(z)\,e^{\frac{c-z}{s}}\,dz\,dc\,.
$$
Again by Fubini, the double integral here is
\begin{align}
&\int_a^{+\infty}\int_c^{+\infty}f(z)\,e^{\frac{c-z}{s}}\,dz\,dc
=\int_a^{+\infty}\int_a^zf(z)\,e^{\frac{c-z}{s}}\,dc\,dz\tag{5}\\
&=\int_a^{+\infty}f(z)\,e^{-z/s}\,s\,(e^{z/s}-e^{a/s})\,dz\tag{6}\\
&=s\int_a^{+\infty}f(z)(1-e^{\frac{a-z}{s}})\,dz\,.\tag{7}
\end{align}
This shows (1s).
