# Expectation of nonnegative random variable when passed through nonnegative increasing differentiable function

I am having trouble proving the following result:

Let $$X$$ be a nonnegative random variable and $$g:\mathbb{R}\rightarrow\mathbb{R}$$ a nonnegative strictly increasing differentiable function. Then

$$\mathbb{E}g(X)=g(0)+\int_{0}^{\infty}g^{\prime}(x)\mathbb{P}(X>x)dx$$

I know that it should follow using integration by parts, but using integration by parts in the more abstract setting of probability is a bit confusing to me. Details would be appreciated.

$$\mathbb E[g(X)] = \mathbb E[\int_0^{g(X)}dt] = \mathbb E[\int_{g(0)}^{g(X)}dt + \int_0^{g(0)} dt ] = \mathbb E[\int_{g(0)}^{g(X)}dt ] + \mathbb E[g(0)] = \mathbb E[\int_{g(0)}^{g(X)}dt ] + g(0)$$

Now using the definition of expectation, we get: \begin{align*} \mathbb E\left[\int_{g(0)}^{g(X)}dt \right] &= \int_\Omega \int_{g(0)}^{g(X)}dt d\mathbb P(\omega) = \int_\Omega \int_0^\infty \chi_{(g(0),g(X(\omega))}(t)dtd\mathbb P(\omega)\\& = \int_0^\infty \int_\Omega \chi_{(g(0),g(X(\omega))}(t)d\mathbb P(\omega) dt =\int_0^\infty \mathbb P( g(0) < t

Use of Fubini due to all things being nonnegative (so we can swap order of integration).

Now, last thing $$\mathbb P( t \in (g(0),g(X)) = \mathbb P( 0

So, we get $$\int_{g(0)}^\infty \mathbb P( g(0) < t

And we get $$\mathbb E[g(X)] = g(0) + \int_0^\infty g'(s)\mathbb P(X>s)ds$$

• (+1)Nice answer using the change of variable in the last step to produce the derivative of $g$.
– Feng
Aug 6 '19 at 2:25
• I am with until this line: $\int_{g(0)}^{\infty}\mathbb{P}(0<g^{-1}(t)<X)dt=\int_{0}^{\infty}g^{\prime}(s)\mathbb{P}(s<X)ds$ There is a substitution happening here, but I don't see how you are getting from a preimage to a derivative. Aug 6 '19 at 2:27
• Is the substitution $s=g^{-1}(t)$? Aug 6 '19 at 2:29
• @RobertThingum Yes. It is the subsitution $s=g^{-1}(t)$. Then $t=g(s)$.
– Feng
Aug 6 '19 at 2:52
• @RobertThingum Yes, sorry. Maybe I should have explained more. $g^{-1}$ exists, cause $g$ is stricly monotone. If $c = \sup\{X(\omega) : \omega \in \Omega\}$, then $\int_{g(0)}^{\infty} \mathbb P( g^{-1}(t) \in (0,X) )dt = \int_{g(0)}^{g(c)} \mathbb P(g^{-1}(t) \in (0,X)) dt$. Now after substitution $t = g(s)$, we get $dt = g'(s)ds$ and limits of integral from $0$ to $c$, so $\int_0^c g'(s)\mathbb P( s \in (0,X))ds$. But $s>0$, so it's the same as $\int_0^c g'(s) \mathbb P(s < X) ds$. As $c = \sup\{X(\omega) : \omega \in \Omega\}$, it holds that for $x>c: \mathbb P(x<X)=0$.Hencelimit $\infty$ Aug 6 '19 at 14:15

The general result is:

Claim: Let $$g$$ be differentiable. If $$g$$ and $$g'$$ are bounded, then $$\bbox[5px,border:2px solid red] {E[g(X)]=g(0) +\int_0^\infty g'(x)P(X>x)\,dx-\int_{-\infty}^0 g'(x)P(X\le x)\, dx.}$$ The result also holds if $$g$$ is monotonic, provided the RHS is not $$\infty-\infty$$.

Proof: First suppose that $$X$$ is nonnegative. Write $$g(X)-g(0)\stackrel{(1)}=\int_0^X g'(t)\,dt\stackrel{(2)}=\int_0^\infty g'(t) I_{X>t}\,dt.$$ Equality (1) is the fundamental theorem of calculus (remember $$g$$ is differentiable), while (2) is valid because the indicator random variable $$I_{X>t}$$ has value $$1$$ when $$t, and equals zero otherwise. Take expectation: $$E[g(X)-g(0)]=E\left[\int_0^\infty g'(t) I_{X>t}\,dt\right]\stackrel{(3)}=\int_0^\infty g'(t)E[I_{X>t}]\,dt\stackrel{(4)}=\int_0^\infty g'(t)P(X>t)\,dt.$$ Identity (3) is the result of Fubini's theorem. In (4) we recognize that the expectation of the indicator of an event is the probability of the event.

Next, suppose $$X$$ is nonpositive. A similar argument shows $$E[g(X)-g(0)] = -\int_{-\infty}^0 g'(t)P(X\le t)\,dt.$$

For general $$X$$, write $$g(X)-g(0) = g(X^+)-g(0)+g(-X^-)-g(0)$$ where $$X^+ := XI(X>0)$$ is the positive part of $$X$$ and $$X^-:=-XI(X<0)$$ is the negative part. Apply the previous special cases to obtain $$E[g(X^+) -g(0)]= \int_0^\infty g'(t)P(X^+>t)\,dt$$ and $$E[g(-X^-)-g(0)]=-\int_{-\infty}^0 g'(t)P(-X^- \le t)\,dt.$$ To conclude, note that $$\{X^+>t\}=\{X>t\}$$ when $$t>0$$, and $$\{-X^-\le t\} = \{X\le t\}$$ when $$t<0$$.