# How to compute E[$g(X)$] in terms of $X$'s CCDF (complementary cumulative distribution function)?

If we know the PDF $$f$$ of a random variable $$X$$ then we can compute an expression like $$\mathrm E[g(X)]$$ as $$\mathrm E[g(X)] = \int_{\mathrm{Im}(X)} g(x) f(x) \mathrm dx \, .$$

Let $$F$$ be the CDF of a positive random variable $$X$$, then we call $$\bar{F}=1-F$$ the complementary CDF (CCDF) of $$X$$. It is a well-known result that $$\mathrm E[X] = \int_{\mathrm{Im}(X)} \bar{F}(x) \mathrm dx$$. Is there a handy formular that allows to apply that to terms like $$\mathrm E[g(X)]$$? Since we have $$\mathrm E[g(X)] = \int_{\mathrm{Im}(X)} g(x) \mathrm d F(x)$$, another way to phrase the question is whether there is a general way to relate the Lebesgue-Stieltjes integral with respect to the CDF of $$X$$ to an integral involving its CCDF?

These questions came up while I was trying to solve a problem and I could reduce it to asserting that for some positive constant $$r$$ we have \begin{align}r \int_0^\infty x \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x &= \frac{\mathrm{d}}{\mathrm{d}r} \mathrm{E}[\mathrm{e}^{rX}] - \int_0^\infty \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x \\ &= \int_0^\infty x \mathrm{e}^{rx} \mathrm{d}F(x) - \int_0^\infty \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x \, . \end{align}

And I don't see a way to relate the two sides of this equation. I hope that I didn't miss any piece of additional information which makes this true, not holding in general though.

• Do you know any properties of $g$ ? For instance if it is positive and increasing then the answer is straight forward. – P. Quinton Feb 7 at 13:14
• In my specific problem $g(x) = \mathrm{e}^{rx}$ or $g(x) = x \mathrm{e}^{rx}$ for $x \geq 0$ so yes, it is positive and increasing here. – Hölderlin Feb 7 at 13:30
• maybe this could help – Masacroso Feb 7 at 14:36
• It's exactly what I needed, thank you so much! – Hölderlin Feb 7 at 20:17