# Absolute moment and integration by parts

Let $$X$$ be a real continuous random variable with distribution $$F$$ with finite moments. I want to calculate

$$E[\vert X \vert] = \int_{-\infty}^{\infty} \vert x\vert dF(x)= -\int_{-\infty}^{0} x dF(x) + \int_{0}^{\infty} x dF(x).$$ But I want to obtain an alternative expression in order to get rid of the absolute value. I tried to split this variable using integration by parts $$U=-x$$, $$dV = dF(x)$$, then $$dU= -dx$$, $$V=F(x)$$ and

$$-\int_{-\infty}^{0} x dF(x) = UV \Big\vert_{-\infty}^0 - \int_{-\infty}^0VdU$$

Then, $$-\int_{-\infty}^{0} x dF(x) = \int_{-\infty}^0F(x)dx.$$

For the second integral this trick does not work as I get an infinite integral. How can I solve the second part? I think I should get something like $$\int_{0}^{\infty} x dF(x) = \int_0^{\infty}1-F(x)dx,$$ but I am not sure how to prove it.

• This result is demonstrated in many posts here, usually incidental to solving some other problem. For instance, you can find the (one-line) proof in the middle of my post at stats.stackexchange.com/a/209193/919 after the statement "the expectation of any positive distribution F is the integral of its survival function." – whuber May 6 '19 at 14:02

How about the following partial integration (formally written as an ordinary integral, not as a Stieltjes integral): $$\int_0^{\infty}x\cdot f(x)\;dx = -\int_0^{\infty}x\cdot(1-F(x))'\;dx = \underbrace{-x\cdot (1-F(x))\Big|_0^{\infty}}_{=0} + \int_0^{\infty}1-F(x) \; dx$$
• When the derivative is interpreted in terms of distributions (aka generalized functions), this even holds for the discrete case. Remember that $\theta'=\delta$, i.e., the derivative of Heaviside's step-function is Diracs delta-distribution, which is the density of probability distribution with mass one at zero. – cdalitz May 7 '19 at 11:46