# Relation between integral by parts and Fubini's theorem

In probability, I have seen some examples for which both Fubini's theorem and integration by parts (for Riemann-Stieltjes integrals with cdf as integrator) provide different but correct solutions. For example

1. In proving $E(|X|)=\int_0^\infty P(|X| > t)dt$, Edvin and Didier used Fubini's theorem, while Ben used integration by parts;
2. In proving $\operatorname{median}(X)$ solves $\min_{c \in \mathbb{R}} E |X-c|$, Didier used Fubini's theorem, while Sivaram used integration by parts in Edit.

So I wonder if the two are related somehow? For example, in some cases (especially the two examples above), can one lead to the other?

1. A wide guess for going from Fubini's theorem to integration by parts is:

Integration by parts says

\begin{align} f(b)g(b) - f(a)g(a) & = \int_a^b g(x) \, df(x) + \int_a^b f(x) \, dg(x). \end{align}

If there is some $c \in \mathbb{R}$ such that $g(c)=0$, then $$\int_a^b g(x) \, df(x) = \int_a^b \int_c^x dg(t) \, df(x )$$ If Fubini's theorem or some of its variants can apply, then for some $d \in \mathbb{R}$, $$\int_a^b \int_c^x dg(t) \, df(x ) = \int_c^b \int_d^t df(x) \, dg(t ) = \int_c^b \int_d^x df(t) \, dg(x )$$ one step closer to $\int_a^b f(x) \, dg(x)$, but still far away from integration by parts.

2. No idea yet about going from integration by parts to Fubini's theorem.

Hope it is not just my wishful thinking. Thanks and regards!

-

Fubini implies integration by parts. To see this in dimension $1$, consider some $C^1$ functions $f$ and $g$ and the integral $$I=\int\limits_a^bf'(x)g(x)\mathrm dx.$$ Then, the fundamental theorem of calculus shows that, for every $x$, $$g(x)=g(a)+\int\limits_a^xg'(t)\mathrm dt,$$ hence $I=J+K$ with $$J=g(a)\int\limits_a^bf'(x)\mathrm dx=g(a)(f(b)-f(a)),$$ and, using Fubini theorem to justify the second equality sign below, $$K=\int\limits_a^bf'(x)\int\limits_a^xg'(t)\mathrm dt\mathrm dx=\int\limits_a^bg'(t)\int\limits_t^bf'(x)\mathrm dx\mathrm dt=\int\limits_a^bg'(t)(f(b)-f(t))\mathrm dt.$$ One sees that $K=L-M$ with $$L=f(b)\int\limits_a^bg'(t)\mathrm dt=f(b)(g(b)-g(a)),\qquad M=\int\limits_a^bg'(t)f(t)\mathrm dt.$$ Finally, $I=(J+L)-M$ with $$J+L=g(a)(f(b)-f(a))+f(b)(g(b)-g(a))=f(b)g(b)-f(a)g(a).$$