# Homework Help: Expectation of a function of a continuous random variable

Tags:
1. Oct 5, 2015

### whitejac

1. The problem statement, all variables and given/known data
X ~ Uniform (0,1)
Y = e-X
Find FY (y) - or the CDF
Find fY(y) - or the PDF
Find E[Y]

2. Relevant equations

E[Y] = E[e-X] = ∫0 , 1 e-xfx(x)dx
FY(y) = P(Y < y)
fY(y) = F'Y(y)

3. The attempt at a solution
FX(x) =
{
0 for x<0
x for 0<x<1
1 for 1<x
}

fX(x) =
{
1 for 0<x<1
0 otherwise
}

Then use this information to solve:

FY(y) = P(Y < y) = P(e-X < y) = P(X < -lny)
^This is a negative function which violates one of the axioms of our continuous random variables (fX(x) ≥ 0)

fY(y) is reliant on FY(y)

E[Y] = E[e-X]
= ∫0 , 1 e^-xfx(x)dx
= -e-x | 0 , 1
= 1 - 1/e

I know this answer is corrrect, which means that my CDF and PDF of Y are incorrect because using those will give me the negativ of this answer. So I'm a little bit stumped, or misinterpretting how to continue the CDF equation.

2. Oct 5, 2015

### Ray Vickson

When you say "^This is a negative function ... " you are off base: there is nothing negative about $P(X < - \ln y)$. Probabilities must always be >= 0, but X-values are certainly allowed to be negative. But in this case, not even that happens: we can have $\ln y < 0$, which would make $- \ln y > 0$. For what values of $y$ will that occur? Those would be the allowable values of $y$ in this example, since the non-zero-probability values of $x$ lie between 0 and 1.

3. Oct 5, 2015

### RUber

It looks like you have done just about everything correctly.
As Ray pointed out, there is nothing wrong with your function.
If $y = e^{-x}$, what is the probability, P(Y < y)? It should be similar to the probability P(X>x), or 1-P(X<x).

4. Oct 5, 2015

### whitejac

Oh, I see...
The Range of Y is found by plugging the Range of X into the function of Y -> So, 0 gives 1 and 1 gives 1/e, if i'm not mistaken.
Plugging in my new end points to the (-lny) in fact returns me to the Range of X, [0,1]. Is this one of the properties of transforming functions? I'm asking to see if it's a reliable way to check my work.

However, then, my continuation of the problem seems confusing.
if
FY(y) = -lny
then
fY(y) = d/dy FY(y) = -1/y
=>
E[Y] = ∫(1/e , 1)y*fY(y)dy = -y|(1/e , 1) = 1/e -1

which is backwards to my original answer. Should I switch my limits of integration around?
I figured RangeY was defined as [1/e, 1]. This would be smallest to greatest, however when you plug those into the equation, -lny, they would yield the opposite (1 to 0).

5. Oct 5, 2015

### Ray Vickson

I always recommend drawing a graph of X vs Y whenever possible. In this case, doing that will show very clearly that $P(Y \leq y) = P(X \geq - \ln y)$, NOT the $P(X \leq - \ln y)$ that you wrote. Your $f_Y(y) = -1/y$ is $< 0$, so does, indeed, violate basic probability notions. That should have been a red flag that indicated to you that something was wrong.

6. Oct 6, 2015

### whitejac

So, if i understand what you're saying, then...
We must convert ourr CDF in a sensible way:
FY(y) = P(Y<y) = P(e-X<y) = P(X > lny)
Or
FY(y) =
{
0 for y > 1
-lny for 1/e < y < 1
1 for y < 1/e
}

This is what I found to be the proper values after graphing it and entering in values for the range.
The graph of a uniform function are essentially y=x for [0,1]
The graph of y=e-x are a downward curve.
The graph of -lny is also a downward slope, but rotated it seems.

What I do not understand is the X > -lny... In my mind, from viewng the numbers, it has to be this way because as you start plugging in points (particularly the end points and a few in the middle) it appears to move in the opposite direction so you must take it from the opposite direction. However, I do not understand how this helps me find the pdf because I'd still have d/dx (FY(y)) = -1/y
Maybe that's an algebraic stupidity because if it's X>-lny then the integral would be taking it from (b -> a) instead of (a -> b)..?

7. Oct 6, 2015

### RUber

What is the appropriate form for the CDF of y, such that when y is at its minimum F(y) = 0 and when it is at its maximum F(y) =1?
You know that y is functionally related to x by some form of $y = e^{-x}$, right?
So you want your CDF to have the property that F(1) = 1 and F(1/e) = 0. What you have above is the opposite. F(1) = 0 and F(1/e) = 1. Can you think of any way to remedy that?

8. Oct 6, 2015

### Ray Vickson

If you really did plot $Y = e^{-X}$ over $0 \leq X \leq 1$ you would see that smaller $Y$ corresponds to larger $X$, so $\{ Y \leq y \}$ corresponds to $\{ X \geq x_y\}$ for some value of $x = x_y$. The value of $x_y$ is the solution of the equation $e^{-x} = y$. Can you write $x_y$ in a simple formula involving $y$?

Note that your $F_Y(y) = - \ln y$ is still wrong: it gives $f_Y(y) = dF_Y(y)/dy = - 1/y < 0$ again! Go back to square 1, and proceed slowly and carefully.

9. Oct 7, 2015

### whitejac

I really did plot Y = e -x.
Y = e-x = 1, 0.9, 0.82, 0.75.... 0.55, 0.45, 0.36
for x = 0, 0.1, 0.2,.... 0.8, 0.9, 1
this is a decreasing function bounded by [1, 1/e].

