# Distribution of a Function of a Random Variable

1. Nov 18, 2014

### izelkay

1. The problem statement, all variables and given/known data
If X is uniformly distributed over (0,1), find the PDF of Y = |X| and Z = e^X

Focusing on the |X| one

2. Relevant equations
Derivative of CDF is the PDF

3. The attempt at a solution
So I start by writing down the CDF of X, Fx(x):

0 for x <0
x for 0 ≤ x ≤ 1
1 for x ≥ 1

And I also know the range of Y = |X| is [0,1]
Finding the CDF of Y:

FY(y) = P(Y≤y)
=
P(|X|≤y)
=
P(-y ≤ X ≤ y)
=
Fx(y) - Fx(-y)

So
FY(y) = Fx(y) - Fx(-y)

But the range of Y is [0,1] so I can get rid of the Fx(-y) and have

FY(y) = Fx(y) = y

So the CDF of Y is then

0 for y < 0
y for 0 ≤ y ≤ 1
1 for y≥1

To find the PDF, I can just take the derivative and have

1 for 0 ≤ y ≤ 1
0 otherwise

Is this correct?

2. Nov 18, 2014

### Ray Vickson

You can simplify the argument by noting that, for X ~ Unif(0,1), we have |X| = X for all nonzero values of X; this just eliminates any need to look at the zero-probability values X < 0 or X > 1. (However, to a certain extent, the way you should do it depends on how your textbook or course notes do it.)

3. Nov 18, 2014

### izelkay

Is the way I approached it correct though?
Like for example, if I changed the problem statement so that X is uniformly distributed over (-5,5) and I want to find the PDF of Y= |X|, then the range of Y would be [0,5].

The CDF of X is

0 for x < 0
x for -5 ≤ x ≤ 5
1 for x > 5

Repeating the process I did before, the CDF of Y would be

0 for y < 0
y for 0 ≤ y ≤ 5
1 for y > 5

Then the PDF would be
1 for 0 < y < 5
0 otherwise

4. Nov 18, 2014

### LCKurtz

That is obviously wrong because the area under its graph is 5, not 1. You have the wrong distribution at the beginning for a uniform distribution on (-5,5).

5. Nov 18, 2014

### izelkay

Oh oops, I meant to write:

The CDF of X is

0 for x < -5
x for -5 ≤ x ≤ 5
1 for x > 5

Is that correct?

And then I'm not quite sure I understand what you mean by "the area under its graph is 5, not 1".
How would I find the PDF of Y?

If I find the CDF first:
FY(y) = P(Y≤y)
=
P(|X|≤y)
=
P(-y ≤ X ≤ y)
=
Fx(y) - Fx(-y)

So
FY(y) = Fx(y) - Fx(-y)

But the range of Y is [0,5], so

FY(y) = Fx(y)

Then the pdf is (taking the derivative)

fY(y) = fx(y)

Which isn't 1 I guess; I'm stuck here.

6. Nov 18, 2014

### Ray Vickson

7. Nov 18, 2014

### izelkay

Ok so I drew a picture of X:

Looking at this chart:

The pdf of X for mine must be 1/10 for -5 ≤ x ≤ 5 and 0 otherwise right?
And the CDF of X is
0 for x < -5
(x+5)/10 for -5 ≤ x < 5
1 for x ≥5

8. Nov 18, 2014

### izelkay

"Do you know what is meant by the area under a graph? Do you know how to compute it?"

If the range of Y is [0,5]

Then the area under the PDF from [0,5] needs to be 1 correct? If I drew a picture similar to the one I drew for X, that would mean the height of the rectangle is 1/5. So is the PDF of Y

1/5 for 0 ≤ y ≤ 5
0 otherwise
?