# Expectation of a function of a continuous random variable

1. Mar 11, 2009

### kingwinner

If W=g(X) is a function of continuous random variable X, then E(W)=E[g(X)]=

∫g(x) [fX(x)] dx
-∞
============================
Even though X is continuous, g(X) might not be continuous.

If W happens to be a discrete random variable, does the above still hold? Do we still integrate ∫ (instead of sum ∑)?

Does it matter whether W itself is discrete or continuous?

Thanks!

2. Mar 12, 2009

### jambaugh

If the variable is discrete you can still express in terms of integrals using dirac delta functions though it is simpler to replace the integral with a sum over values.

3. Mar 12, 2009

### jason1995

Yes. Consider the simplest case, where g(x) = 1 if x is in [a,b] and 0 otherwise. Then

\begin{align*} E[W] &= 1\cdot P(W = 1) + 0\cdot P(W = 0)\\ &= P(g(X) = 1)\\ &= P(X\in [a,b])\\ &= \int_a^b f_X(x)\,dx. \end{align*}

On the other hand, the formula also gives

$$\int_{-\infty}^\infty g(x)f_X(x)\,dx = \int_a^b f_X(x)\,dx.$$

4. Jun 19, 2009

### gkannan16

Go for summations.....that will solve ur problem and rest all may complicate