X = x which is just a linear function and the two intersect at a point roughly 0.6.

If xy = x and e-x = y,
then
-x = lny
x = -ln y
x = xy = -lny
and {X > -lny}

I'm not trying to be difficult or lazy, it just really seems like you're asking me to do the same thing over and over...

Okay. I know that the function is uniform probability over the range [0,1].
Y is a function of X = x for x = [0,1] in the form of Y = e-X.
We are asked to represent the same data in the form of the CDF of Y.
First step is to find the range of Y. I've done this by substituting the limits of X in to the function of Y. -> RY = {1/e , 1}.
As stated above, plotting the two functions gives a linear graph y = x and a graph y = e-x.
One rises and one descends. Note that Y is high where X is low and vice versa.
Originlly I assumed that getting {X > y} would allow me to say FX(-lny) = -lny... however, from the responses, this appears to be where my illegality starts and I don't think I completely understand why other than the fact that its derrivative proves it to be incorrect. Taking the absolute value could solve that, but I can't justify it.

10. Oct 7, 2015

### whitejac

Like i said to Ray, I could take the absolute value since it is strictly decreasing, but that's the only justification I really have for doing that. I can't see any other way, however, to achieve the same values in reverse by manipulating the function itself.

The appropriate form would be:
FY(y) {
0 for values less than RY
P(Y < y) for y∈RY
1 for values greater than RY }

Now, going back to P(y1 < Y < y2) = FY(y2) - FY(y1) in my section about CDF's and their general form, gives me a little bit more interest in taking the absolute value when the function is decreasing because clearly a decreasing function could never be probable then and that doesn't make sense at all.

11. Oct 7, 2015

### RUber

Don't think of y as a function of x, think of F(y) as a CDF. And a CDF must, by definition be an increasing function.
P(y<Y) = P(x>-ln(Y) = P(x > X) = 1-Fx(X).
** Fx(X) is P(x<X), so P(x>X) must be 1-Fx(X). **
Your attempt was Fy(Y) = -ln(y) ... but this is incorrect. You can see this clearly because at your minimum value for y at 1/e, your CDF is equal to 1 and at your maximum value for y at 1, your CDF is equal to zero.
If you have a function that is goes from 1 to 0, and you want it to go from 0 to 1, subtracting from 1 is a good method. And logically if fits the treatment you would give for P(x>X)...does that make sense?

12. Oct 7, 2015

### whitejac

Oh...oh! I was thinking of it just in terms of graphs, for some reason.

Yes, I think I can see this. However, to what extent do two cdf's relate to each other then?
I mean, was this idea incorrect thinking: {Y>y}, {e^-X>y}... =-lny incorrect thinking? Because to that extent, I really do see them as two functions of x.

Also, wouldn't taking 1-FY(y) would give me compliment or does that not apply when it's not just a partition. The way I see it now is that if the graph is summed to 1 and read left to right but the numbers ought to be read right to left then 1-FY(y) makes the most sense because you are reading it backwards.

13. Oct 7, 2015

### Ray Vickson

No, I am not asking you to do the same thing over and over; I am not asking you to keep repeating the same (or similar) mistakes. I am asking you to do it once, correctly. There is no need (and no justification) to resort to tricks like taking absolute values; just using correct formulas correctly will do the job.

Last edited: Oct 7, 2015
14. Oct 7, 2015

### RUber

Remember that inequalities flip when you change the signs.

P(y<Y)= P(y < e^-X) = P(ln y < -X) = P(- ln y > X ) = 1 - P ( -ln y < X ) = *** EDIT *** 1-(- ln y)

Last edited: Oct 7, 2015
15. Oct 7, 2015

### whitejac

Right right, I think that's what I was trying to say when I edited my post, but you may have not gotten it in time or I didn't finish the thought out. I remembered the sign flipped, after some help from both of you, but I didn't make the connection ahead of time that that would be equivalent of saying 1-(the original sum of probabilities). I'm still not used to seeing these as cumulative graphs instead of fractions or sets like the previous chapters. My professor warned us at the beginning f the semester about this.

16. Oct 7, 2015

### whitejac

This brings me to another question about your method - the pdf would also have to be 1-fY(y), yes? If not, we'd still have the -1/y problem. It it sounds like a catch-22 to me.

17. Oct 7, 2015

### RUber

Sorry--just edited post 14. That problem is solved.

18. Oct 7, 2015

### Ray Vickson

This still looks wonky to me: it is as though you are getting the correct answer for incorrect reasons. However, since you have now more-or-less "gotten" it, I feel I can now give the details of the solution, presented now for the sake of gathering together various strands and cleaning up the argument.

For $0 \leq X \leq 1$, the random variable $Y = e^{-X}$ ranges over $1/e \leq Y \leq 1$, and for $y$ in that range we have
$$\begin{array}{l} F_Y(y) = P(Y \leq y) = P(e^{-X} \leq y ) = P(X \geq - \ln y)\\ = 1 - (- \ln y) = 1+ \ln y. \end{array}$$
Here we have used the fact that for $X \sim U(0,1)$ we have $P(X \geq t) = 1 - t$ for $t = - \ln y \in [0,1]$.

Note that as $y$ increases from $1/e$ to 1, $F_Y(y) = 1 + \ln y$ increases from 0 to 1, just as it should for a cdf. The pdf of $Y$ is
$$f_Y(y) = \frac{d}{dy} F_Y(y) = \frac{1}{y}, \; 1/e \leq y \leq 1$$