# CDP of a function of a continuous RV

1. Apr 17, 2010

### IniquiTrance

REVISED: Expectation of a function of a continuous RV

Given:

$$f_{X}(x)=1$$

$$0 \leq x \leq 1$$

and 0 everywhere else.

We are asked to find E[eX]

The way my book does it is as follows:
I understand how to do it as follows. I don't understand the author's way of doing it.

$$Y = e^{X}$$

$$0 \leq x \leq 1$$

$$1 \leq y \leq e$$

$$F_{Y}(y) = P(X\leq Ln (y)) = \int_{0}^{ln y} f_{X}(x) dx = \int_{0}^{ln y} dx = ln (y)$$

$$f_{Y}(y) = \frac{d}{dy} \left[ln (y)\right]=\frac{1}{y}$$

$$E[e^{X}] = \int_{-\infty}^{\infty} y f_{Y}(y) dy = \int_{1}^{e} dy = e - 1$$

Can someone please explain to me why the author does it his way instead of mine?

I know I can make life easier by just taking:

$$\int_{-\infty}^{\infty}g(x)f(x) dx$$

but I want to understand what's going on here.

Any help is much appreciated!

Last edited: Apr 18, 2010
2. Apr 18, 2010

### IniquiTrance

Any ideas? Sorry to bump, just redid the whole post, so it's essentially a new question :).

3. Apr 18, 2010

### Dickfore

A general rule if you're given $$f_{X}(x)$$ to calculate $$E[g(X)]$$ is:

$$E[g(X)] = \int{g(x) \, f_{X}(x) \, dx}$$

4. Apr 18, 2010

### IniquiTrance

Yeah, I noted that I'm aware of that at the bottom of my post.

I just wanna understand why the book does it this way.

5. Apr 18, 2010

### Dickfore

I think the book did it the same way as you, but used a different dummy variable in the last integral.